Domanda

Not sure where to search or how to define the keywords. What is the difference between the following?

#IfWinActive, Some Window Title
IfWinActive, Some Window Title

What is the # doing there? I know that in shortcuts, # stands for Windows key, but surely this has to mean something else.

I had been trying to make up a script and the If-else blocks did not work at all. Finally I figured out that it's because I added the # symbol. But I don't find any documentation regarding this kind of use of the # symbol.

È stato utile?

Soluzione

The hash is a totally different command. If you search the index in the autohotkey documentation, you will find an entry for both IfWinActive and #IfWinActive.

[The hash...] Creates context-sensitive hotkeys and hotstrings. Such hotkeys perform a different action (or none at all) depending on the type of window that is active or exists.

The #IfWin directives are positional: they affect all hotkeys and hotstrings physically beneath them in the script. They are also mutually exclusive; that is, only the most recent one will be in effect.

The # only represents the windows key when you use it as a hotkey assignment designation. In AutoHotkey, any time you see a # at the beginning of a command it has something to do with AutoHotkey directives.

Conclusion:

If you just want regular if-else statemens and don't need to affect the context of hotkeys, then don't use the #.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top