Jump to content
tonycst

Need aternative to Send shortcut to a window

Recommended Posts

tonycst

I am having allot of problems with autoit verification in window being "closed" status.

After autoit says "Windows is closed"

WinWaitClose()

I still see the window on the screen for about 0.5 of  second or more.
That forces me to add delays into the script as well as secondary checks.
 

So my questions are: Is "closed" and "not on the screen" are not the same thing ? (assuming not)
And
Because of this issue, i need an alternative way to send 

Send("^p")

to the window to print the page.

I cannot use controlsend, because controlsend needs a CONTROL to send the character to and it "Sends a string of characters" and not the shortcut like Send function does.
Am i missing something here ?

 

 

It gets to a point of absurd.

I have to do WinWait and then WinWaitActive to double check that window is ACTUALLY activated and OK to send the shortcut.
Not to mention, i need to send DOWN key several times. How would i go about doing that using ControlSend ?

Then i do a loop check to see if print dialog is showing up. If not i will again activate the dam window and send the shortcut AGAIN.

 

Its gets very annoying at the very least.

 

Edited by tonycst

Share this post


Link to post
Share on other sites
JohnOne

If it's frustrating you, the chances are, you are repeating code and do not have it all wrapped in a nice little function.

However the delay in windows closing does not sound normal to me, you could have other issues causing lag.

In any case, might be a good idea to post some example code.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
tonycst
Func _PrintLabel() ;window already registered as EXISTS
    MouseMove(@DesktopWidth / 2, @DesktopHeight / 2, 1) ;move mouse to center of the screen
    WinActivate($LabelWindow) ;Activate label window
    Send("^p") ;Send print shortcut
    WinWaitActive($PrintWindow) ;wait till print dialog shows
    If WinGetText($PrintWindow, "General") = "" Then ;No general tab meaning normal print dialog
        WinActivate($PrintWindow)
        Send('{DOWN ' & $DownCount & '}') ;go down to a specfic printer for label
        Sleep(1000) ;need small delay
        Send("{ENTER}") ;hits print
        WinWait("Progress", "", 3) ;This window pops out while files being transfered to the printer.
        WinWaitClose("Progress", "", 3)
        WinClose($LabelWindow)
        Assign("NothingPrinted", 0)
        SoundPlay($BeepSound, 1)
    Else
        SoundPlay($BeepError, 1) ;Not normal print dialog
        MsgBox(16, "Error", "Page did not load correctly. Refresh the page and Print it manually.")
    EndIf
EndFunc   ;==>_PrintLabel

Corporate computers are loaded with crap causing all sorts of lag everywhere.

Here for example you can see i need sleep just to wait for window to update once printer is selected.

And what is wrong with the code wrapper ? It used to be good years ago and now its just random colors allover but only RIGHT AFTER posting it.

Once page is refreshed, its normal. (Firefox latest release)

Edited by tonycst

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.