Excellent, thanks for these answers, and the additional
I guess it was not working as I was putting it inside another script, and I had additional return statements, maybe that was breaking it.
Just on this syntax in AHK, is it correct that it's sort of python like things after a declaration like ^#r:: don't need an explicit 'return' after multiple lines, and it just starts on a new hotkey declaration when it sees a new '::' or something? Finding it hard to know when to put down 'return' statements and not (I take it that the return below is for the ifMsgBox, and not for the ^#r:: ?).
Code: Select all
^#r::
ifMsgBox, OK
Reload
return
^#s::
<do something else>
But then I've seen other scripts that use #if and they don't have a return at all. I've tried looking in the documentation, but still not clear on how and when to use 'return' ?
Code: Select all
; The #IfWin directive creates context-sensitive hotkeys. Such hotkeys perform a different action depending on the
; type of window that is active or exists. https://autohotkey.com/docs/commands/_IfWinActive.htm
#IfWinActive ahk_class CabinetWClass
^f::
Run %explorerpath%
#IfWinActive ; turn off context sensitivity