594
社区成员
发帖
与我相关
我的任务
分享
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $btn_save
$check_poweroff = ControlGetText("MouseLite", "", $id_check_poweroff)
If $GUI_CHECKED == GUICtrlRead($id_radio_left) Then
$mousebutton = "left"
ElseIf $GUI_CHECKED == GUICtrlRead($id_radio_middle) Then
$mousebutton = "middle"
ElseIf $GUI_CHECKED == GUICtrlRead($id_radio_right) Then
$mousebutton = "right"
Else
MsgBox(0, "ERROR", "wrong button click!!")
EndIf
If $GUI_CHECKED == GUICtrlRead($id_check_poweroff) Then $check_poweroff = 1
If $GUI_UNCHECKED == GUICtrlRead($id_check_poweroff) Then $check_poweroff = 0
If 0 >= ControlGetText("MouseLite", "", $id_totaltime) OR 0 >= ControlGetText("MouseLite", "", $id_delay) OR 60*ControlGetText("MouseLite", "", $id_totaltime) < ControlGetText("MouseLite", "", $id_delay) Then
ControlSetText("MouseLite", "", $id_totaltime, "1")
ControlSetText("MouseLite", "", $id_delay, "1")
MsgBox(16, "ERROR", "illegal input! ")
Else
$totaltime = ControlGetText("MouseLite", "", $id_totaltime)
$delay = ControlGetText("MouseLite", "", $id_delay)
GUISetState(@SW_MINIMIZE)
MsgBox(64, "","Data Saved !", 2)
EndIf
Case $msg = $btn_quit
Exit
EndSelect
WEnd
EndFunc ;==>CreateGui
Func CreateGUI()
Local $main_win, $lbl, $msg
$main_win = GUICreate ("MouseLite", 200, 450)
$lbl = GUICtrlCreateLabel ("a auto mouse click tool.", 15, 10, 180)
GUICtrlSetFont ($lbl,12, 400, 4, "Corbel")
$lbl = GUICtrlCreateLabel ("*Guide: ", 5, 40)
GUICtrlSetFont ($lbl,10, 600, 1, "Dotum")
; GUICtrlSetColor($lbl, 0x4444ff)
$lbl = GUICtrlCreateLabel ("F9 -- start the loop;", 30, 57)
GUICtrlSetFont ($lbl,9, 400, 1, "Comic Sans MS")
$lbl = GUICtrlCreateLabel ("F10 -- stop the loop;", 30, 72)
GUICtrlSetFont ($lbl,9, 400, 1, "Comic Sans MS")
$lbl = GUICtrlCreateLabel ("version: 0.0.2", 100, 92)
GUICtrlSetFont ($lbl,9, 400, 4, "Comic Sans MS")
GUICtrlSetColor($lbl, 0x009f62)
$lbl = GUICtrlCreateLabel ("author: donghui", 100, 110)
GUICtrlSetFont ($lbl,9, 400, 4, "Comic Sans MS")
GUICtrlSetColor($lbl, 0x009f62)
$lbl = GUICtrlCreateLabel ("*Loop Time:", 5, 170, 180)
GUICtrlSetFont ($lbl,9, 600, 4, "Dotum")
GUICtrlSetColor($lbl, 0x6644aa)
$id_totaltime = GUICtrlCreateInput ($totaltime, 40, 187, 40, 20)
$lbl = GUICtrlCreateLabel ("Min", 92, 190, 40, 20)
GUICtrlSetFont ($lbl,9, 400, 1, "Comic Sans MS")
GUICtrlSetColor($lbl, 0x009f62)
$lbl = GUICtrlCreateLabel ("*Click Type:", 5, 220, 180)
GUICtrlSetFont ($lbl,9, 600, 4, "Dotum")
GUICtrlSetColor($lbl, 0x6644aa)
$id_radio_left = GUICtrlCreateRadio("Left Click", 40, 237)
GUICtrlSetFont ($id_radio_left,9, 400, 1, "Comic Sans MS")
$id_radio_middle = GUICtrlCreateRadio("Middle Click", 40, 257)
GUICtrlSetFont ($id_radio_middle,9, 400, 1, "Comic Sans MS")
$id_radio_right = GUICtrlCreateRadio("Right Click", 40, 277)
GUICtrlSetFont ($id_radio_right,9, 400, 1, "Comic Sans MS")
GUICtrlSetState($id_radio_left, $GUI_CHECKED)
$lbl = GUICtrlCreateLabel ("*Click Delay:", 5, 310, 180)
GUICtrlSetFont ($lbl,9, 600, 4, "Dotum")
GUICtrlSetColor($lbl, 0x6644aa)
$id_delay = GUICtrlCreateInput ($delay, 40, 327, 40, 20)
$lbl = GUICtrlCreateLabel ("Sec", 92, 330, 40, 20)
GUICtrlSetFont ($lbl,9, 400, 1, "Comic Sans MS")
GUICtrlSetColor($lbl, 0x009f62)
$id_check_poweroff = GUICtrlCreateCheckbox("PowerOff PC after loop", 10, 360)
GUICtrlSetFont ($id_check_poweroff,9, 400, 1, "Comic Sans MS")
$btn_save = GUICtrlCreateButton ("SAVE", 20, 420, 50, 20)
GUICtrlSetFont ($btn_save,9, 400, 1, "Corbel")
$btn_quit = GUICtrlCreateButton ("QUIT", 110, 420, 50, 20)
GUICtrlSetFont ($btn_quit,9, 400, 1, "Corbel")
GUISetState ()
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.1
Author: j.d
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Opt('TrayMenuMode', 1)
Opt("GUICloseOnESC", 0)
Global $id_totaltime, $id_delay, $id_tmp_1, $id_tmp_2
Global $totaltime=1, $delay=1, $tmp_1, $tmp_2
Global $id_radio_left, $id_radio_middle, $id_radio_right
Global $id_check_poweroff
Global $btn_save, $btn_quit
Global $loop = 1
Global $mousebutton = "left"
Global $check_poweroff = 0
Global $timer_begin, $timer_dif_total
_Main()
Func _Main()
HotKeySet ("{F10}", "Terminate")
HotKeySet ("{F9}", "GetStart")
CreateGUI()
EndFunc
Func Click()
If $loop == 1 Then
MouseClick($mousebutton)
EndIf
EndFunc
Func Terminate()
$loop = 0
EndFunc ;==>Terminate
Func GetStart()
GUICtrlSetState($btn_save, $GUI_DISABLE)
GUICtrlSetState($btn_quit, $GUI_DISABLE)
$timer_begin = TimerInit()
$loop = 1
AdlibEnable("Click", 1000*$delay)
MouseClick($mousebutton)
While 1 == $loop
$timer_dif_total = TimerDiff($timer_begin)
If (60000 * $totaltime) < $timer_dif_total Then $loop = 0
If $GUI_EVENT_CLOSE == GUIGetMsg() Then Exit
WEnd
If 1 == $check_poweroff Then Shutdown(5)
GUICtrlSetState($btn_save, $GUI_ENABLE)
GUICtrlSetState($btn_quit, $GUI_ENABLE)
EndFunc ;==>GetStart