Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Checking status of a button every specific period of time to force it
#1
Hello All,

I would like to check the status of a specific button every specific period of time (every 3 seconds for example).
Or this button is red (active) or this button is gray (not active).
If this button is gray for more than 3 seconds then we need a click mouse on this button to activate it again (red status).
How can I proceed ?
What should be the command lines examples ?
Thanks in advance for your help.
#2
Try dialog "Wait" (4-th button in the floating toolbar). In it select "Wait for color".
#3
Thank you for your help.
It works but only one time.
How can I make a loop to repeat forever the macro?
This macro needs to run simultaneously with others (In "Item Properties" / "Macro properties" / "If a macro running" / I choose "Run simultaneously).
#4
Example with Paint program.
To test:
Run Paint.
Run this macro.
In Paint select pure red color using the Edit Colors dialog. Must be red 255, green 0, blue 0.
Draw red at point 15 162 relative to the client area. The macro should print "red".
Undo. The macro should print "not red".
Redo and Undo to test repeating.

Macro Macro122
Code:
Copy      Help
int w=win("Untitled - Paint" "MSPaintApp")
rep
,err-
,
,;wait for red pixel
,wait 0 C 0xFF 15 162 w 1
,out "red"
,
,;here add code to click the button
,
,;wait for not red pixel
,wait 0 -C 0xFF 15 162 w 1
,out "not red"
,
,err+
,,if(!IsWindow(w)) break ;;window closed
,,end _error
#5
Excellent !! you made my day
Thank you so much !
Merry Xmas


Forum Jump:


Users browsing this thread: 1 Guest(s)