Jump to content
Sign in to follow this  
c.haslam

Returning to Previous Windows State

Recommended Posts

c.haslam

I wish my script to do the following: when new mail is pending, maximize Pegasus and click to download it, then return to the window I was viewing before. This works AOK except when the Desktop is on the screen. Code follows:

CODE
$t = WinGetText("Pegasus Mail")

$mailWaiting = StringInStr($t,"waiting on pop.gmail.com")

if $mailWaiting Then

$ar = MouseGetPos()

$winTit = WinGetTitle("")

WinActivate("Pegasus Mail")

WinWaitActive("Pegasus Mail")

MouseClick("left",421,50) ; download

WinSetState("Pegasus Mail","",@sw_minimize)

if $winTit<>"" Then WinWaitActive($winTit) ; if no window was active

MouseMove($ar[0],$ar[1])

if $winTit<>"" is intended to detect when no windows are maximized, but the script sometimes pauses on this line.

Is there a better way?

...chris


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
Joon

Why don't you use ControlClick or ControlSend? Then your application can stay minimized.

Share this post


Link to post
Share on other sites
c.haslam

Why don't you use ControlClick or ControlSend? Then your application can stay minimized.

Many thanks. ControlClick works fine.

...chris


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

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  

×

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.