Creating Scripts


To create a new script select 'File/New Macro', or click the 'New' button on the Toolbar. To Edit an existing script, select it from the list by clicking on it and then select  'File/Macro Properties' or double click on it.  Having done this you will be presented with the following window:



In this example an existing script was selected to be edited. If 'New' had been pressed then this form would appear blank.


Code can be inserted and edited directly into the script editor.  Use the Code Builders and Wizards found in the left hand Code Builders pane to help locate functions and insert code.


Pressing F1 in the editor will present the help topic for the highlighted function or, if no text is highlighted, the function in the current line.  To test the script click the 'Run' button.  Note that when running a script from within the editor you are actually running in debug mode.  If you have a log file enabled it will not be updated while running in debug mode.


To save the macro press the Save toolbar button.  If you have not yet given the macro a name you will be asked for one.   Press Save to save any changes made to the macro script or properties.


Save As will allow you to save to a new macro or script file and context will then change to that script/macro.  In contrast Export will simply save a copy of the script file but you will continue working on the current macro.


The script editor provides a full featured programmer's editor with code folding, bookmarks, the Debugger and other script building options including the Dialog Designer and Code Snippets.  See also Code Folding and Bookmarks. You can also set the script backup options from the editor's tools menu.


The Import button allows you to load in a script that has already been created. This is useful if you have a number of Macro Scheduler installations and want to make use of a script created on a different PC for example.


The numbers at the top right of this window show your mouse cursor position.  Use these to determine the correct parameters when using the MouseMove command.  The button to the left of the numbers reveals a drop down menu which allows you to toggle between absolute coordinates and relative coordinates.  When set to relative, the numbers show you the relative coordinates to the window the cursor moves over.  The other option allows you to attach a small tag to the mouse cursor that shows the coordinates and follows the cursor around.  This means that if the script window becomes concealed by another application you can still see the cursor position.  If you then press both left and right mouse buttons the content of the cursor monitor window will be copied to the clipboard, making it easy to paste into your code. The last option of the drop down menu is used to add the pixel colour to the display as well as the cursor position.  This is helpful for the WaitPixelColor command.


The editor is now "multi-tabbed".  That is, you can have more than one file open in the editor at once.  The tabs are positioned at the bottom of the editor.  To open another file in a new tab select File/Open in New Tab.  You can also right click on a filename that appears anywhere within the editor and select "Open in New Tab" to open it in a new tab.


For help with other tabs of this window see: Scheduling Scripts (Run When), Trigger, AutoLogon, Logging, Encryption, Hot Keys, Groups


To get help with the MacroScript language see: Scripting Windows for Beginners, Command Reference, Using Variables, Complex Expressions