Sign in to follow this  
Followers 0
pikablue

Auto Click Bot

2 posts in this topic

Sorry guys, it's been a while since I used autoit.

I'm making a bot which will keep pressing left mouse button with a hotkey. And it will turn off with another button.

This is what I came up with:

HotKeySet("{pause}", "Click")

Hotkeyset("{end}", "End")

$i = 0

Func Click()

$i = 1

EndFunc

While $i = 1

mouseclick("left")

WEnd

Func End()

Exit

EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Feel free to use my Autoklikker code:

To start Hit Numpadsub, to stop Hit Pause/break button on your keyboard. To exit right click on tray icon & hit exit.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=kliker.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <Misc.au3>
$g_szVersion = "autocliker_advanced"
If WinExists($g_szVersion) Then Exit ; Exits without notification if already running
AutoItWinSetTitle($g_szVersion)
Opt("TrayMenuMode",1)   ; Default tray menu items (Script Paused/Exit) will not be shown

Hotkeyset("{NUMPADSUB}", "buttonhit")
Hotkeyset("!2", "maximize")
HotKeySet("!^a", "MyExit")


;~ FileDelete("C:\myfile.ini")
;~ IniWrite("C:\myfile.ini", "cliker_info", "speed", "1000")
;~ IniWrite("C:\myfile.ini", "cliker_info", "Right_Click", "True")
;~ IniWrite("C:\myfile.ini", "cliker_info", "Left_Click", "FALSE")

$iniread = IniReadSection("C:\myfile.ini", "cliker_info")
$iniread_speed = IniRead("C:\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
$iniread_rightklick = IniRead("C:\myfile.ini", "cliker_info", "Right_Click", "Not_Found")
$iniread_leftklick = IniRead("C:\myfile.ini", "cliker_info", "Left_Click", "Not_Found")
$iniread_Send_Raw_key = IniRead("C:\myfile.ini", "Keyhit_Shortcuts","Send_Raw_key", "")
$iniread_Send_key_lette_etc = IniRead("C:\myfile.ini", "Keyhit_Shortcuts","Key2","")
        $iniread_Send_Raw_key_state = IniRead("C:\myfile.ini", "Keyhit_Shortcuts","Send_Raw_key_state", "")
        $iniread_Send_key_lette_etc_state = IniRead("C:\myfile.ini", "Keyhit_Shortcuts","Send_key_lette_etc_state", "")
        $iniread_left_klick_state = IniRead("C:\myfile.ini", "Keyhit_Shortcuts","left_klick_state", "")
        $iniread_right_klick_state =  IniRead("C:\myfile.ini", "Keyhit_Shortcuts","right_klick_state", "")

;~ Autocliker GUI
;~ ---------------------------------------------------------------------------------------------------------
$cliker_opt_window = GUICreate("Autocliker Advanced", 300, 205)
GUICtrlCreateLabel ("Clickspeed, 1000 = 1 sec:",5,11)       ;Label Clickspeed
GUICtrlCreateLabel ("Start = 1/2",135,40)                   ;Label START (left, top , width , height )
GUICtrlCreateLabel ("Stop = Hold PAUSE",135,60)             ;Label STOP
GUICtrlCreateLabel ("Exit = Esc",135,80)                ;Label Exit

$Input_speed = GUICtrlCreateInput($iniread_speed, 135, 10, 80, 20) ;Input speed
$Input_Send_Raw_key = GUICtrlCreateInput($iniread_Send_Raw_key, 5, 105, 100, 20) ; Input_Keyset 1
$Input_Send_key_letter_etc = GUICtrlCreateInput($iniread_Send_key_lette_etc, 5, 135, 100, 20) ; Input_Keyset 1
                                                              
$Checkbox_send_raw_key = GUICtrlCreateCheckbox ("Send RAW 1. Key:", 110, 104 )
If $iniread_Send_Raw_key_state = "True" Then
    GuiCtrlSetState(-1, $GUI_CHECKED)
Else
    GuiCtrlSetState(-1, $GUI_UNCHECKED)
EndIf
$Checkbox_Send_key_lette_etc = GUICtrlCreateCheckbox ("Send keys letters words etc:", 110, 134)
If $iniread_Send_key_lette_etc_state = "True" Then
    GuiCtrlSetState(-1, $GUI_CHECKED)
Else
    GuiCtrlSetState(-1, $GUI_UNCHECKED)
EndIf                                                                                        
;Checking ini file to see what values are true
$Right_Click_checkbox = GUICtrlCreateCheckbox ("Right_click", 10, 35)
if $iniread_rightklick = "True" Then
    GuiCtrlSetState(-1, $GUI_CHECKED)
Else
    GuiCtrlSetState(-1, $GUI_UNCHECKED)
EndIf
$Left_Click_checkbox = GUICtrlCreateCheckbox ("Left_click", 10, 65)
if $iniread_leftklick = "True" Then      ; if Left_Click = True
    GuiCtrlSetState(-1, $GUI_CHECKED)
Else
    GuiCtrlSetState(-1, $GUI_UNCHECKED)
EndIf

$save_Cliker_info_button = GUICtrlCreateButton("OK", 120, 170, 60, 23)    ;Button OK (left, top , width , height )
GUISetState(@SW_SHOW)
 
;~ Tray MENU
;~ ---------------------------------------------------------------------------------------------------------
$Maximize     = TrayCreateItem("Maximize")
TrayCreateItem("")
$exititem       = TrayCreateItem("Exit")
TraySetState()

While 1
    $msg = GUIGetMsg()
    $msg1 = TrayGetMsg()
 Select
    Case $msg = $GUI_EVENT_CLOSE or  $msg1 = $exititem
        Exit
    case $msg = $GUI_EVENT_MINIMIZE
        GUISetState(@SW_HIDE,$cliker_opt_window)
    Case $msg1 = $Maximize
        GUISetState(@SW_SHOW,$cliker_opt_window)
        GUISetState(@SW_restore,$cliker_opt_window)
    Case $msg1 = $exititem
        Exit
    Case $msg = $GUI_EVENT_CLOSE
        $Hwnd = WinGetHandle('')
            
        If $Hwnd = $cliker_opt_window Then      ; If closed search options window
        GUISetState(@SW_HIDE,$cliker_opt_window)
        ExitLoop
    EndIf

;~  see if checkboxes are checkked & do someting if press save
    case $msg = $save_Cliker_info_button
        IniWrite("C:\myfile.ini", "KeyHitSpeed", "speed", GUICtrlRead($Input_speed))
        IniWrite("C:\myfile.ini", "Keyhit_Shortcuts","Send_Raw_key",GUICtrlRead($Input_Send_Raw_key))
        IniWrite("C:\myfile.ini", "Keyhit_Shortcuts","Key2",GUICtrlRead($Input_Send_key_letter_etc))
        GUISetState(@SW_HIDE,$cliker_opt_window)
        If GUICtrlRead($Right_Click_checkbox) = $GUI_CHECKED Then
            IniWrite("C:\myfile.ini", "cliker_info", "Right_Click", "True") 
        ElseIf GUICtrlRead($Right_Click_checkbox) = $GUI_UNCHECKED Then
            IniWrite("C:\myfile.ini", "cliker_info", "Right_Click", "FALSE")
        EndIf   
        If GUICtrlRead($Left_Click_checkbox) = $GUI_CHECKED Then
            IniWrite("C:\myfile.ini", "cliker_info", "Left_Click", "True")  
        ElseIf GUICtrlRead($Left_Click_checkbox) = $GUI_UNCHECKED Then
            IniWrite("C:\myfile.ini", "cliker_info", "Left_Click", "FALSE")
        EndIf
        If GUICtrlRead($Left_Click_checkbox) = $GUI_CHECKED and GUICtrlRead($Right_Click_checkbox) = $GUI_CHECKED  Then
            IniWrite("C:\myfile.ini", "cliker_info", "Right_Click", "True") 
            IniWrite("C:\myfile.ini", "cliker_info", "Left_Click", "True")      
        ElseIf GUICtrlRead($Left_Click_checkbox) = $GUI_UNCHECKED and GUICtrlRead($Right_Click_checkbox) = $GUI_UNCHECKED  Then
            IniWrite("C:\myfile.ini", "cliker_info", "Right_Click", "FALSE")    
            IniWrite("C:\myfile.ini", "cliker_info", "Left_Click", "FALSE") 
        EndIf
        If GUICtrlRead($Checkbox_send_raw_key) = $GUI_CHECKED Then
            IniWrite("C:\myfile.ini", "Keyhit_Shortcuts","Send_Raw_key_state", "True")
            IniWrite("C:\myfile.ini", "Keyhit_Shortcuts","Send_key_lette_etc_state", "FALSE")
        ElseIf GUICtrlRead($Checkbox_Send_key_lette_etc) = $GUI_CHECKED Then
            IniWrite("C:\myfile.ini", "Keyhit_Shortcuts","Send_key_lette_etc_state", "True")
            IniWrite("C:\myfile.ini", "Keyhit_Shortcuts","Send_Raw_key_state", "FALSE")
        EndIf
        If GUICtrlRead($Checkbox_send_raw_key) = $GUI_UNCHECKED and GUICtrlRead($Checkbox_send_raw_key) = $GUI_UNCHECKED  Then
            IniWrite("C:\myfile.ini", "Keyhit_Shortcuts","Send_Raw_key_state", "FALSE")
        EndIf
        If GUICtrlRead($Checkbox_Send_key_lette_etc) = $GUI_UNCHECKED and GUICtrlRead($Checkbox_Send_key_lette_etc) = $GUI_UNCHECKED  Then
            IniWrite("C:\myfile.ini", "Keyhit_Shortcuts","Send_key_lette_etc_state", "FALSE")   
        EndIf       
        
        
    Case $msg = $Checkbox_send_raw_key And BitAND(GUICtrlRead($Checkbox_send_raw_key), $GUI_CHECKED) = $GUI_CHECKED
    GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
    GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_DISABLE)
    
    GuiCtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
    GuiCtrlSetState($Right_Click_checkbox, $GUI_DISABLE)
    
    GuiCtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
    GuiCtrlSetState($Left_Click_checkbox, $GUI_DISABLE)
    
    Case $msg = $Checkbox_Send_key_lette_etc And BitAND(GUICtrlRead($Checkbox_Send_key_lette_etc), $GUI_CHECKED) = $GUI_CHECKED
    GuiCtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
    GuiCtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
    
    GuiCtrlSetState($Right_Click_checkbox, $GUI_UNCHECKED)
    GuiCtrlSetState($Right_Click_checkbox, $GUI_DISABLE)
    
    GuiCtrlSetState($Left_Click_checkbox, $GUI_UNCHECKED)
    GuiCtrlSetState($Left_Click_checkbox, $GUI_DISABLE)
    
    Case $msg = $Checkbox_send_raw_key And BitAND(GUICtrlRead($Checkbox_send_raw_key), $GUI_UNCHECKED) = $GUI_UNCHECKED
    GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_ENABLE)
    GuiCtrlSetState($Right_Click_checkbox, $GUI_ENABLE)
    GuiCtrlSetState($Left_Click_checkbox, $GUI_ENABLE)
    
    Case $msg = $Checkbox_Send_key_lette_etc And BitAND(GUICtrlRead($Checkbox_Send_key_lette_etc), $GUI_UNCHECKED) = $GUI_UNCHECKED
    GuiCtrlSetState($Checkbox_send_raw_key, $GUI_ENABLE)
    GuiCtrlSetState($Right_Click_checkbox, $GUI_ENABLE)
    GuiCtrlSetState($Left_Click_checkbox, $GUI_ENABLE)

    Case $msg = $Left_Click_checkbox And BitAND(GUICtrlRead($Left_Click_checkbox), $GUI_CHECKED) = $GUI_CHECKED
        GuiCtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
        GuiCtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
        GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
        GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_DISABLE)
    
    Case $msg = $Right_Click_checkbox And BitAND(GUICtrlRead($Right_Click_checkbox), $GUI_CHECKED) = $GUI_CHECKED
        GuiCtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
        GuiCtrlSetState($Checkbox_send_raw_key, $GUI_DISABLE)
        GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
        GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_DISABLE)
    
    Case $msg = $Left_Click_checkbox And BitAND(GUICtrlRead($Left_Click_checkbox), $GUI_UNCHECKED) = $GUI_UNCHECKED 
        GuiCtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
        GuiCtrlSetState($Checkbox_send_raw_key, $GUI_ENABLE)
        GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
        GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_ENABLE)
        
    Case $msg = $Right_Click_checkbox And BitAND(GUICtrlRead($Left_Click_checkbox), $GUI_UNCHECKED) = $GUI_UNCHECKED 
        GuiCtrlSetState($Checkbox_send_raw_key, $GUI_UNCHECKED)
        GuiCtrlSetState($Checkbox_send_raw_key, $GUI_ENABLE)
        GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_UNCHECKED)
        GuiCtrlSetState($Checkbox_Send_key_lette_etc, $GUI_ENABLE)  
    
 EndSelect
WEnd

;~ --------------------------------------------------------------------------------------------------------------------------
Func buttonhit()

If GUICtrlRead($Left_Click_checkbox) = $GUI_CHECKED and GUICtrlRead($Right_Click_checkbox) = $GUI_CHECKED Then
    $iniread_speed = IniRead("C:\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
    while 1
        If Not _Sleep_IsPressed($iniread_speed, '13') Then ExitLoop     
        MouseClick("Right")
        Opt("MouseClickDelay", GUICtrlRead($Input_speed))
    If Not _Sleep_IsPressed($iniread_speed, '13') Then ExitLoop
        MouseClick("Left")
        Opt("MouseClickDelay", GUICtrlRead($Input_speed))
    WEnd
Beep(8000, 100)
    ElseIf GUICtrlRead($Right_Click_checkbox) = $GUI_CHECKED Then ; If Checkbox is selected 
        $iniread_speed = IniRead("C:\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
    while 1
        If Not _Sleep_IsPressed($Input_speed, '13') Then ExitLoop
        MouseClick("Right")
        Opt("MouseClickDelay", GUICtrlRead($Input_speed))
    WEnd
Beep(8000, 100)     
    ElseIf GUICtrlRead($Left_Click_checkbox) = $GUI_CHECKED Then ; If Checkbox is selected 
        $iniread_speed = IniRead("C:\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
    while 1
        If Not _Sleep_IsPressed($iniread_speed, '13') Then ExitLoop
        MouseClick("Left")
        Opt("MouseClickDelay", GUICtrlRead($Input_speed))
    WEnd        
Beep(8000, 100)
;~ --------------------------------------------------------------------------------------------------------------------------
    ElseIf GUICtrlRead($Checkbox_send_raw_key) = $GUI_CHECKED Then
    $iniread_speed = IniRead("C:\myfile.ini", "KeyHitSpeed", "speed","Not_Found")
while 1
    If Not _Sleep_IsPressed($iniread_speed, '13') Then ExitLoop
        Send('{' & GUICtrlRead($Input_Send_Raw_key) & '}')
WEnd
Beep(8000, 100)
;~ --------------------------------------------------------------------------------------------------------------------------
    ElseIf GUICtrlRead($Checkbox_Send_key_lette_etc) = $GUI_CHECKED Then
    $iniread_speed = IniRead("C:\myfile.ini", "KeyHitSpeed", "speed", "Not_Found")
while 1
    If Not _Sleep_IsPressed($iniread_speed, '13') Then ExitLoop
    Send(GUICtrlRead($Input_Send_key_letter_etc))
WEnd
Beep(8000, 100)
;~ --------------------------------------------------------------------------------------------------------------------------
EndIf
EndFunc
;~ --------------------------------------------------------------------------------------------------------------------------

Func _Sleep_IsPressed($nSleep, $sIsPressed, $iDefault = 10)
    Local $iAdd, $nExitLoop = Int($nSleep) / Int($iDefault)
    Do
        Sleep($iDefault)
        $iAdd += 1
    Until $iAdd >= $nExitLoop Or _IsPressed($sIsPressed)
    If _IsPressed($sIsPressed) Then Return SetError(1, 0, 0)
    Return 1
EndFunc
  
;~ MAXIMIZE
Func maximize()
GUISetState(@SW_SHOW,$cliker_opt_window)
GUISetState(@SW_restore,$cliker_opt_window)
EndFunc

Func MyExit()
    Exit
EndFunc
Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0