Jump to content

Recommended Posts

Posted

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"')
Posted

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.
Posted

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:

Posted

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.

Posted

Why not create a loop until that window exists? Something like:

While NOT WinExists("Title")
    Sleep(100)
WEnd
Msgbox(0,"","Window now exists!")oÝ÷ ØLm­¤^«^uû§rبƮ¶­sevä7FfFRââââ´vfW2fö7W2FòvæF÷p¥vä7FfRââââ´6V6·2bvæF÷r2fö7W0

Kurt

Awaiting Diablo III..

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
×
×
  • Create New...