Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does an asterisk mean at the beginning of an AHK script's line?

I'm trying to modify an AHK script I like but don't quite completely understand.

What does the asterisk mean at the beginning of this line of script?

*capslock::

Does the pair of colons at the end mean this line is only part of the statement? Does it continue to the next line?

like image 974
lance Avatar asked Apr 26 '12 13:04

lance


People also ask

What does := mean in AutoHotkey?

Var := expressionEvaluates an expression and stores the result in a variable.

How do I start an AutoHotkey script on startup?

The easiest is to place a shortcut to the script in the Startup folder: Find the script file, select it, and press Ctrl + C . Press Win + R to open the Run dialog, then enter shell:startup and click OK or Enter .


1 Answers

Fires the hotkey regardless of the modifiers being held down.

http://www.autohotkey.com/docs/Hotkeys.htm

Wildcard: Fire the hotkey even if extra modifiers are being held down. This is often used in conjunction with remapping keys or buttons. For example:

Win+C, Shift+Win+C, Ctrl+Win+C, etc. will all trigger this hotkey.

*#c::Run Calc.exe  

Pressing Scrolllock will trigger this hotkey even when modifer key(s) are down.

*ScrollLock::Run Notepad 

Edit: Hm, didn't see the second part.

If you have a single statement, you put it all on one line like above. If you have multiple statements, you must put a newline after the :: and have a return at the end.

#w:: MsgBox "Windows+W FTW"
#q::
  MsgBox "Windows+Q FTW"
  MsgBox "Another annoying message box!"
  return

I have a way of using the capslock key as a modifier that I like better:

;; make capslock a modifier, make shift-capslock a true capslock
setcapslockstate, OFF ;SetCapsLockState, alwaysoff

$*Capslock::   ; $ means that the hotkey code shouldn't trigger its own hotkey
  Gui, 99:+ToolWindow 
  Gui, 99:Show, x-1 w1 +NoActivate, Capslock Is Down 
  keywait, Capslock 
  Gui, 99:Destroy 
  return 

; Made a window show up when the capslock is pressed.

; Now, if that hidden windown is there, do anything you like
#IfWinExist, Capslock Is Down 
   j::Left 
   k::Right 
   i::Up 
   m::Down 
#IfWinExist 

; Oh, by the way, right-alt and capslock works like real capslock
ralt & Capslock::
  GetKeyState, capstate, Capslock, T
  if capstate = U
  {
    SetCapsLockState, on
  } else {
    SetCapsLockState, off
  }
  return     
like image 197
Jeff Walker Avatar answered Oct 27 '22 09:10

Jeff Walker