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
WINDOW_NOTOPEN doesn't recognise handle
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
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.
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?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?