Option Explicit
dim pageCount,ws,fso,scriptFolder,file,i,pdfFile,batchFile

set ws = CreateObject("WScript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")

if (WScript.arguments.length>1) then
    pdfFile = Wscript.arguments(0)
    pageCount = Wscript.arguments(1)
end if

batchFile = "converter-temp.bat"

pdfFile = inputBox("Wat is de bestandsnaam van de pdf?"&vbCrlf&vbCrlf&"Zorg dat het bestand in deze map staat en gebruik geen spaties in de bestandsnaam","Bestandsnaam",pdfFile)
pageCount = inputBox("Hoeveel pagina's heeft de pdf?","Aantal pagina's",pageCount)

if (pageCount>0 and pdfFile&""<>"") then
   Set file = fso.CreateTextFile(batchFile, true)
   file.WriteLine "@echo off"
   
   if (not fso.folderExists("pages")) then fso.createFolder("pages")
   
   for i=1 to pageCount
      file.WriteLine "pdf2swf " & pdfFile & " -o pages/" &
         n4(i) & ".swf --pages=" & i
   next 
   file.WriteLine "pause" 
   file.Close 
else
   msgbox "Script voortijdig beëindigd."
end if

function n4(num)
   n4 = right("0000"&num,4)
end function