Hotkeys work less well than run

Get help with using AutoHotkey and its commands and hotkeys
Guest

Hotkeys work less well than run

09 Sep 2017, 09:47

Hi, I'm very new to AHK, and I'm getting some weird issues with a simple script I'm using.
It's intended to toggle on and off a rainmeter skin, and it works fine when the full code looks like this:

Code: [Select all] [Download] GeSHi © Codebox Plus

Run, C:\Program Files\Rainmeter\Rainmeter.exe !ToggleFade "Note"
ExitApp


If I click Run it will generally always work.

But if I add a hotkey function, and make it look like this:

Code: [Select all] [Download] GeSHi © Codebox Plus

#Persistent
^2::
Run, C:\Program Files\Rainmeter\Rainmeter.exe !ToggleFade "Note"
ExitApp


It won't work every time I press the hotkey. 50% of the time, nothing happens.

Thanks, Smite
User avatar
Exaskryz
Posts: 2405
Joined: 17 Oct 2015, 20:28

Re: Hotkeys work less well than run

09 Sep 2017, 11:15

The only think I can think of is you have another ^2:: or a *2:: (See modifiers; * means disregard the actual state of modifiers like ctrl and shift) that is in another script, perhaps as part of a #IfWinActive. This other script may be overriding your Rainmeter Toggling script.

Edit: See the reply below... The Exitapp didn't even come to my attention. I saw the redundant #Persistent though.. Here's a link to the return you should use instead of exitapp, as per tutorial. (Heck, the ExitApp isn't even necessary in your original script because it's not #Persistent.)
Last edited by Exaskryz on 09 Sep 2017, 15:38, edited 2 times in total.
User avatar
tidbit
Posts: 982
Joined: 29 Sep 2013, 17:15
Location: USA

Re: Hotkeys work less well than run

09 Sep 2017, 11:34

it doesn't work "every time" because you use EXITAPP not RETURN to end the hotkey.
as soon as the thing runs, your script is going to exit.
rawr. fear me.
*poke*
Is it December 21, 2012 yet?

Return to “Ask For Help”

Who is online

Users browsing this forum: arytinki, Bing [Bot], Google [Bot], Yahoo [Bot] and 46 guests