Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wait for Pressing onscreen buttons (Yes or No) - case....
#1
Hi Gintaras,

An application dialog from the application has two PUSHBUTTON choices (Yes and No)

Code:
Copy      Help
Acc a=acc("Yes" "PUSHBUTTON" win("SampleApp" "#32770") "Button" "" 0x1001)
,a.DoDefaultAction

and

Code:
Copy      Help
Acc a=acc("No" "PUSHBUTTON" win("SampleApp" "#32770") "Button" "" 0x1001)
,a.DoDefaultAction

I would like to wait for one of those buttons to be pressed and if Yes do one thing and if No do another - In addition to letting the application do what it normally does with Yes and No.

i.e.

if Yes - means "Yes, sign report and exit", then I will write the QM code to wait for the next screen to come up and perform an action.
If No - means "don't exit, just stay in report" then I will end my macro with a ret.

Thanks,

Stuart
#2
Let the macro remembers button coordinates, waits until the dialog disappears, gets mouse coordinates, if they are where was button Yes, ...

Code:
Copy      Help
int w1=WinC("Save changes" "Static" 0 "WordPad" "#32770")
act w1

Acc a=acc("Close" "PUSHBUTTON" w1 "" "" 0x1001) ;;X button on title bar

rep
,0.02
,if(!IsWindowVisible(w1)) break
,RECT ry rn rc rx
,GetWindowRect id(IDYES w1) &ry
,GetWindowRect id(IDNO w1) &rn
,GetWindowRect id(IDCANCEL w1) &rc
,a.Location(rx.left rx.top rx.right rx.bottom); rx.right+rx.left; rx.bottom+rx.top
,POINT p; xm p

if(PtInRect(&ry p.x p.y))
,out "Yes"
else if(PtInRect(&rn p.x p.y))
,out "No"
else if(PtInRect(&rc p.x p.y) or PtInRect(&rx p.x p.y))
,out "Cancel"
else
,out "probably closed using keyboard"
,
#3
When the Yes/No dialog pops up from the app,

I want the user to be able to either hit F5 to activate the Yes (i.e. without actually mouse-clicking on the Yes button)

Code:
Copy      Help
wait 10 KF (VK_F5)    
Acc a=acc("Yes" "PUSHBUTTON" win("Commissure RadWhere" "#32770") "Button" "" 0x1 0 0 "" 20)
a.Mouse(1)

.....then wait for next screen and then execute rest of macro.

But what if the user decides instead to actually click on Yes

So either has to trigger the next part -

i.e. wait for either F5 or actually pressing Yes button

[this is similar to my other post| but slightly different.

Thanks again!!!!!!!

Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)