zeng Posted July 16, 2014 Share Posted July 16, 2014 I am new to this but ran into a problem that is very odd I am trying to use this software http://www.pdflabs.com/tools/pdftk-server/ to rotate pdf files in a folder on a Win XP computer. When I ran the script below, nothing happened (no new rotated pdf file was created). But if I use the clipput in the script and paste to run command, it works (a new rotated pdf file was generated). I am at lost why the same command within autoit did not work Thanks a lot for your help. #include <File.au3> $FileList = _FileListToArray("C:\Documents and Settings\zeng\Desktop\fax inbox\rotate\", "*.pdf", 1) If $FileList[0] > 0 Then For $n = 1 To $FileList[0] If StringInStr($FileList[$n], "rotate") = 0 Then $mycommand = 'pdftk "C:\Documents and Settings\zeng\Desktop\fax inbox\rotate\' & $FileList[$n] & '" rotate 1-endsouth output "C:\Documents and Settings\zeng\Desktop\fax inbox\rotate\' & StringTrimRight($FileList[$n], 4) & ' rotated.pdf"' ClipPut(@ComSpec & " /c " & $mycommand); for trouble shot Run(@ComSpec & " /c " & $mycommand, "", @SW_HIDE) EndIf Next EndIf Link to comment Share on other sites More sharing options...
jguinch Posted July 16, 2014 Share Posted July 16, 2014 Where is pdftk.exe stored ? Try to set the working directory in the second parameter of Run() Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
zeng Posted July 16, 2014 Author Share Posted July 16, 2014 It worked! You are a genius. Link to comment Share on other sites More sharing options...
jguinch Posted July 17, 2014 Share Posted July 17, 2014 Please, mark your post as solved if it is Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Solution Mobius Posted July 17, 2014 Solution Share Posted July 17, 2014 This is only a suggestion; but since pdftk is an executable file you don't really need to be running it through cmd.exe (@Comspec /c)#include <File.au3> $FileList = _FileListToArray("C:\Documents and Settings\zeng\Desktop\fax inbox\rotate\", "*.pdf", 1) If $FileList[0] > 0 Then For $n = 1 To $FileList[0] If StringInStr($FileList[$n], "rotate") = 0 Then $mycommand = 'pdftk "C:\Documents and Settings\zeng\Desktop\fax inbox\rotate\' & $FileList[$n] & '" rotate 1-endsouth output "C:\Documents and Settings\zeng\Desktop\fax inbox\rotate\' & StringTrimRight($FileList[$n], 4) & ' rotated.pdf"' ;ClipPut(@ComSpec & " /c " & $mycommand); for trouble shot Run($mycommand, "", @SW_HIDE) EndIf Next EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now