Triggering macro on window event

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
amilliondead
Newbie
Posts: 1
Joined: Sat Nov 25, 2006 12:53 am

Triggering macro on window event

Post by amilliondead » Sat Nov 25, 2006 1:25 am

I am trying to make a macro to click through an error message in an email forwarding app I have.

The idea is to get the macro to run when the error window pops up. I've been using the "advanced schedule>window event" option to do this, but I can't get it to work. It might be because the main window and the error window have the same name. (or perhaps because I'm a noob)

At the moment the macro runs as soon as I click "ok" on the settings dialogue- I think because the Mail Forward window is already open it thinks it's time to boogie, when actually the error message hasn't popped up yet.

Here's the code I've been trying, it probably doesn't make any sense.

Let>WF_TYPE=3
Let>WW_TIMEOUT=2
CapsOff
MouseMove>579,766
WaitWindowOpen>Mail Forward
FindWindowWithText>error,1,Mail Forward
MoveWindow>Mail Forward,389,164
ResizeWindow>Mail Forward,360,134
Wait>0.01
MouseMove>626,275
Wait>0.5
LClick

...am I along the right lines?

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Sat Nov 25, 2006 3:53 am

If the main window has the same name as the window you are trying to close, then you could first rename the main window , then use the Window Event in the macro properties.

Open the main program, then open ViewSystemWindows and find the window name (search for "MyWindow" for example) then use the SetControlText command (explained in help) to change the main window name (say maybe "MyMainWindow")...

Now things should work like you've been expecting.

I've had success with this before, but there is a chance your app may not be so easy to manipulate.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts