Jump to content

Hey guys, so I'm messing with a very basic program called AutoHotKey to create binds to do certain things on my keybaord. Mostly I've been doing simple/fun stuff to do with games on it, such as a BHOP script for CS:GO (I don't use it in comp lobbies) or auto reload scripts for Rust. 

 

I seem to be getting the hang of most of the terms I find myself using (bear in mind that I have never coded anything in my life, and my profession is a musician, so what may seem simple to you is eye opening to me) but I can't seem to find a way to bind a key to starting the script. I do know how to stop it (e.g: 0 = Exitapp) but using "startscript" is an invalid command

 

Example: 

*space::
Loop
{
GetKeyState,state,space,P
if state = U
break


Send,{space}
Sleep,20
}
return

0::Exitapp
How do I bind a key to start the script?

 

Thanks in advance,

Noob - Dylan.

Link to comment
https://linustechtips.com/topic/876053-how-to-set-ahk-start-script-bind/
Share on other sites

Link to post
Share on other sites

Here's a simple clicker script. I'll edit comments in after I post it. (Edited in)

 

^s::        			//use :: to bind a key. the carrot?(^) is for *Control + s.
loop{				// starts loop
if (BreakLoop = 1)		// mumbo jumbo break-loop stuff
  break 			//^
click 840, 600			//clicks
Sleep 60000			//sleeps
}
^Esc::				//exit loop bind (*Control + Esc)
BreakLoop = 1			//mumbo jumbo break-loop stuff

 It should work unless they've changed it since I last used it.

Fan Comparisons          F@H          PCPartPicker         Analysis of Market Trends (Coming soon? Never? Who knows!)

Designing a mITX case. Working on aluminum prototypes.

Open for intern / part-time. Good at maths, CAD and airflow stuff. Dabbled with Python.

Please fill out this form! It helps a ton! https://linustechtips.com/main/topic/841400-the-poll-to-end-all-polls-poll/

Link to post
Share on other sites

10 minutes ago, Imbellis said:

Here's a simple clicker script. I'll edit comments in after I post it. (Edited in)

 


^s::        			//use :: to bind a key. the carrot?(^) is for Shift + s.
loop{				// starts loop
if (BreakLoop = 1)		// mumbo jumbo break-loop stuff
  break 			//^
click 840, 600			//clicks
Sleep 60000			//sleeps
}
^Esc::				//exit loop bind (Shift + Esc)
BreakLoop = 1			//mumbo jumbo break-loop stuff

 It should work unless they've changed it since I last used it.

So I press Shift+S, it starts the clicker, loops it, stops it, starts it etc... and then when I press Shift+Esc it stops the script?

Link to post
Share on other sites

2 minutes ago, Dylanc431 said:

So I press Shift+S, it starts the clicker, loops it, stops it, starts it etc... and then when I press Shift+Esc it stops the script?

Yep. That's what should happen.

Note: I'm pretty sure it's shift, but it may be Control or Caps Lock. It has been nearly a year since I've used AHK.

 

Edit: Yep. It's control not shift. Sorry for the mix-up.

Edit 2: The timer set in that particular script is very slow, so it may not be noticeable. It's just intended to keep a computer on.

Fan Comparisons          F@H          PCPartPicker         Analysis of Market Trends (Coming soon? Never? Who knows!)

Designing a mITX case. Working on aluminum prototypes.

Open for intern / part-time. Good at maths, CAD and airflow stuff. Dabbled with Python.

Please fill out this form! It helps a ton! https://linustechtips.com/main/topic/841400-the-poll-to-end-all-polls-poll/

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

×