Sign in to follow this  
Followers 0
l3ill

[Solved} Print Dialog Stealing focus

5 posts in this topic

#1 ·  Posted (edited)

Hi All, Is there a way to force a window to stay activated during a popup event like a print dialog for instance? The script works fine most of the time with the normal winact ,winwaitact & sleeps but in the event that the default printer is out of paper or ink or whatever I have send's going to the print dialog instead of the pdf fields where they belong. Thanks for any help...

Edited by billo

Share this post


Link to post
Share on other sites



Hi All,

Is there a way to force a window to stay activated during a popup event like a print dialog for instance?

The script works fine most of the time with the normal winact ,winwaitact & sleeps but in the event that the default printer is out of paper or ink or whatever I have send's going to the print dialog instead of the pdf fields where they belong.

Thanks for any help...

You could use ControlSend instead of Send then you can direct the text to the correct window.

Also, you could detect when the dialogue pops up and deal with it some way.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

thanks Martin,

I had played with the idea of control send but as soon as the user clicks the cancel button on the print popup...well you know.

What kind of ideas do you have on detecting the "focus thief" and then pausing the script (function) until focus is returned ?

The script is a list of hotkeys tied to functions that fill in a barrage of pdf forms one at a time and then prints and closes them before opening another one to continue.

I can stop the danger of clicking around by the user with "blockinput" but this little problem is proving to be an annoying little bug.

Thanks again for all your help!

Edited by billo

Share this post


Link to post
Share on other sites

Maybe try the function SendKeepActive? I haven't tested it myself, but it looks like it might help here.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Nice find ascendant. hadn't seen that before, certainly sounds like it should work.

But I was just playing with the example and a click away from the window still causes it to drop letters.

Thanks anyway man!

Just finished testing again on my code and it works!!

The example has a second sleep that was allowing it to skip letters.

Rock on Ascend4nt

Edited by billo

Share this post


Link to post
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
Sign in to follow this  
Followers 0