New AHK user, looking for help/advice

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
adelexi
Posts: 1
Joined: 23 Jun 2018, 06:04

New AHK user, looking for help/advice

23 Jun 2018, 06:22

Hello,

I am trying to learn making a simple AHK script but i cant get it to work. as you can see it is a really badly written script and probably a very dumb mistake that is stopping the script from functioning.
I tried making this basic script with help of the manual and other scripts found on the forum. I googled to see if i could find what is stopping my script from working but had no succes with that.
I would really appreciate some help with it to see what i am doing wrong and get a basic understanding of AHK.

Thankyou for taking the time to respond.


Code: Select all


F12::Suspend

SendMode Event

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

;#Persistent

Loop,
	{
		Random, x, 854,945
		Random, y, 670,750
		MouseClick, Left, %RandomX%, %RandomY%
		return
	}

	{
		Random ranSleep, 350, 600
		sleep %ranSleep%
		return
	}

	{
		PressSpaceBar:
		Send, {Space}
		return
	}

	{
		Random ranSleep, 60000, 62000
		sleep %ranSleep%
		return
	}
	
	{
		Random, x, 1142,1408
		Random, y, 340,540
		MouseClick, Left, %RandomX%, %RandomY%
		return
	}
	{
		Random ranSleep, 200, 400
		sleep %ranSleep%
		return
	}
	{
		Send {1}
		return
	}
	{
		Random ranSleep, 250, 350
		sleep %ranSleep%
		return
	}
return

crackint
Posts: 25
Joined: 07 Sep 2017, 18:32

Re: New AHK user, looking for help/advice

23 Jun 2018, 08:28

Just a really fast edit, if in trouble use MsgBox and try and figure out where the problems are.

Is this even what you wanted?

Code: Select all

SendMode Event
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen

F12::Reload ;;;F12 To (Reload)Stop the script.
F11::       ;;;F11 To Start Script
Loop
	{
		Random, x, 854,945
		Random, y, 670,750
		MouseClick, Left, %X%, %Y%
		Random, ranSleep, 350, 600
		sleep %ranSleep%
		Send, {Space}
		Random ranSleep1, 600000, 620000
		sleep %ranSleep1%
		Random, x2, 1142,1408
		Random, y2, 340,540
		MouseClick, Left, %X2%, %Y2%
		Random ranSleep2, 200, 400
		sleep %ranSleep2%
		Send {1}
		Random ranSleep3, 250, 350 
		sleep %ranSleep3%
	}
Return
If you are trying to learn more, maybe this will help alil.

Code: Select all

CoordMode, Mouse, Screen

Random, x, 854,945 ; Puts the number into X
Random, y, 670,750 ; Puts the number into Y
Random, x2, 1142,1408
Random, y2, 340,540
Random, ranSleep, 350, 600 ; Puts the number into ranSleep
Random, ranSleep1, 600, 620
Random, ranSleep2, 200, 400
Random, ranSleep3, 250, 350 

F11::       ;;;F11 To Start Script
Loop
	{
		MouseClick, Left, %X%, %Y% ;Click at x and y
		sleep %ranSleep% ; Sleeps for the amount of time set by ranSleep
		Send, {Space} ; Sends Space
		sleep %ranSleep1%
		MouseClick, Left, %X2%, %Y2%
		sleep %ranSleep2%
		Send {1}
		sleep %ranSleep3%
	}   
Return   
 
F12::Reload ;;;F12 To Stop(Reload) the script. 

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: vanove and 120 guests