Page 3 of 3

Running a batch

Posted: Fri Nov 23, 2012 9:56 am
by deesloop
OK This is definitely wierd

I change the code to run just one merge

Sub Main
Dim objResult
Set objShell = CreateObject("WScript.Shell")
Dim lp
Dim coad
lp = 2001
coad="c:\windows\system32\pdftk.exe d:\costs\splits\????-??-??_"
coad=coad & lp
coad = coad &"*.pdf cat output d:\costs\record\"
coad = coad & lp
coad = coad & "_costs.pdf"
On Error Resume Next
MsgBox coad
objResult = objShell.Run(coad, 1, True)

End Sub


The msgbox definitely shows that coad is correct
>c:\windows\system32\pdftk.exe d:\costs\splits\??
??-??-??_2001*.pdf cat output d:\costs\record\2001_costs.pdf

When its run nothing happens - no files created at all.

However when I runf from commandline it works.

Gaaaaah!!!!!

Running a batch

Posted: Fri Nov 23, 2012 10:11 am
by Oleg
I tried to use this script with non-existent files.
It's working without errors. Of course, output file wasn't created.
for example:
objResult = objShell.Run("D:\Temp\pdftk\pdftk.exe D:\incomming\ttt?.pdf cat output d:\temp\rt.pdf", 1, True)

But script doesn't generate error

I get this error (&H80070002) only if EXE file is not found.

BTW: you can place files pdftk.exe and libiconv2.dll in any folder.
Are you sure that pdftk.exe exists in c:\windows\system32 folder?
Maybe they is in C:\Users\<UserName>\AppData\Local\VirtualStore\windows \system3 2 folder
This can happen if you use old programs with old manifest (or without manifest). In this case windows run virtualization for such programs and automatically redirects files into virtualStore folder
Open Windows Explorer and check the existence of files.

Running a batch

Posted: Fri Nov 23, 2012 10:21 am
by deesloop
Very Very odd.
OK
So checked windows system 32 and they are definitely there
Browsed locall and from a remote machine to server\c$\windows\system32

So then I copied them to root fo C:
Bingo - works fine.

So went back to original code
Substitued c:\windows\system32\pdftk for c:\pdftk and the code works fine.

How odd is that???