Jump to content

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

How to suspend a script with toggle on, off



  • Please log in to reply
11 replies to this topic
kaunasny
  • Members
  • 4 posts
  • Last active: Jan 02 2014 08:52 AM
  • Joined: 22 Dec 2013

Hello,

 

I'm sorry for this easiest question.  But in 2 hours I couldn't find the answer that worked for me.

 

The way to suspend a script is :

 

!s::suspend

 

But how to toggle it on/off, how to re enable it?

 

Autohotkey help shows :  Suspend [, Mode]

 

But it gives me error showing:

 

Error: Parameter #1 invalid.

 

Specifically: [, Mode]

 

Tried everything, nothing works.  Help please



kmccmk9
  • Members
  • 46 posts
  • Last active: Aug 08 2014 07:50 PM
  • Joined: 11 Dec 2013

Well what code have you tried?



Masonjar13
  • Members
  • 1517 posts
  • Last active:
  • Joined: 16 Sep 2012

!s::Suspend IS a toggle by default. Also, this is in the wrong thread.


OS: Windows 7 Ultimate / Windows 8.1 Pro | Editor: Notepad++


kaunasny
  • Members
  • 4 posts
  • Last active: Jan 02 2014 08:52 AM
  • Joined: 22 Dec 2013

Thank you for replies.

 

Well I have tried many codes.

 

But help tells to do this:

 

!s:: Suspend [, Mode]

 

But doing this gives an error as I have posted.  What's wrong here?

 

Just by doing !s:: Suspend  in suspends the script but does not toggle on/off.

 

 

Problem solved.  I have put Return below the code.  It togges on off now.



Menixator
  • Members
  • 744 posts
  • Last active: Sep 01 2015 02:54 PM
  • Joined: 10 Jul 2013

Just by doing !s:: Suspend  in suspends the script but does not toggle on/off.

Suspend turns of all the hotstrings and hotkeys of the script.

if you set a hotkey to suspend a script, that hotkey itself will get disabled and so, you cant unsuspend the script.



Masonjar13
  • Members
  • 1517 posts
  • Last active:
  • Joined: 16 Sep 2012

if you set a hotkey to suspend a script, that hotkey itself will get disabled and so, you cant unsuspend the script.

This is untrue.

As previously stated, putting this exactly, "!s::Suspend" WILL act as a toggle. Quote: "^!s::Suspend ; Assign the toggle-suspend function to a hotkey."


OS: Windows 7 Ultimate / Windows 8.1 Pro | Editor: Notepad++


Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013

Maybe this is what you are looking for :

 

Pauses the script's current thread.

 

#p::Pause ; Pressing Win+P once will pause the script. Pressing it again will unpause.
Pause [, On|Off|Toggle, OperateOnUnderlyingThread?]


Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


Ex0rpl4net
  • Members
  • 87 posts
  • Last active: Jun 25 2015 01:09 PM
  • Joined: 14 May 2013

i dont know what you need,but what i use is this: 

f12::Pause

i dont know if this is what you need but this is what i use for suspending my script.



Menixator
  • Members
  • 744 posts
  • Last active: Sep 01 2015 02:54 PM
  • Joined: 10 Jul 2013

This is untrue.


It seems so. My bad. :)

kaunasny
  • Members
  • 4 posts
  • Last active: Jan 02 2014 08:52 AM
  • Joined: 22 Dec 2013

Hey guys,

 

Thank you for reply.  Maybe you missed my edit that problem is solved.  Sorry forgot to mark it.

 

Suspend doesn't suspend srcipt and disable toggle.  It works.  All was needed is to put return below  !p::suspend and it toggles on / off

 

For anyone looking for answers:

 

!p::
Suspend
Return

 

 

this will :  Alt + p  will suspend the script and unsuspend pressing it twice, toggles on and off.

 

Thank you guys for your help



Masonjar13
  • Members
  • 1517 posts
  • Last active:
  • Joined: 16 Sep 2012
✓  Best Answer

You should know that

!p::Suspend

is the equivalent to

!p::
Suspend
Return

as a single line of code with a hotkey automatically returns.


OS: Windows 7 Ultimate / Windows 8.1 Pro | Editor: Notepad++


kaunasny
  • Members
  • 4 posts
  • Last active: Jan 02 2014 08:52 AM
  • Joined: 22 Dec 2013

You should know that

!p::Suspend

is the equivalent to

!p::
Suspend
Return

as a single line of code with a hotkey automatically returns.

Right,  putting the code on the same line works as well.

 

!p::Suspend  works same way.  In this case Alt+p suspends the script and unsuspends pressing twice.