Jump to content

Problem pausing execution


Recommended Posts

I have a small script that I want to have WordPerfect print to an Adobe PDF file and then once it's DONE, I want to open Acrobat to manipulate the pdf file. WordPerfect creates the PDF perfectly, but a dialog box comes up to show progress, and after 1-20 seconds, the dialog box goes away when the pdf is completed. I need to wait for that moment before I run Acrobat but WinWait() doesn't wait. The code just proceeds along immediately without waiting. How can I ensure that the pdf process is complete before I run Acrobat?

WinActivate("WordPerfect")
Send("^p!g{tab}1!nAdobe PDF!p");Print page 1 to PDF file
WinWait("Creating Adobe PDF")   ;wait for Adobe dialog to come up...
While WinExists('Creating Adobe PDF');and wait for it to go away...
WEnd
WinWaitActive("WordPerfect")
Run('"c:\program files\adobe\acrobat 7.0\acrobat\acrobat.exe" "c:\temp\myfile.pdf"')
Link to comment
Share on other sites

I have a small script that I want to have WordPerfect print to an Adobe PDF file and then once it's DONE, I want to open Acrobat to manipulate the pdf file. WordPerfect creates the PDF perfectly, but a dialog box comes up to show progress, and after 1-20 seconds, the dialog box goes away when the pdf is completed. I need to wait for that moment before I run Acrobat but WinWait() doesn't wait. The code just proceeds along immediately without waiting. How can I ensure that the pdf process is complete before I run Acrobat?

WinActivate("WordPerfect")
Send("^p!g{tab}1!nAdobe PDF!p");Print page 1 to PDF file
WinWait("Creating Adobe PDF");wait for Adobe dialog to come up...
While WinExists('Creating Adobe PDF');and wait for it to go away...
WEnd
WinWaitActive("WordPerfect")
Run('"c:\program files\adobe\acrobat 7.0\acrobat\acrobat.exe" "c:\temp\myfile.pdf"')
Why not add WinWaitClose("Creating Adobe PDF")

WinActivate("WordPerfect")
Send("^p!g{tab}1!nAdobe PDF!p");Print page 1 to PDF file
WinWait("Creating Adobe PDF");wait for Adobe dialog to come up...
WinWaitClose("Creating Adobe PDF")
WinWaitActive("WordPerfect")
Run('"c:\program files\adobe\acrobat 7.0\acrobat\acrobat.exe" "c:\temp\myfile.pdf"')
EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

Try waiting for your print window and see if that helps.

WinActivate("WordPerfect")
Send("^p")
WinWaitActive("Print")
Send("!g{tab}1!nAdobe PDF!p");Print page 1 to PDF file
WinWait("Creating Adobe PDF")    ;wait for Adobe dialog to come up...
WinWaitClose('Creating Adobe PDF');and wait for it to go away...
WinWaitActive("WordPerfect")
Run('"' & @ProgramFilesDir & '\adobe\acrobat 7.0\acrobat\acrobat.exe" "c:\temp\myfile.pdf"')

:whistle:

Link to comment
Share on other sites

Thanks Endfunc and Mhz, but both your suggestions didn't work. The "Creating Adobe PDF" dialog box comes up but never gets focus (greyed title bar). It seems WinWait and WinWaitClose are totally unaware of it. In my test of the above fixes, the script still flew right past the WinWait but never gets past WinWaitClose.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...