dtmajors Posted June 5, 2018 Share Posted June 5, 2018 Hi, After much reading and trying to figure it out myself i cannot. How can i make this script only left click while holding a hotkey? Thanks in advance Click() ;________________________________________________ ;________________________________________________ ;________________________________________________ Func Click() While 1 Local $coord = PixelSearch(926,475,987,535,0xff2220,30) If Not @error Then MouseClick("Left") EndIf WEnd EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ While 1 $counter +=1 WEnd ;________________________________________________ ;________________________________________________ ;________________________________________________ Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ;ToolTip('Script is "Paused"',0,0, $counter, 1) WEnd ToolTip("") EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ Func Terminate() Exit 0 EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ Link to comment Share on other sites More sharing options...
Somerset Posted June 5, 2018 Share Posted June 5, 2018 HotKeySet Iif this is about a bot, you will find this thread locked. Link to comment Share on other sites More sharing options...
dtmajors Posted June 5, 2018 Author Share Posted June 5, 2018 1 hour ago, Somerset said: HotKeySet Iif this is about a bot, you will find this thread locked. I thought hotkeyset was if i wasn't holding the key down? I think its If _IsPressed But i don't know how to properly implement it into this script, do you think you can help? Not for a bot btw Link to comment Share on other sites More sharing options...
dtmajors Posted June 5, 2018 Author Share Posted June 5, 2018 I tried and the hotkey still isn't working HotKeySet("{Z}", "Start") HotKeySet("{ESC}", "_Exit") Click() ;________________________________________________ ;________________________________________________ ;________________________________________________ Func Click() While 1 Local $coord = PixelSearch(926,475,987,535,0xff2220,30) If Not @error Then MouseClick("Left") EndIf WEnd EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ While 1 $counter +=1 WEnd ;________________________________________________ ;________________________________________________ ;________________________________________________ Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ;ToolTip('Script is "Paused"',0,0, $counter, 1) WEnd ToolTip("") EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ Func Terminate() Exit 0 EndFunc ;________________________________________________ ;________________________________________________ ;________________________________________________ Link to comment Share on other sites More sharing options...
water Posted June 5, 2018 Share Posted June 5, 2018 Welcome to AutoIt and the forum! First of all: Which program do you try to automate? Somerset is quite right about game automation. Make sure you read and understood the forum rules! Second: Where are functions Start and _Exit in your script? Third: Please use the AutoIt code tags in the editor (button "<>") when posting code. makes it much more readable 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...
dtmajors Posted June 5, 2018 Author Share Posted June 5, 2018 It's work related on a stock market app i use I have deuteranopia a very rare form of color blindness. Link to comment Share on other sites More sharing options...
dtmajors Posted June 5, 2018 Author Share Posted June 5, 2018 I was searching for pixelsearch and this script was the first one that popped up. I'm sorry I'm very ignorant when it comes to these things Link to comment Share on other sites More sharing options...
water Posted June 5, 2018 Share Posted June 5, 2018 How often do you want to click when the wanted color is found? Doing it in a loop without a Sleep statement doesn't make much sense. 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...
dtmajors Posted June 5, 2018 Author Share Posted June 5, 2018 1 hour ago, water said: How often do you want to click when the wanted color is found? Doing it in a loop without a Sleep statement doesn't make much sense. Every couple seconds is fine, yea i understand i don't want it spamming my program Link to comment Share on other sites More sharing options...
water Posted June 5, 2018 Share Posted June 5, 2018 Something like this. It waits 5 seconds before clicking again. Global $Paused = False HotKeySet("{Z}", "TogglePause") HotKeySet("{ESC}", "_Exit") While 1 If Not $Paused Then ToolTip("Pixelsearch is running", 0, 0, "", 1) PixelSearch(926, 475, 987, 535, 0xff2220, 30) If Not @error Then MouseClick("Left") Sleep(5000) EndIf Else ToolTip("Script is Paused", 0, 0, "", 1) EndIf Sleep(100) WEnd Func TogglePause() $Paused = Not $Paused EndFunc ;==>TogglePause Func _Exit() Exit 0 EndFunc ;==>_Exit 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...
dtmajors Posted June 5, 2018 Author Share Posted June 5, 2018 5 hours ago, water said: Something like this. It waits 5 seconds before clicking again. Global $Paused = False HotKeySet("{Z}", "TogglePause") HotKeySet("{ESC}", "_Exit") While 1 If Not $Paused Then ToolTip("Pixelsearch is running", 0, 0, "", 1) PixelSearch(926, 475, 987, 535, 0xff2220, 30) If Not @error Then MouseClick("Left") Sleep(5000) EndIf Else ToolTip("Script is Paused", 0, 0, "", 1) EndIf Sleep(100) WEnd Func TogglePause() $Paused = Not $Paused EndFunc ;==>TogglePause Func _Exit() Exit 0 EndFunc ;==>_Exit Thank you so much, Link to comment Share on other sites More sharing options...
water Posted June 5, 2018 Share Posted June 5, 2018 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...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now