Running a batch

Discuss RoboTask here
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Running a batch

Post 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!!!!!
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Running a batch

Post 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.
Last edited by Oleg on Fri Nov 23, 2012 2:16 pm, edited 1 time in total.
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Running a batch

Post 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???
Post Reply