I have a working AHK script that I've been using for a while.

I recently tried adding a new line to this script to run a function in Transparent Screen Lock; namely, to lock the PC on a hotkey combination. According to the program's documentation:

You can lock your screen though a script by executing this program with the "/s" switch: "Transparent Screen Lock.exe /s".

My current AHK script looks like this:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Run C:\Program Files (x86)\Mozilla Firefox\firefox.exe

Run C:\Program Files\Sublime Text 3\sublime_text.exe

Run B:\Users\Me\AppData\Local\Wunderlist\Wunderlist.exe

Run C:\Program Files\CyberGhost 6\CyberGhost.exe

Run C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe

Run C:\Windows\System32\cmd.exe, B:\Users\Me\Desktop

Run C:\cygwin64\bin\mintty.exe -, B:\Users\Me\Desktop

Run C:\Windows\SysWOW64\Transparent Screen Lock.exe /s

According to the AHK documentation, #^! is an equivalent modifier to the CtrlWinAlt keyboard combination, so after saving and reloading the above script, pressing those keys should run the lock function in TSL-PRO. Instead, it does nothing. The other program hotkeys work as they always have.

I also tried running the script without the /s parameter, and it still did nothing, so it appears that the modifiers may be to blame, though I'm not sure why.

What am I missing here?


The symbols you used are hotkey modifiers, not keys. After you list your modifiers you also need to list some key.

If you want to assign Ctrl+Win+Alt as the hotkey you should change your script like so:

Run C:\Windows\SysWOW64\Transparent Screen Lock.exe /s

You can also switch the ^ to Ctrl or the # to LWin or RWin.

See the list of possible hotkeys here and the list of possible modifiers here.


As Hashim mentioned in a comment, the above script requires the Alt key to be pressed last. To fix this issue you can put all the variations as hotkeys:

Run C:\Windows\SysWOW64\Transparent Screen Lock.exe /s
  • Wow. That's very confusing, the documentation didn't make this clear at all. Thanks for solving that problem, although it's given way to another related one; the condition is only triggered by first pressing Ctrl+Win and then the Alt key. Is there no way to set it up so that I can press those keys in any order to trigger the condition. Once again, the documentation seems really confusing on this, not sure whether it's just me or not. – Hashim Aziz Aug 8 '17 at 0:53
  • You're right. I've edited my answer and added a way to make it work for any order. – Tomer Godinger Aug 8 '17 at 1:04
  • Damn, that's ingenious! Thanks so much. Can I ask how you know all this? Do you have prior experience with AHK or did you figure all this out by looking at the documentation? I'm unsure whether it's just me that finds the documentation confusing. – Hashim Aziz Aug 8 '17 at 1:10
  • 1
    I do use AHK when I need to, but I've never faced this issue or thought about such a case. And I didn't check the documentation to solve it, though I did look up how to set multiple hotkeys for the same action. I just figured that modifier symbols are expected to be used as modifiers and would need to come with a key. Frankly, I'm surprised AHK accepts #!^ as a hotkey at all. I would expect the script to produce an error. Anyway, glad to be of help. ^_^ – Tomer Godinger Aug 8 '17 at 1:14
  • 1
    Come to think of it, your question here was really about using only modifier keys for a hotkey in AHK. Whether the command you executed worked or not is a different issue altogether which I don't think has anything to do with AHK (unless the working directory somehow affects it, or administrator privileges or something). It might be prudent to change the title of the question to reflect that. – Tomer Godinger Aug 8 '17 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.