simonwar Posted August 27, 2010 Posted August 27, 2010 Hi,I have a script that initiates a "Print to Adobe, Acrobat", but when it does it pauses my script and does not complete the script routine?This is my code$i = 0 $repeats = InputBox("Repeats", "How many loops?", "") While ($i < $repeats) _WinWaitActivate("Catalog - Orders", "") MouseClick("left", 301, 13, 1) MouseClick("left", 70, 136, 1) MouseClick("right", 70, 136, 1) Sleep(500) Send("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}") _WinWaitActivate("Mail", "") Sleep(500) Send("{TAB}{TAB}{HOME}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ESC}") _WinWaitActivate("Catalog - Orders", "") Send("{ALTDOWN}ts{ALTUP}") _WinWaitActivate("Select Print Destination", "") Sleep(100) Send("{ALTDOWN}p{ALTUP}") _WinWaitActivate("Save PDF File As", "") Sleep(100) Send("{CTRLDOWN}v{CTRLUP}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{BACKSPACE}{BACKSPACE}{ENTER}") _WinWaitActivate("esafetysigns.co.uk Order FB26DG10000520.pdf - Adobe Acrobat Pro", "") Sleep(9000) Send("{CTRLDOWN}q") $i = ($i + 1) WEndI am using SLEEP to slow AutoIt down to allow the program its working with to "catch up", however the final SLEEP, Sleep(9000), doesn't finish?The rest of the scipt is simply mouse moves around a screen to grab, COPY and PASTE, the relevant filenames required to SAVE AS.The SAVE AS works fine, Acrobat opens, but I cannot close Acrobat using Send("{CTRLDOWN}q"), and when I check the Script status in the task bar, it indicates Script Paused?Any ideas?Thanks, Simon.P.S. I have tried many different length SLEEPS at the end and none of them work.
wakillon Posted August 27, 2010 Posted August 27, 2010 (edited) _WinWaitActivate ? A new function ? And simplify your Send : {RIGHT 41} instead of "RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}"Same for DOWN, LEFT etc... Edited August 27, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
simonwar Posted August 27, 2010 Author Posted August 27, 2010 OK, done the mods, nice one.I think whats happening is this line is not always going to be the same:_WinWaitActivate("esafetysigns.co.uk Order FB26DG10000520.pdf - Adobe Acrobat Pro", "")as different files to SAVE AS could be esafetysigns.co.uk Order AB15CD10000521.pdf and so on 522, 523, etcHow do I close Adobe Acrobat Pro irresective of the file thats open in it?I tried _WinWaitActivate("Adobe Acrobat Pro", "") Send("{CTRLDOWN}q")but, didn't work?Thanks, Simon.
wakillon Posted August 27, 2010 Posted August 27, 2010 (edited) Try WinClose ("Adobe Acrobat Pro", "" ) or WinKill Edited August 27, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
simonwar Posted August 27, 2010 Author Posted August 27, 2010 Tried it but its still not having any of it. Printing as a PDF is causing a problem I can't get around, sticky? Any more ideas appreciated?
seandisanti Posted August 27, 2010 Posted August 27, 2010 Tried it but its still not having any of it.Printing as a PDF is causing a problem I can't get around, sticky?Any more ideas appreciated?Check out WinTitleMatchMode to see different title matching options to use in your WinWaitActive()
electrico Posted August 27, 2010 Posted August 27, 2010 _WinWaitActivate ? A new function ? And simplify your Send : {RIGHT 41} instead of "RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}"Same for DOWN, LEFT etc...Btw, this man as me, just used recorder, so I dont know why but recorder always create this new function while activating and disactivating any windows.
l3ill Posted September 6, 2010 Posted September 6, 2010 Tried it but its still not having any of it. Printing as a PDF is causing a problem I can't get around, sticky? Any more ideas appreciated? Hi Simon, if you are still looking here is how I solved a similar issue: ;Print PDF ======================================================================>>> WinActivate("sani_protocol.pdf") WinWaitActive("sani_protocol.pdf") Sleep(300) Send("^p") Sleep(300) WinWait("Print", "", 5) WinWaitActive("Print") Send("{ENTER}") ;cancels print for testing purposes============>>> ;ControlClick("Print", "Rotate and Center", "[CLASS:Button; INSTANCE:17]") Sleep(500) WinActivate("sani_protocol.pdf") WinWaitActive("sani_protocol.pdf") Sleep(300) WinKill("sani_protocol.pdf") Sleep(1000) ;Print PDF ======================================================================>>> My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
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