How to use the ScrollLock key as a modifier with AutoHotkey? Example:

ScrollLock + F1 : Launch software1.exe

ScrollLock + F2 : Launch software2.exe

ScrollLock + F3 : Launch software3.exe

etc.

I've already looked at this topic and Autohotkey use CapsLock key as modifier key but it seems specific to CapsLock.

up vote 1 down vote accepted

This should work:

ScrollLock & F1:: Run notepad
ScrollLock & F2:: Run wordpad
ScrollLock & F3:: Run iexplore.exe

If you don't want ScrollLock to be turned on and off every time you use it in a hotkey definition, then you have two options:

The simplest way is to force the key to stay off permanently by adding

SetScrollLockState, AlwaysOff

in the auto-execute section (top of the script).

#NoEnv
#SingleInstance Force

SetScrollLockState, AlwaysOff

ScrollLock & F1:: Run notepad
ScrollLock & F2:: Run wordpad
ScrollLock & F3:: Run iexplore.exe

or you check its state every time you use it in a hotkey definition and restore this state after releasing it:

ScrollLock & F1::
    Run notepad
    If GetKeyState("ScrollLock","T")
        SetScrollLockState, On
    else
        SetScrollLockState, Off
return
  • The same applies if you want to use Capslock or NumLock as a modifier with AutoHotkey. – user3419297 Nov 26 at 8:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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