Page 1 of 1

求助 mouseclick 失效  Topic is solved

Posted: 13 Oct 2017, 22:22
by adrian_9382
大家好 ,

我作了一个 脚本用来 把号码贴上然后到别的程式进行输入 再进行按键 但当我进行运行时 他的点击却失效了

然而 程式没快捷键 去取代点击 我嘗試過click / mouseclick / imagesearch 都不行 我实在想不出任何办法.............

我在别的论坛看过 说因为电脑内的工作程序上出现了问题才导致

可以用wm_command 或 control click 等的 但我实在不懂 可以有人给我一点例子 或教学吗 ......

以下是我的code 跟要运行的软件






; Generated by AutoGUI 1.4.9a
#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

Gui Add, Tab3, x25 y19 w269 h324, Level6| Level8

Gui Tab, 1

Gui Add, Edit, vlEdit x134 y80 w54 h17 ;Editbox with loop
Gui Add, Text, x58 y70 w65 h36 +0x200, Await Secord:
Gui Add, Text, x61 y190 w120 h23 +0x200, * Ctrl + 2 = STOP Action
Gui Add, Button, x55 y230 w80 h39 gsub1, start ;sub1
Gui Show, x0 y0 w326 h380, Window
Return


sub1:
guicontrolget, lEdit

FileSelectFile, Path
;Path := "C:\Users\CHEUNG TAT\Desktop\test.xls"
oSheet := ComObjCreate("Excel.Application")
oSheet.Workbooks.Open(Path)
oSheet.Visible := false





IfWinNotActive, 子佩电话管理系统4.9, , WinActivate, 子佩电话管理系统4.9,
WinWaitActive, 子佩电话管理系统4.9,
Send, {Alt}
Sleep,600
Send, {Right 2}
Sleep,600
Send, {Enter}
Sleep,600
Send, {Down 3}
sleep,600
send,{enter}
Sleep,600
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;sleep, %ledit%000

;oSheet.Range("A1").Value := "hello world!" ;set cell 'A1' to a string
;helloworld := "hello world!"
;oSheet.Range("A1").Value := helloworld ;set cell to a variable

;value := "TEST-VALUE"
;while (oSheet.Range("A" . A_Index).Value != "") {
; oSheet.Range("A" . A_Index).Value := value
;}
Wrkbk := oSheet.ActiveWorkbook


Loop ,2{
sColumn := Chr(A_Index+64) ;; convert 1 to A, 2 to B, etc...
while (oSheet.Range(sColumn . A_Index).Value != "") {
cell := oSheet.Range(sColumn . A_Index).text
; MsgBox (%sColumn%.%A_Index%)=%cell%
IfWinNotActive, 拨号盘, , WinActivate, 拨号盘,
WinWaitActive, 拨号盘,
send,%cell%
send,{Tab}
sleep,1000
send, {Enter}
sleep, %ledit%000
mouseclick,left, 1303,552***********************************当我一起运行时 都点错位..........但单独一个去运行 比如 弄脚本去点notepad 却成功...
}
}
oSheet.ActiveWorkbook.saved := false
Wrkbk.Close(0)
oSheet.quit
oSheet:=""


Sleep, 1000
Process, Exist, Excel.exe
MsgBox % ErrorLevel?"Excel Process is active":"Excel Process is not active"
sColumn := "" ; you have to clear this object
Sleep, 1000
Process, Exist, Excel.exe
MsgBox % ErrorLevel?"Excel Process is active":"Excel Process is not active"

return


图片为 我要用的软件 就是想按一下 下方 右边那个按钮

Re: 求助 mouseclick 失效

Posted: 14 Oct 2017, 20:29
by xuezhe
这软件不是干坏事用的吧。如果是干坏事就算了。防止骚扰电话。

Re: 求助 mouseclick 失效

Posted: 14 Oct 2017, 21:44
by adrian_9382
xuezhe wrote:这软件不是干坏事用的吧。如果是干坏事就算了。防止骚扰电话。

你想多了 ........... 我是用來測試 ........... BTW 問題解決了 我花了一整天才成功。。。。。

Re: 求助 mouseclick 失效

Posted: 15 Nov 2017, 22:03
by blues40651
用imagesearch 找那按鈕的圖 再用 if errorlevel = 0 click ...