Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a.Location Troubleshooting
#1
Gint + QM Forum,

I've been trying to get better working inside of web browsers with Acc and the click flash example to expand my knowledge of QM which is still pretty minimal. Shown above is a part from a much larger macro that checks for a variety of named check boxes that occasionally appear and disappear depending on a few scenarios. Over the past few days I have noticed it will error out, but I never see the process fully. The error always links to the line, "a.Location (x y w h)". At first glace I assumed that maybe the window was disappearing, but wouldn't that affect a.Find instead of a.Location?

Macro Macro1
Code:
Copy      Help
;CheckBoxAction
if (aa = 0)
,callName = "Default Checkbox"
if (aa = 1)
,callName = "Primary Checkbox"
if (aa = 2)
,callName = "Success Checkbox"
if (aa = 3)
,callName = "Info Checkbox"
if (aa = 4)
,callName = "Warning Checkbox"
if (aa = 5)
,callName = "Danger Checkbox"

a.Find(w1 "STATICTEXT" callName "" 0x3031)
err
,wait 0.001; goto Top
a.Location(x y w h)
b=child(a)
ScreenToClient b +&x
x+w/2; y+h/2 ;;center
xy=(x&0xffff)|(y<<16)
SendMessage(b WM_LBUTTONDOWN 1 xy)
SendMessage(b WM_LBUTTONUP 0 xy)
#2
Need err after Location (like now is after Find), because a becomes invalid if the accessible object disappears after calling Find.
#3
Thank you Gint!

In addition, rather than making a new post, I had 2 more questions.

Question #1
Is there a way to check if button is checked with SendMessage in a similiar format to the click flash acc code?

Question #2
Is there an optimal wait setting to be the least cpu intensive other than just slowing down wait times? I know "spe" would be fastest, is there a variant that deals with cpu?
#4
1. I would use but()

2. Try opt waitcpu.

More info in Help.
#5
Okay. Thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)