
PMC files from previous versions are automatically converted, however there might be errors in the converted syntax that will need to be fixed manually. Since version 5.0.0, AutoHotkey Expression format must be used for Function parameters and COM expressions. A complete explanation can be found at AHK documentation. In expressions variables must not be enclosed in percent signs (except to deference) and literal strings must be enclosed in quotes. % StrLen("Some string") This would show 11 in a command parameter Forcing expression in a command parameter by preceding it with a % and one or more spaces.MyVar := Number + 100 This would assign the value from variable Number + 100 to MyVar MyVar := 30 * 100 / 200 This would assign 15 to MyVar Checking the option Expression in the Variables Window.Ie := ComObjCreate("InternetExplorer.Application"), ie.Visible := true, ie.Navigate("") This would create an InternetExplorer COM object and navigate to "" You can enter multiple expressions separated by lines or commas. Entering them in the Expression Window.In PMC you can execute expressions in the following ways: With expressions you can execute math operations, functions, assignments and object calls.
Autohotkey stringscan series#
ExpressionsĮxpressions are used to perform one or more operations upon a series of variables, literal strings, and/or literal numbers. Note: This is the correct syntax in AHK, but if you don't have the Expression option checked you can enter values without quotes and use percent signs for variables, e.g.: %MyVar% and some text, and it will be converted for preview and export. Type a valid variable name, select one of the operators and input a value. You can also create and modify variables in the Variables window. Most commands and functions outputs variables with the result of its operation. Today is %A_DDDD% and it's %A_Hour%:%A_Min%.ĭownload Example: Using Variables inside Command Parameters Assigning Variables For example you can copy a text and send it using ControlSend or ControlSetText directly from the clipboard. That means you can use variables in Text or MsgBox and other commands. %MyVar%) inside a string will be converted to the variable's contents during playback. Avoid commonly used words like "var", "par", "func", etc.Īny single word enclosed in percent signs (e.g.Do not use variable names starting with numbers or symbols like "_" or "$".Use variable names that are at least 3 characters long. Do not use very short words, such as "a" or "vr".PMC will warn you with a traytip if it notices you are using some of its reserved words, but it's impossible to monitor every single situation and variable to avoid such conflicts, so it's recommended to follow these guidelines when choosing a variable name:

Therefore if you choose a variable name that's used internally by PMC you may run into inconsistencies and even crash the program. Pulover's Macro Creator is written in AutoHotkey language, and so it has internal variables in the same environment as user-defined variables.

MyVar := "AutoHotkey"Ī detailed explanation about Variables can be found at the AHK documentation. To use a variable inside a function parameter or expression, do not enclose it in percent signs. Click, 300, %Rand% Left, 1 The Y coordinate will be a random number. You can use this variable inside another command by enclosing it in percent signs. Random, Rand, 10, 50 The Rand variable will have a number between 10 and 50 after the command executes. Most commands and functions will output a value as the result of its operation into a variable of your choice, for example the OutputVar of the Random command will be used to hold the randomly gererated number. Whether it's a text, number or any other, you can assign a value to a variable and use it with commands and functions. Variables & Arrays/Objects Variables & Arrays/Objects Table of Contents
