Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
working with buttons
#1
I'm having trouble finding if a button is pressed within a floating toolbar (see file attached) I would like my macro to detect if the ruler is pushed, and if so click the button to deselect. If not pushed, then the macro does nothing. I first tried using control-specific actions:

but% child("" "AfxWnd80" win("Measurements" "#32770") 0x1)

For some reason, this command does nothing, as if the button is not recognized. I got around it by using accesible objects:

int w=win("Measurements" "#32770")
Acc b=acc("Measurements" "" w "#32770" "" 0x1001)
if (b.a)=84195512
b.Mouse(1)

The problem with this is that I don't seem to be able to find a condition that reliably detects whether the button is pressed.

Any pointers on how to approach this problem?


Attached Files Image(s)
   
#2
In 'Find accessible object' dialog click Properties, there you'll find object state. Probably will be 'checked' or 'pressed'. Then you can use State and STATE_SYSTEM_CHECKED or STATE_SYSTEM_PRESSED, like this:

if b.State&STATE_SYSTEM_CHECKED
#3
Thanks for your quick reply. The object property state says "focusable", see image below. In the code below, the PRESSED condition is never met:

int w=win("Measurements" "#32770")
Acc b=acc("Measurements" "" w "#32770" "" 0x1001)
b.Focus
if b.State&STATE_SYSTEM_PRESSED
b.Mouse(1)

I can't figure out how the program keeps track of the button being down.


Attached Files Image(s)
   
#4
It seems buttons here are not accessible objects.

Other way - find image.

if(scan(...))
,lef
#5
Works like a charm, thanks so much!


Forum Jump:


Users browsing this thread: 1 Guest(s)