karthikcoep 0 Posted December 23, 2010 I have created a test folder with two files with .tif extension (I have hundreds of .tif files, these two were just for testing the code). I want to convert these .tif files to .pdf files. I have set adobe acrobat as my default printer. I have written the following code expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 Global $hSearch = FileFindFirstFile("*.tif"), $sFile, $sFile1 If $hSearch = -1 Then Exit MsgBox(0, "Error", "No PDF files were found in the current directory.") While 1 $sFile = FileFindNextFile($hSearch) $sFile1 = StringTrimRight($sFile, 3) & "pdf" If @error Then Exit ShellExecute($sFile) WinWaitActive($sFile & " - Windows Picture and Fax Viewer", "") Send("^p") WinWaitActive("Photo Printing Wizard", "") Send("!n") WinWaitActive("Photo Printing Wizard", "") Send("!n") WinWaitActive("Photo Printing Wizard", "") Send("!n") WinWaitActive("Photo Printing Wizard", "") Send("!n") WinWaitActive("Photo Printing Wizard", "") ControlSend("Save PDF File As","","[CLASS:Edit; Instance:1]",@ScriptDir & "\" & StringTrimRight($sFile, 3) & "pdf") ControlClick("Save PDF File As", "", "[CLASS:Button; INSTANCE:2]") WinActivate($sFile1 & " - Adobe Acrobat Pro", "") WinWaitActive($sFile1 & " - Adobe Acrobat Pro", "") Send("^q") WinWaitActive("Photo Printing Wizard", "") ControlClick("Photo Printing Wizard", "", "[CLASS:Button; INSTANCE:8]") WinActivate($sFile & " - Windows Picture and Fax Viewer", "") WinClose($sFile & " - Windows Picture and Fax Viewer", "") WEnd The code executes properly and the first pdf is saved. Then the second tif file is opened but the code execution pauses when the window "save pdf file as" activates. Where did I go wrong,, Share this post Link to post Share on other sites
saywell 3 Posted December 23, 2010 Does the pdf printer default to a standard filename? If so, the second would be the same as the first, perhaps causing it to hang waiting for your input re next filename. William Share this post Link to post Share on other sites