Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

How to toggle script on/off with a key?


  • Please log in to reply
21 replies to this topic
PureIce
  • Guests
  • Last active:
  • Joined: --
Assume I want f12 to toggle on/off of my script, how would I do that?

x79animal
  • Members
  • 1021 posts
  • Last active: May 14 2013 04:21 PM
  • Joined: 01 May 2010
f12::

Pause

Suspend

return


PureIce
  • Guests
  • Last active:
  • Joined: --
Worked flawlessly, thanks

poserpro
  • Members
  • 525 posts
  • Last active: Apr 28 2013 04:39 AM
  • Joined: 21 Oct 2010

f12::
Pause
Suspend
return


Suspend,Toggle

Since Oct 11, 2010

Check my QRCode design if you wish: 

http://db.tt/CONU2zBY


Nxqd3051990
  • Members
  • 15 posts
  • Last active: Jun 21 2011 11:36 PM
  • Joined: 25 Jun 2007

f12::
Pause
Suspend
return


Suspend,Toggle

Thanks, this is much simpler and clean :)

betvo
  • Members
  • 35 posts
  • Last active: Jan 27 2014 07:06 AM
  • Joined: 21 Feb 2011
How do you get it to suspend all active scripts?

hopefully there's a better way than writing the function in all of them.

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
AHKPanic() is a function that can suspend all active scripts.

Guest00001
  • Guests
  • Last active:
  • Joined: --
If I am running this script for a game because there are no macros yet, would this work?


f12::
Pause
Suspend
return

Q::
Send Numpad0
Send Numpad1
Send Numpad2
Send Numpad3
Send Numpad4


Basically I am trying to send 5 commands, in a certain order, to the keyboard so they all proc within .00001 seconds of each other when I press Q. I want to use f12 to turn it on or off

Something similar to Q::wasd , but with numpad

I am at work so I cannot test it, yet. Thank you

glenn332
  • Guests
  • Last active:
  • Joined: --
when i do this the script wil pause and all but my script itself doesnt do a thing anymore

janopn
  • Members
  • 694 posts
  • Last active: Jun 12 2017 03:41 PM
  • Joined: 08 Jul 2011

when i do this the script wil pause and all but my script itself doesnt do a thing anymore


I don't understand exactly what you said there.
But maybe the "doesn't do a thing anymore" is because you are sending text, and not buttons.

Q::
Send {Numpad0}
Send {Numpad1}
Send {Numpad2}
Send {Numpad3}
Send {Numpad4}
return

If that wasn't your problem, please explain a little more

Edit: Or maybe you are just looking for this:

f12::
Hotkey, q, toggle
return

Q::
Send {Numpad0}
Send {Numpad1}
Send {Numpad2}
Send {Numpad3}
Send {Numpad4}
return

All in all is all we are ~

glenn332
  • Guests
  • Last active:
  • Joined: --
im trying to make something that can pres the Z all the time with a toggle on or off becuz i need to type sometimes
i got this

F1::pause,toggle

Send {z}

im new XD

janopn
  • Members
  • 694 posts
  • Last active: Jun 12 2017 03:41 PM
  • Joined: 08 Jul 2011

im trying to make something that can pres the Z all the time with a toggle on or off becuz i need to type sometimes
i got this

F1::pause,toggle

Send {z}

im new XD


Oh, you should use Loop. That makes some piece of code repeats itself X times.
F1::pause, toggle

F2::
Loop,
{
Send z ; {} not needed
Sleep, 1 ;Need some delay to take the pause
}
return

Try that.
All in all is all we are ~

glenn332
  • Guests
  • Last active:
  • Joined: --

im trying to make something that can pres the Z all the time with a toggle on or off becuz i need to type sometimes
i got this

F1::pause,toggle

Send {z}

im new XD


Oh, you should use Loop. That makes some piece of code repeats itself X times.
F1::pause, toggle

F2::
Loop,
{
Send z ; {} not needed
Sleep, 1 ;Need some delay to take the pause
}
return

Try that.


thx wil try

glenn332
  • Guests
  • Last active:
  • Joined: --
F1::pause, toggle

F2:: (why u have F2 here?)
Loop,
{
Send z ; {} not needed
Sleep, 1 ;Need some delay to take the pause
}
return


(and wil it pres z or presses z because it need to hold teh button z in

glenn332
  • Guests
  • Last active:
  • Joined: --
janopn do you know how to make a script that keeps the Z pressed not pressing like a miljon times but just keeps it pressed in