Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Acc Unable to execute mouse click
#1
Hello, in many cases, using the Acc, I will encounter an operation that cannot perform the default operation and cannot perform a mouse click (The mouse will hover over the button and won't automatically click). Below is a sample code

In addition, when the waiting time is set to 0, no time parameter will be added to the code. I can only set it to -1 to always waiting it.


Using the code that waits and activates the window, I can successfully click the button, the code looks like this, (it's a bit strange,Need to activate it separately and set the delay)  but the work is unstable, and sometimes there will be errors. 

int w=wait(0 WA win(" - " "#32770"))
act w
0.5

but id(4427 w)


The above questions have common characteristics. I hope developers can provide some solutions. Thanks in advance.


Macro Acc not click
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 364 206 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 364 206 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,mac "sub.WaitForLoaded" "" hDlg
ret

#sub WaitForLoaded
function hDlg
SHDocVw.WebBrowser we3
we3._getcontrol(id(3 hDlg))
we3.Navigate("http://www.quickmacros.com/download.html")
opt waitmsg 1
rep() 0.01; if(!we3.Busy) break
30 WV hDlg

Htm e=htm("B" "Download" "" hDlg "0" 1 0x1 30)
e.Click

int w1=wait(-1 WV win(" - " "#32770"))
Acc a1.Find(w1 "PUSHBUTTON" "" "class=Button[]id=4427" 0x1004 -1)
a1.Mouse(1)
;a1.DoDefaultAction
#2
int w1=wait(0 WC win("File Download - Security Warning" "#32770"))
but id(4427 w1)
#3
No test success

I have tried many methods, only waiting for activation can succeed, but it is also unstable
#4
maybe the button is initially disabled, and need to wait eg 1 s. The code works well if waits 1 s.
#5
I found that the Acc operation is always good. The only problem is that it cannot be automatically pressed. Will this problem be fixed in the future?
The Acc function is too powerful  Smile
#6
I tested, DoDefaultAction works too.

...
Code:
Copy      Help
Acc a1.Find(w1 "PUSHBUTTON" "" "class=Button[]id=4427" 0x1004 -1)
1
a1.DoDefaultAction
#7
Thanks for your help, solving this problem is so simple, just add a number 1  Big Grin
QM is too powerful, omnipotent
#8
All use of Acc finally can not manually close the dialog window, what parameters need to be set? Huh


Macro Macro3
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 364 206 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 364 206 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,mac "sub.WaitForLoaded" "" hDlg
ret

#sub WaitForLoaded
function hDlg
SHDocVw.WebBrowser we3
we3._getcontrol(id(3 hDlg))
we3.Navigate("http://www.quickmacros.com/download.html")
opt waitmsg 1
rep() 0.01; if(!we3.Busy) break
30 WV hDlg

Htm e=htm("B" "Download" "" hDlg "0" 1 0x1 30)
e.Click

int w1=wait(-1 WV win(" - " "#32770"))
Acc a1.Find(w1 "PUSHBUTTON" "" "class=Button[]id=4427" 0x1004 -1)
1
a1.Mouse(1)

int w=wait(-1 WV win("Save As" "#32770"))
Acc a.Find(w "PUSHBUTTON" "" "class=Button[]id=1" 0x1004 -1)
a.DoDefaultAction

int w2=wait(-1 WV win("File Download" "#32770"))
Acc a2.Find(w2 "PUSHBUTTON" "Close" "class=Button[]id=2" 0x1005 -1)
a2.DoDefaultAction


Forum Jump:


Users browsing this thread: 2 Guest(s)