Hotkeys work less well than run

Get help with using AutoHotkey (v1.1 and older) 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

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

#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: 2882
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: 1272
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 (v1)”

Who is online

Users browsing this forum: Google [Bot] and 292 guests