General syntax: --------------- - Statements can be written in multiple lines by ending the line with a backslash (\). Line breaks within strings are possible, but all whitespaces (space, tabulator, and the line break) before and after the backslash will be replaced by a single space. Example: Message "This is a test", \ "Title" - You can use expressions as parameter by setting them in braces. Example: Message {"1+1="&(1+1)},{"Title: "&%title%} - Strings can contain these tokens: ^CR^ (carriage return), ^LF^ (line feed), and ^TAB^ (tabulator). - Instead of "Set variable, value", you can use %variable% = value. The percent sings in this case are necessary to allow backward compatibilty with scripts using the old Command=Params syntax. - Instead of "If expression", you can use "If { ... }" (resembles the {...} syntax for parameters) or "If ( ... )" (like in C, Java, ...). Internet features ----------------- The commands ReadIni, ReadFile, and ForEach with iniSections and iniKeys allow URLs instead of filenames. Example: ReadIni http://www.foo.bar/versions.ini,Mort,MortRunner There's also the new "Download" command. More about these commands below. New control structures ---------------------- ForEach variabe {,variable} in type parameters {commands} EndForEach There are multiple usages: - ForEach variable in values value {, value} Assings each of the given values to the variable in each iteration. The values are common parameters, i.e. they can contain variables (%variable%) or expressions ({expression}). - ForEach variable in split string, seperator, trim? Similar to the Split command (see below), but the variable will get each part in every iteration. - ForEach variable in charsOf string Assigns each character of the string to the variable. - ForEach variable in iniSections filename Assigns the section names of the given INI file to the variable. - ForEach key, value in iniKeys filename, section Assigns the entries of the given section in the INI file to the variables given for "key" and "value". - ForEach variable in files expression ForEach variable in directories expression Assings the found files resp. directories to the variable. The expression must contain jokers in the last level, e.g. "\Program Files\Mort*" or "\Program Files\Test\*.exe" (similar to XCopy or Move). Switch value Case value{,value} {commands} EndSwitch Just like Choose, but with a fixed value (or variable or expression) instead of a dialog. New commands: ------------- Registry: - RegDeleteKey root, path, delete values?, delete subkeys (recursive)? Deletes the registry key. "Delete values?" is also used for subkeys if "delete subkeys?" is 1. I.e., RegDeleteKey HKCU,"\Software\Dings",0,1 would remove only empty subkeys (because subkeys with entries can't be deleted). If the key can't be removed, a message is shown if the ErrorLevel's on "warn" or lower. The path mustn't be empty to avoid accidental removing of an entiry registry section (e.g. if there's a typo in a variable). Still, this command has to be handled with care, esp. when using varialbes or expressions for the path! Dialogs: - Input variable, numbers only?, description [, title] Shows a dialog with an input field. The value entered will be assinged to the variable (or an empty string if "Cancel" is pressed). If "numbers only?" is 1, only numbers can be entered. - SleepMessage seconds, message [, title] Shows a wait message with a countdown. Files: - IniRead filename, section, key, variable Reads a value for an INI file to the variable (empty string if it doesn't exist). - ReadFile filename, variable Reads the entire contents of the file into the variable. The file size is limited to 128kB or the available memory (whichever is less). You can parse the file e.g. with ForEach line in split %contents%,"^LF^",1 See also the ForEach possibilities for INI files and ReadINI! - WriteFile filename, contents Writes "contents" to the file. If the file exists, it'll be overwritten. - Download URL, target Similar to Copy, but uses an URL (http://... or ftp://...) as source and shows a progress window, because this usually takes a bit longer... - GetVersion filename, variable GetVersion filename, variable, variable, variable, variable Gets the version number in the resources, either as string ("a.b.c.d") or into single variables. This information isn't contained or accurate in all files. If contained, the version is always in four levels, usually major, minor, patch, and build version. System: - GetSystemPath path, variable Receives the localized directory name for certain locations. Possible values for "path" are: * ProgramsMenu - "Programs" in Start menu * StartMenu - Start menu * Startup - Startup (links are run after soft reset) * Documents - "\My documents", requires WM2003 or higher * ProgramFiles - "\Program files", requires WM2003 or higher - GetColorAt x, y, variable Gets the color of the point. At least on some devices, the title bar is ignored, i.e. it receives the color of the underlying today background. The color is 0xbbggrr as decimal value. - GetRGB red, green, blue, variable Coverts the decimal values of red, green, and blue parts (0-255 each) into the the same format as used by GetColorAt. - GetWindowText x, y, variable Receives the window text of the element that's located at the given point. In most dialogs you can get labels or contents of edit boxes that way. It doesn't work as intended for application drawn elements (like in most games) or e.g. list boxes. In this cases, it'll usually return nothing (empty string) or the application's title.