Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
versions [2023-01-24 13:13] – [v1 or v2?] Re-title article geek | versions [2023-01-25 17:23] (current) – ↷ Page moved from playground:versions to versions geek | ||
---|---|---|---|
Line 109: | Line 109: | ||
For example, the '' | For example, the '' | ||
- | < | + | < |
a = b ; Assignment - legacy syntax, ' | a = b ; Assignment - legacy syntax, ' | ||
a = b + 1 ; Common mistake - literally assigns the text "b + 1" | a = b + 1 ; Common mistake - literally assigns the text "b + 1" | ||
Line 136: | Line 136: | ||
The legacy syntax allows a command to be written with fewer “meta-characters”; | The legacy syntax allows a command to be written with fewer “meta-characters”; | ||
- | < | + | < |
ifWinNotExist ahk_class Notepad | ifWinNotExist ahk_class Notepad | ||
{ | { | ||
Line 152: | Line 152: | ||
Because variable names would be interpreted as literal text by default, including the value of a variable requires marking it with extra symbols. So instead of surrounding the literal text with quote marks, you must surround the variables with '' | Because variable names would be interpreted as literal text by default, including the value of a variable requires marking it with extra symbols. So instead of surrounding the literal text with quote marks, you must surround the variables with '' | ||
- | < | + | < |
- | Run Notepad,,, PID | + | Run Notepad,,, PID |
- | WinWait ahk_pid %PID% | + | WinWait ahk_pid %PID% |
</ | </ | ||
Line 163: | Line 163: | ||
The example above uses '' | The example above uses '' | ||
- | < | + | < |
if not (WinExist(" | if not (WinExist(" | ||
{ | { | ||
Line 177: | Line 177: | ||
Since v1 commands use legacy syntax by default (although [[https:// | Since v1 commands use legacy syntax by default (although [[https:// | ||
- | < | + | < |
if not (WinExist(" | if not (WinExist(" | ||
{ | { | ||
Line 193: | Line 193: | ||
By contrast, v2 strips away the legacy syntax, leaving only expressions. For example: | By contrast, v2 strips away the legacy syntax, leaving only expressions. For example: | ||
- | < | + | < |
if not (WinExist(" | if not (WinExist(" | ||
{ | { | ||
Line 215: | Line 215: | ||
A great thing about AutoHotkey is that it is easy to make something useful happen with a few lines of simple code. Most users probably start with basic things like defining a hotkey to open a program, activate a window, send some template text or similar. Often a useful hotkey can be created with a single line, simply writing a command name and some text that the command uses. | A great thing about AutoHotkey is that it is easy to make something useful happen with a few lines of simple code. Most users probably start with basic things like defining a hotkey to open a program, activate a window, send some template text or similar. Often a useful hotkey can be created with a single line, simply writing a command name and some text that the command uses. | ||
- | < | + | < |
#n::Run Notepad | #n::Run Notepad | ||
</ | </ | ||
Line 229: | Line 229: | ||
A new user of v2 doesn’t need to learn all of the expression operators, or even what “expressions” are, to begin writing code. As with v1, they just need to learn some simple patterns, like how to pass some literal text to a function. | A new user of v2 doesn’t need to learn all of the expression operators, or even what “expressions” are, to begin writing code. As with v1, they just need to learn some simple patterns, like how to pass some literal text to a function. | ||
- | < | + | < |
#n::Run " | #n::Run " | ||
</ | </ |