Trying to figure out how wait for the status of a button to become disabled, so I can close down the window. Right now on my pc(development) it works, I try it on the prod pc, but the waitforcursorchange isn't working properly because on the slower pc it appears to flicker between normal and hourglass upon database activity.
I've been playing around with the WaitRectChange and WaitPixelColor without much success. They just sit in the wait state, even though my button is being enabled and disabled. I obtain the coords through the macro scheduler.
Any advise on this?
Thanks
Detecting enable/disable status of button
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7380
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
There are a number of ways to tackle this. I would consider using WaitPixelColor and choose a pixel in the text of the button as it will be grey when disabled, and black when enabled.
One approach I have used in the past is simply to have a loop where I keep sending the keystroke for the button and then watch to see if the result of pressing the button when enabled occurs. If not I loop back and press again. e.g. if pressing the button causes a window to appear, keep trying until the window appears. If it doesn't the button must be disabled, so the loop continues. If it does then the button must have been enabled, so I just carry on. e.g. use WaitWindowOpen with a timeout value set ... and loop back if the result is negative.
Hope this gives you some ideas.
Marcus
One approach I have used in the past is simply to have a loop where I keep sending the keystroke for the button and then watch to see if the result of pressing the button when enabled occurs. If not I loop back and press again. e.g. if pressing the button causes a window to appear, keep trying until the window appears. If it doesn't the button must be disabled, so the loop continues. If it does then the button must have been enabled, so I just carry on. e.g. use WaitWindowOpen with a timeout value set ... and loop back if the result is negative.
Hope this gives you some ideas.
Marcus
let>WW_TIMEOUT=60
label>my_loop
PushButton>Import Shipping History,&Close
IF>WW_RESULT=FALSE,my_loop,end
label>end
message>end
It drops to end on case of button being disabled or enabled unfortunatly.
If it's enabled, it closes window, and prints end.
If it's disabled, it prints end, but doesn't close window.
???
label>my_loop
PushButton>Import Shipping History,&Close
IF>WW_RESULT=FALSE,my_loop,end
label>end
message>end
It drops to end on case of button being disabled or enabled unfortunatly.
If it's enabled, it closes window, and prints end.
If it's disabled, it prints end, but doesn't close window.
???
- Marcus Tettmar
- Site Admin
- Posts: 7380
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
That was a good idea thanks, it works. This chunk of macro will attempt to close the window every 60 seconds. Once it closes, the script keeps going.
let>WW_TIMEOUT=60
label>my_loop
PushButton>Import Shipping History,&Close
WaitWindowClosed>Import Shipping History
IF>WW_RESULT=FALSE,my_loop,end
label>end
message>end
is the solution.
Reason I forgot to have the WaitWindowClosed was because sometimes I go in and edit a script, hit the save icon, and it tells me to enter a name for the script. I hit ok and it closes, not saving my changes.
Thanks,
Tim
let>WW_TIMEOUT=60
label>my_loop
PushButton>Import Shipping History,&Close
WaitWindowClosed>Import Shipping History
IF>WW_RESULT=FALSE,my_loop,end
label>end
message>end
is the solution.
Reason I forgot to have the WaitWindowClosed was because sometimes I go in and edit a script, hit the save icon, and it tells me to enter a name for the script. I hit ok and it closes, not saving my changes.
Thanks,
Tim
- Marcus Tettmar
- Site Admin
- Posts: 7380
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact: