Drake Posted July 10, 2023 Posted July 10, 2023 I have written a code to automate Adobe Printing a file to PDF function using AutoIT, the requirement is, "when we open Adobe pdf document and run the below script, it should automatically print it to pdf and save it to a specific location". But when I run the below Autoit script file, instead of saving to the given path, it is saving just a folder before the given file path. Not the end point folder in the given path. "C:\u1\home\Audits_ABC\Completed_Audits\Server_Upload\" is the specific path. But, it is saving the pdf in folder "C:\u1\home\Audits_ABC\Completed_Audits\" and skipping the last "Server_Upload" folder I'm new to AutoIt, Does the ControlSend command have a limitation for taking the complete file path? Is there an alternative to it? Or am I making a mistake in writing the code. Please help PS: Ignore the long sleep pauses in the code. MouseClick("Left",75,167) Sleep(2000) Send("^p") Sleep(3000) Send("A") Sleep(2000) ControlCommand("Print","","ComboBox","Selectstring",'Microsoft Print to PDF') ControlClick("Print","","Button50") Sleep(5000) ControlClick("Save Print Output As","","ToolbarWindow324") Sleep(2000) ControlClick("Save Print Output As","","Edit2") Sleep(2000) Send("^a") Sleep(2000) Send("{ENTER}") Sleep(2000) ControlSend("Save Print Output As","","Edit2","C:\u1\home\Audits_DTS\Completed_Audits\Server_Upload") Sleep(5000) ControlClick("Save Print Output As","","Button2") Sleep(1000)
Drake Posted July 10, 2023 Author Posted July 10, 2023 5 minutes ago, Drake said: I have written a code to automate Adobe Printing a file to PDF function using AutoIT, the requirement is, "when we open Adobe pdf document and run the below script, it should automatically print it to pdf and save it to a specific location". But when I run the below Autoit script file, instead of saving to the given path, it is saving just a folder before the given file path. Not the end point folder in the given path. "C:\u1\home\Audits_ABC\Completed_Audits\Server_Upload\" is the specific path. But, it is saving the pdf in folder "C:\u1\home\Audits_ABC\Completed_Audits\" and skipping the last "Server_Upload" folder I'm new to AutoIt, Does the ControlSend command have a limitation for taking the complete file path? Is there an alternative to it? Or am I making a mistake in writing the code. Please help PS: Ignore the long sleep pauses in the code. MouseClick("Left",75,167) Sleep(2000) Send("^p") Sleep(3000) Send("A") Sleep(2000) ControlCommand("Print","","ComboBox","Selectstring",'Adobe PDF') ControlClick("Print","","Button50") Sleep(5000) ControlClick("Save Print Output As","","ToolbarWindow324") Sleep(2000) ControlClick("Save Print Output As","","Edit2") Sleep(2000) Send("^a") Sleep(2000) Send("{ENTER}") Sleep(2000) ControlSend("Save Print Output As","","Edit2","C:\u1\home\Audits_DTS\Completed_Audits\Server_Upload") Sleep(5000) ControlClick("Save Print Output As","","Button2") Sleep(1000)
spudw2k Posted July 10, 2023 Posted July 10, 2023 If I were to wager a guess, I suspect "Server_Upload" is being considered as the PDF file name. Perhaps add the filename after the full path you need. ControlSend("Save Print Output As","","Edit2","C:\u1\home\Audits_DTS\Completed_Audits\Server_Upload\pdf_filename.pdf") Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Drake Posted July 11, 2023 Author Posted July 11, 2023 36 minutes ago, spudw2k said: If I were to wager a guess, I suspect "Server_Upload" is being considered as the PDF file name. Perhaps add the filename after the full path you need. ControlSend("Save Print Output As","","Edit2","C:\u1\home\Audits_DTS\Completed_Audits\Server_Upload\pdf_filename.pdf") Thank you for the reply spudw2k. Actually, the scenario here is the PDF file is already open in Adobe and I am doing 'CTRL + P' to print it. For saving, the file name is already populated by the system and I am only clicking SAVE button. The issue is, the file is not being saved to the end folder 'Server_Upload' in the path, instead it is being saved to 'Completed_Audits'. Is the path too long for the 'ControlSend' to send it? Any help would be appreciated.
spudw2k Posted July 11, 2023 Posted July 11, 2023 (edited) I doubt it is a path length issue. You should be able to tell this by skipping the ControlClick at the end. If the full text shows up in the Edit2 field, then it is likely not a length issue. Tell you what, if you put in the path yourself, i.e. copy and paste, does it behave as expected, or does the file end up in the parent folder (Completed_Audits)? edit: To clarify what I mean, perform the same last two steps of your script (type in the path into Edit2 and then Click Button2), but manually. Edited July 11, 2023 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Drake Posted July 18, 2023 Author Posted July 18, 2023 On 7/10/2023 at 8:43 PM, spudw2k said: I doubt it is a path length issue. You should be able to tell this by skipping the ControlClick at the end. If the full text shows up in the Edit2 field, then it is likely not a length issue. Tell you what, if you put in the path yourself, i.e. copy and paste, does it behave as expected, or does the file end up in the parent folder (Completed_Audits)? edit: To clarify what I mean, perform the same last two steps of your script (type in the path into Edit2 and then Click Button2), but manually. Thank you, but I shortened the path and it is working.
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