|
你可以把左键改成右键或者中键里控制脚本,这样就不会和循环中的左键按下弹起冲突了
下面的代码是我之前写的一个类似的.你可以看看
- //按开始启动脚本, 等待鼠标按键,按下鼠标后键——运行循环点击(循环体内容可以修改),再按中键可以暂停和恢复循环
- namespace 辅助按键
- int handle,handle1
- //////////////////////
- function bool 控制()
-
- while(true)
-
- bool 是否暂停 = false
-
- if(是否暂停==false)
- int mousecode=鼠标.等待点击()
- 辅助.等待(50)
- if(mousecode==1006)//鼠标中键
- 是否暂停=thread.suspendthread(handle)//暂停脚本
- endif
- endif
-
- if(是否暂停)//暂停后,再按中键,恢复脚本
- int mousecode1=鼠标.等待点击()
- 辅助.等待(50)
- if(mousecode1==1006)//鼠标中键
- thread.resumethread(handle)//恢复脚本
- 是否暂停=false
- endif
- endif
-
- 辅助.等待(500)
-
- endwhile
-
- return true
- endfunction
- ////////////////////////////
- function bool 循环点击()
-
- while(true)
- keyboard.keypress(65,1)//A:65
- help.sleep(50)
- //循环体内容根据自己需要修改
- endwhile
- return true
- endfunction
- /////////////////////////////////////
- function bool 开始_click()
-
- int mousecode_begin=mouse.waitclick()
- 辅助.等待(500)
- if(mousecode_begin==1003)//热键运行脚本后,等待鼠标右键,按下右键,开始循环点击()操作
- //help.messagebox(convert.inttostr(mousecode_begin))
- handle=thread.beginthread("辅助按键.循环点击","")
- handle1=thread.beginthread("辅助按键.控制","")
- endif
-
- return true
- endfunction
- ////////////////////////////////////
- function bool 退出_click()
-
- thread.closethread(handle)
- thread.closethread(handle1)
- help.exit()
-
- return true
- endfunction
- endnamespace
复制代码 |
|