คิดว่าหลายท่านคงอยากทำโปรแกรม แบบ GUI ผมเลยเอามาให้ศึกษากันครับ
GUICreate("Dark Ai Bot By DarkWarrior", 280, 209, 406, 176)
GUICtrlCreateLabel("ชื่อโปรแกรม :", 8, 16, 69, 17);ใส่ชื่อเกม หรือ โปรแกรมที่ต้องการ Send Key
$proname = GUICtrlCreateInput("", 83, 13, 129, 21)
$Checkbox1 = GUICtrlCreateCheckbox("", 24, 56, 20, 17)
GUICtrlCreateLabel("Send Key :", 50, 58, 56, 17)
$send1 = GUICtrlCreateInput("1", 120, 55, 33, 21)
GUICtrlCreateLabel("Delay :", 171, 58, 37, 17)
$time1 = GUICtrlCreateInput("1000", 208, 56, 44, 21)
$Checkbox2 = GUICtrlCreateCheckbox("", 24, 86, 20, 17)
GUICtrlCreateLabel("Send Key :", 50, 88, 56, 17)
$send2 = GUICtrlCreateInput("2", 120, 85, 33, 21)
GUICtrlCreateLabel("Delay :", 171, 88, 37, 17)
$time2 = GUICtrlCreateInput("1000", 208, 86, 44, 21)
$Checkbox3 = GUICtrlCreateCheckbox("", 23, 117, 20, 17)
GUICtrlCreateLabel("Send Key :", 49, 119, 56, 17)
$send3 = GUICtrlCreateInput("3", 119, 116, 33, 21)
GUICtrlCreateLabel("Delay :", 170, 119, 37, 17)
$time3 = GUICtrlCreateInput("1000", 207, 117, 44, 21)
$Checkbox4 = GUICtrlCreateCheckbox("", 23, 147, 20, 17)
GUICtrlCreateLabel("Send Key :", 49, 149, 56, 17)
$send4 = GUICtrlCreateInput("4", 119, 146, 33, 21)
GUICtrlCreateLabel("Delay :", 170, 149, 37, 17)
$time4 = GUICtrlCreateInput("1000", 207, 147, 44, 21)
GUICtrlCreateLabel("Run and Stop = (PAUSE) Key", 15, 179, 145, 17)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateLabel("Close = (ESC Key)", 170, 179, 90, 17)
GUICtrlSetColor(-1, 0xFF0000)
GUISetState()
HotKeySet("{ESC}","_exit")
HotKeySet("{PAUSE}","_TogglePause")
Global $SendKey1 = 0
Global $SendKey2 = 0
Global $SendKey3 = 0
Global $SendKey4 = 0
Global $Paused
_TogglePause()
Func _TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc
Func _a()
If GUICtrlRead($Checkbox1) = 1 Then
$SendKey1 = 1
Else
$SendKey1 = 0
EndIf
EndFunc
Func _b()
If GUICtrlRead($Checkbox2) = 1 Then
$SendKey2 = 1
Else
$SendKey2 = 0
EndIf
EndFunc
Func _c()
If GUICtrlRead($Checkbox3) = 1 Then
$SendKey3 = 1
Else
$SendKey3 = 0
EndIf
EndFunc
Func _d()
If GUICtrlRead($Checkbox4) = 1 Then
$SendKey4 = 1
Else
$SendKey4 = 0
EndIf
EndFunc
Func _Run()
$_proname = GUICtrlRead($proname)
WinActivate($_proname)
Return
EndFunc
Func _Main()
_a()
_b()
_c()
_d()
EndFunc
_Run()
_Main()
ToolTip('Script is "Run"',0,0)
While True
If $SendKey1 = 1 Then
_send1()
Else
EndIf
If $SendKey2 = 1 Then
_send2()
Else
EndIf
If $SendKey3 = 1 Then
_send3()
Else
EndIf
If $SendKey4 = 1 Then
_send4()
Else
EndIf
_Main()
_Run()
WEnd
Func _exit()
Exit 0
EndFunc
Func _send1()
$_send1 = GUICtrlRead($send1)
$_time1 = GUICtrlRead($time1)
Send($_send1)
Sleep($_time1)
EndFunc
Func _send2()
$_send2 = GUICtrlRead($send2)
$_time2 = GUICtrlRead($time2)
Send($_send2)
Sleep($_time2)
EndFunc
Func _send3()
$_send3 = GUICtrlRead($send3)
$_time3 = GUICtrlRead($time3)
Send($_send3)
Sleep($_time3)
EndFunc
Func _send4()
$_send4 = GUICtrlRead($send4)
$_time4 = GUICtrlRead($time4)
Send($_send4)
Sleep($_time4)
End
GUICreate("Dark Ai Bot By DarkWarrior", 280, 209, 406, 176)
GUICtrlCreateLabel("ชื่อโปรแกรม :", 8, 16, 69, 17);ใส่ชื่อเกม หรือ โปรแกรมที่ต้องการ Send Key
$proname = GUICtrlCreateInput("", 83, 13, 129, 21)
$Checkbox1 = GUICtrlCreateCheckbox("", 24, 56, 20, 17)
GUICtrlCreateLabel("Send Key :", 50, 58, 56, 17)
$send1 = GUICtrlCreateInput("1", 120, 55, 33, 21)
GUICtrlCreateLabel("Delay :", 171, 58, 37, 17)
$time1 = GUICtrlCreateInput("1000", 208, 56, 44, 21)
$Checkbox2 = GUICtrlCreateCheckbox("", 24, 86, 20, 17)
GUICtrlCreateLabel("Send Key :", 50, 88, 56, 17)
$send2 = GUICtrlCreateInput("2", 120, 85, 33, 21)
GUICtrlCreateLabel("Delay :", 171, 88, 37, 17)
$time2 = GUICtrlCreateInput("1000", 208, 86, 44, 21)
$Checkbox3 = GUICtrlCreateCheckbox("", 23, 117, 20, 17)
GUICtrlCreateLabel("Send Key :", 49, 119, 56, 17)
$send3 = GUICtrlCreateInput("3", 119, 116, 33, 21)
GUICtrlCreateLabel("Delay :", 170, 119, 37, 17)
$time3 = GUICtrlCreateInput("1000", 207, 117, 44, 21)
$Checkbox4 = GUICtrlCreateCheckbox("", 23, 147, 20, 17)
GUICtrlCreateLabel("Send Key :", 49, 149, 56, 17)
$send4 = GUICtrlCreateInput("4", 119, 146, 33, 21)
GUICtrlCreateLabel("Delay :", 170, 149, 37, 17)
$time4 = GUICtrlCreateInput("1000", 207, 147, 44, 21)
GUICtrlCreateLabel("Run and Stop = (PAUSE) Key", 15, 179, 145, 17)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateLabel("Close = (ESC Key)", 170, 179, 90, 17)
GUICtrlSetColor(-1, 0xFF0000)
GUISetState()
HotKeySet("{ESC}","_exit")
HotKeySet("{PAUSE}","_TogglePause")
Global $SendKey1 = 0
Global $SendKey2 = 0
Global $SendKey3 = 0
Global $SendKey4 = 0
Global $Paused
_TogglePause()
Func _TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc
Func _a()
If GUICtrlRead($Checkbox1) = 1 Then
$SendKey1 = 1
Else
$SendKey1 = 0
EndIf
EndFunc
Func _b()
If GUICtrlRead($Checkbox2) = 1 Then
$SendKey2 = 1
Else
$SendKey2 = 0
EndIf
EndFunc
Func _c()
If GUICtrlRead($Checkbox3) = 1 Then
$SendKey3 = 1
Else
$SendKey3 = 0
EndIf
EndFunc
Func _d()
If GUICtrlRead($Checkbox4) = 1 Then
$SendKey4 = 1
Else
$SendKey4 = 0
EndIf
EndFunc
Func _Run()
$_proname = GUICtrlRead($proname)
WinActivate($_proname)
Return
EndFunc
Func _Main()
_a()
_b()
_c()
_d()
EndFunc
_Run()
_Main()
ToolTip('Script is "Run"',0,0)
While True
If $SendKey1 = 1 Then
_send1()
Else
EndIf
If $SendKey2 = 1 Then
_send2()
Else
EndIf
If $SendKey3 = 1 Then
_send3()
Else
EndIf
If $SendKey4 = 1 Then
_send4()
Else
EndIf
_Main()
_Run()
WEnd
Func _exit()
Exit 0
EndFunc
Func _send1()
$_send1 = GUICtrlRead($send1)
$_time1 = GUICtrlRead($time1)
Send($_send1)
Sleep($_time1)
EndFunc
Func _send2()
$_send2 = GUICtrlRead($send2)
$_time2 = GUICtrlRead($time2)
Send($_send2)
Sleep($_time2)
EndFunc
Func _send3()
$_send3 = GUICtrlRead($send3)
$_time3 = GUICtrlRead($time3)
Send($_send3)
Sleep($_time3)
EndFunc
Func _send4()
$_send4 = GUICtrlRead($send4)
$_time4 = GUICtrlRead($time4)
Send($_send4)
Sleep($_time4)
End