Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Autoclicker Script


  • Please log in to reply
2 replies to this topic
mi16
  • Members
  • 1 posts
  • Last active: Jan 03 2013 06:55 PM
  • Joined: 03 Jan 2013

Alright, so I'm completely new to any sort of coding, and I wanted to make a script. The said script would do 2 things: click every second, and be suspendable by a hotkey (F9)

 

This is what I have so far:

 

 

F9::suspend

 

 

Loop
{
SetMouseDelay 5000
Click
}
 
Essentially, my question is: What am I doing wrong? Could someone help me out here?
 
Thanks


Arael
  • Members
  • 47 posts
  • Last active: Feb 11 2013 05:51 AM
  • Joined: 03 Dec 2012

Sticky - Post only working scripts in this forum.

But as for your question:

Loop
{
   MouseClick, left
   Sleep 1000
}

F9::Pause
F10::Reload


Temil2008
  • Members
  • 364 posts
  • Last active: Jun 14 2015 09:02 PM
  • Joined: 10 Dec 2012

MI16::

your terminology is slightly off from what you are requesting. Arael provided what you were looking for based on the info you provided, but Suspend in this method does nothing, except for suspends the F9 key. It doesn't stop/pause/ etc the clicking, so you get put into an endless loop of clicking every 1sec, which can be dangerous.

 

I'm including a script which is a little more detailed, but eliminates getting stuck. Since you asked the quest in the games section of the forum, I assume that you are using this for a game, so I tailored it for that. Let us know if there are any questions.

 

- Corrected the hotkey to pause, instead of suspend.

- added hotkey for exit, to get out of it quick if needed

- added windowname variable, so you can specify the name of the game window (clicks will only goto that window while it's active)

- changed the click to a "SendInput" as Sendinput doesn't interfear with current real mouse clicks, moments, etc ..as other click methods do, and can cause issues.

- added comments for all lines, to explain them. (hopefully this is a learning experience for ya) =)

 

WindowName = EnterGameWindowName				; type the game window name here
WinGet, GameID, ID, %WindowName%				; Get ID of window, set to variable called GameID

Loop											; Start loop
{
	while WinActive("ahk_id " GameID)			; check if the GameID window is active, if active continue, if not then go back to previous loop
	{
		SendInput, {click}						; If GameID window is active, send mouse left click
		Sleep 1000								; wait for 1sec
	}
	Sleep, 1000									; if GameID window is NOT active, wait 1sec to recheck
}
 
F9::Pause										; Hotkey F9 to Pause script
F10::ExitApp									; Hotkey F10 to Exit Script entirly

________________________________________________________________

Did a solution provided fix your issue? please mark as "Answered" if so. thank you!