WINDOW_NOTOPEN doesn't recognise handle

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Tom
Newbie
Posts: 2
Joined: Sun Jul 31, 2011 3:20 am

WINDOW_NOTOPEN doesn't recognise handle

Post by Tom » Sun Jul 31, 2011 3:45 am

Hi

I am new to Macro Scheduler and have a small task I need to do but WINDOW_NOTOPEN Event does not recognise the handle of the window. I need to use the handle because the application I am extracting data from changes the windows title as it moves through screens so at any given time, the windows title is NOT the same as when it opened so I cannot use the title to test for the window being closed. I have written a small test script to get this working
--------------------------------------------

let>WIN_USEHANDLE=1
'Open notepad
RunProgram>notepad.exe
setfocus>Macro Scheduler
wait>1

'**BREAKPOINT**
'Get handle and Set focus to window and send some text to show we are in there using the handle
GetWindowHandle>Untitled - Notepad,nHandle
setfocus>nHandle
g
send>my Handle is - %nHandle%

'**BREAKPOINT**

'Setup an event to fire when window is closed
OnEvent>WINDOW_NOTOPEN,NHANDLE,,MyWindowIsClosed

'Go into an endless loop so we can close window manually to test if event is recognised
Repeat>
'Send something to show we in loop
'send>x
Until>

**BREAKPOINT**
'exit the script
exit

'Eventhandler routine
'Should only get here AFTER we manually close the window
SRT>MyWindowIsClosed
**BREAKPOINT**
END>

-------------------

If I set WIN_USEHANDLE=0 and use the window title (notepad*) it works fine, goes into the loop and stays the until I close the window manually, it then jumps to the MyWindowIsClosed SRT and hits the breakpoint...perfect.

If I use the handle as above, as soon as it hits the OnEvent command it immediately jumps to MyWindowIsClosed...not good...doesn't recognise the handle...any ideas guys...is this a bug.

Cheers


Tom

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Aug 01, 2011 9:26 am

Hi,

Presently the OnEvent window events do not work with handles, only titles. A modification to allow handles to be specified is on the wish list.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Tom
Newbie
Posts: 2
Joined: Sun Jul 31, 2011 3:20 am

Post by Tom » Mon Aug 01, 2011 9:54 am

Thank you for the prompt response .... a little disapponting given the manual indicates it can....looking forward to it working :)

I do like Macro Scheduler from what I have seen of it...I can see me working with it a lot, good stuff :)

Tom

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