Jayden Posted February 26, 2017 Share Posted February 26, 2017 Dear people on autoit forum! My name is Jayden and i am making a script that will automatically click. but my script doesnt work can someone help me? Script: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $looplmb = 1 $looprmb = 1 #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 239, 165, -1, -1) GUISetBkColor(0x0000FF) $Label1 = GUICtrlCreateLabel("Label1", 16, 8, 148, 41) GUICtrlSetBkColor(-1, 0xFFFFFF) $Combo1 = GUICtrlCreateCombo("", 144, 72, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo1, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") $Label2 = GUICtrlCreateLabel("Hotkey LMB:", 16, 72, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button1 = GUICtrlCreateButton("Donate", 176, 8, 51, 33) $Label3 = GUICtrlCreateLabel("Hotkey RMB:", 16, 104, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label4 = GUICtrlCreateLabel("Hotkey Stop:", 16, 136, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Combo2 = GUICtrlCreateCombo("", 144, 104, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Combo3 = GUICtrlCreateCombo("", 144, 136, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo2, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") GUICtrlSetData($Combo3, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Combo1 $ComboRead1 = GUICtrlRead ($Combo1) Case $Combo2 $ComboRead2 = GUICtrlRead ($Combo2) Case $Combo3 $ComboRead3 = GUICtrlRead ($Combo3) EndSwitch WEnd HotKeySet ($ComboRead1, "LMB") HotKeySet ($ComboRead2, "RMB") HotKeySet ($ComboRead3, "Stop") Func LMB () $looplmb = 0 EndFunc Func RMB () $looprmb = 0 EndFunc Func Stop () $looplmb = 1 $looprmb = 1 EndFunc While $looplmb = 0 MouseClick ($MOUSE_CLICK_LEFT) Sleep (100) WEnd While $looprmb = 0 MouseClick ($MOUSE_CLICK_RIGHT) Sleep (100) WEnd Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2017 Developers Share Posted February 26, 2017 14 minutes ago, Jayden said: Dear people on autoit forum! My name is Jayden and i am making a script that will automatically click. but my script doesnt work can someone help me? Don't you think it would help when you also tell us what exactly the script is supposed to do and what isn't working? What are you expecting these"never executed as their are outside the While-Went loop" lines to do:? HotKeySet ($ComboRead1, "LMB") HotKeySet ($ComboRead2, "RMB") HotKeySet ($ComboRead3, "Stop") So... start explaining what you want your script to do. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Jayden Posted February 26, 2017 Author Share Posted February 26, 2017 (edited) 36 minutes ago, Jos said: Don't you think it would help when you also tell us what exactly the script is supposed to do and what isn't working? What are you expecting these"never executed as their are outside the While-Went loop" lines to do:? HotKeySet ($ComboRead1, "LMB") HotKeySet ($ComboRead2, "RMB") HotKeySet ($ComboRead3, "Stop") So... start explaining what you want your script to do. Jos Thanks for your fast reply. I want that if hotkey is pressed that there is going to be a loop that it wil click automatic and if hotkey stop is pressed the loop will stop . and it didnt click thats what happend Edited February 26, 2017 by Jayden forgot smth Link to comment Share on other sites More sharing options...
water Posted February 26, 2017 Share Posted February 26, 2017 Did you have a look at the help file? The examples for HotKeySet exactly explain how to start/stop a function using a Hotkey. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2017 Developers Share Posted February 26, 2017 As stated already: the HotKey's are never set with those 3 lines. Change that so they are set when pressing the combo control where you do the GuiCtrlRead(). Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Jayden Posted February 26, 2017 Author Share Posted February 26, 2017 (edited) 2 hours ago, Jos said: As stated already: the HotKey's are never set with those 3 lines. Change that so they are set when pressing the combo control where you do the GuiCtrlRead(). Jos Thanks but it still didnt work. or do I need to add a button "Save" and then if it is pressed that the combos are read and hotkeys are set? Edited February 26, 2017 by Jayden Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2017 Developers Share Posted February 26, 2017 (edited) Sweet ... guess you made an error then Jos ps:I assume you didn't want any real answer as you didn't share any useful information like the current script. Edited February 26, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Jayden Posted February 26, 2017 Author Share Posted February 26, 2017 (edited) expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $looplmb = 1 $looprmb = 1 #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 239, 165, -1, -1) GUISetBkColor(0x0000FF) $Label1 = GUICtrlCreateLabel("Label1", 16, 8, 148, 41) GUICtrlSetBkColor(-1, 0xFFFFFF) $Combo1 = GUICtrlCreateCombo("", 144, 72, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo1, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") $Label2 = GUICtrlCreateLabel("Hotkey LMB:", 16, 72, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button1 = GUICtrlCreateButton("Donate", 176, 8, 51, 33) $Label3 = GUICtrlCreateLabel("Hotkey RMB:", 16, 104, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label4 = GUICtrlCreateLabel("Hotkey Stop:", 16, 136, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Combo2 = GUICtrlCreateCombo("", 144, 104, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Combo3 = GUICtrlCreateCombo("", 144, 136, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo2, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") GUICtrlSetData($Combo3, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Combo1 $ComboRead1 = GUICtrlRead ($Combo1) HotKeySet ($ComboRead1, "LMB") Case $Combo2 $ComboRead2 = GUICtrlRead ($Combo2) HotKeySet ($ComboRead2, "RMB") Case $Combo3 $ComboRead3 = GUICtrlRead ($Combo3) HotKeySet ($ComboRead3, "Stop") EndSwitch WEnd Func LMB () $looplmb = 0 EndFunc Func RMB () $looprmb = 0 EndFunc Func Stop () $looplmb = 1 $looprmb = 1 EndFunc While $looplmb = 0 MouseClick ($MOUSE_CLICK_LEFT) Sleep (100) WEnd While $looprmb = 0 MouseClick ($MOUSE_CLICK_RIGHT) Sleep (100) WEnd you reply fast i was just copying it but this is current ^^ Edited February 26, 2017 by Jayden Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2017 Developers Share Posted February 26, 2017 Works fine for me. I added an ConsoleWrite() to the 3 Funcs for testing; started the script, select an F? for each task and hit those 3 F? keys. They all showed the proper ConsoleWrite() output, so it is working as designed. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Jayden Posted February 26, 2017 Author Share Posted February 26, 2017 (edited) 1 minute ago, Jos said: Works fine for me. I added an ConsoleWrite() to the 3 Funcs for testing; started the script, select an F? for each task and hit those 3 F? keys. They all showed the proper ConsoleWrite() output, so it is working as designed. Jos ^what is the consolewrite thing? and did it also click? Edited February 26, 2017 by Jayden Link to comment Share on other sites More sharing options...
Jayden Posted February 26, 2017 Author Share Posted February 26, 2017 because the only thing that doesnt work is that it is not clicking or it didnt catch the hotkey Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2017 Developers Share Posted February 26, 2017 Example: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $looplmb = 1 $looprmb = 1 #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 239, 165, -1, -1) GUISetBkColor(0x0000FF) $Label1 = GUICtrlCreateLabel("Label1", 16, 8, 148, 41) GUICtrlSetBkColor(-1, 0xFFFFFF) $Combo1 = GUICtrlCreateCombo("", 144, 72, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo1, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") $Label2 = GUICtrlCreateLabel("Hotkey LMB:", 16, 72, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button1 = GUICtrlCreateButton("Donate", 176, 8, 51, 33) $Label3 = GUICtrlCreateLabel("Hotkey RMB:", 16, 104, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label4 = GUICtrlCreateLabel("Hotkey Stop:", 16, 136, 116, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Combo2 = GUICtrlCreateCombo("", 144, 104, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Combo3 = GUICtrlCreateCombo("", 144, 136, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo2, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") GUICtrlSetData($Combo3, "{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}", "Choose") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Combo1 $ComboRead1 = GUICtrlRead ($Combo1) HotKeySet ($ComboRead1, "LMB") Case $Combo2 $ComboRead2 = GUICtrlRead ($Combo2) HotKeySet ($ComboRead2, "RMB") Case $Combo3 $ComboRead3 = GUICtrlRead ($Combo3) HotKeySet ($ComboRead3, "Stop") EndSwitch WEnd Func LMB () $looplmb = 0 ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $looplmb = ' & $looplmb & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndFunc Func RMB () $looprmb = 0 ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $looprmb = ' & $looprmb & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndFunc Func Stop () $looplmb = 1 $looprmb = 1 ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $looprmb = ' & $looprmb & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndFunc What are those 2 While-Wend loops supposed to do at the end of the Script? You do realise that portion of the script is never run ...right? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Jayden Posted February 26, 2017 Author Share Posted February 26, 2017 these are the clicking part if looplmb = 0 it will click and if it is 1 it wont i read it somewhere but is that the part that doesnt work? Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2017 Developers Share Posted February 26, 2017 (edited) Understand and that should be pretty clear that is NEVER ran as it is outside of the initial endless loop. So, what is this script really supposed to do? Jos Edited February 26, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Jayden Posted February 26, 2017 Author Share Posted February 26, 2017 (edited) it needs to click every 100 ms and if the stop key is clicked it needs to be stopped. Edited February 26, 2017 by Jayden Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2017 Developers Share Posted February 26, 2017 Ah ... that sounds very much like a clicker for a game? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Jayden Posted February 26, 2017 Author Share Posted February 26, 2017 Im not going to use it for that its more for a practise I dont know what to make in autoit and I want to beat my friends with clicking we always bet who can click the best. (so little bit a game) Link to comment Share on other sites More sharing options...
Developers Jos Posted February 26, 2017 Developers Share Posted February 26, 2017 Yea right ... let me point you to the Forum rules so we are sure you know them and I will close this topic as you have been informed on the issue you have. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts