Item Properties - Macro Editing Page

This page allows you to modify a macro you've previously recorded.

The page contains two lists: the one on the left shows new actions that you can add to the macro, while the central list shows the current contents of the macro. The central list allows multiple selection, so you can copy/paste/delete or drag-drop multiple items at once.

 

Adding a New Action

To add a new action to the macro, either double-click the required action in the left-hand list, or select one of the actions and press the "Add..." button on the right. The new action will be added immediately before the currently selected item in the central list. If no item is selected, the new action will be added at the end of the list.

A run-down of the available actions is provided below, but first here are some general points about mouse and keyboard actions.

  1. All the mouse actions, and some of the keyboard actions have an optional time delay value (see Additional Notes below).
  2. The mouse actions require you to specify a pair of coordinates - please make sure you use the correct coordinate system. Read the section titled "Specifying Mouse Coordinates" below for more details!
  3. As you add items, the selection moves forward. This makes it easier to add a series of actions without having to adjust the selection repeatedly.

OK, now lets look at the available actions.

Move Mouse

This just repositions the mouse.

Left Mouse Click

This actually adds two items to the list - a left mouse down (the left mouse button being pressed), followed by a left mouse up (the mouse button being released).

Middle Mouse Click

This actually adds two items to the list - a middle mouse down (the middle mouse button being pressed), followed by a middle mouse up (the mouse button being released).

Right Mouse Click

Same as the other two mouse clicks, but this time for the right mouse button.

Key (Single Direction)

Use this to add a single key up or key down action. First choose the direction, then hit "Set..." to choose the key.

Key Press

This action adds two items to the list - a key down followed by a key up.

Type Text

This option makes it easier to add a series of key actions. It presents a dialog that records what you type until you press the OK or Cancel button. Note that you MUST use the mouse to press OK or Cancel - the Enter and Escape keys will just record key actions.

Force Caps Lock

If your macro enters text, you may find that your keyboard's Caps Lock key occasionally causes the text to come out in the wrong case. This is most often a problem for macros that enter passwords and other case-sentitive text.

If you wish, you can force the Caps Lock key to be on or off for the duration of your macro by inserting a "Force Caps Lock" item. Just add it to the list prior to any other keyboard items.

Run Macro

This inserts a special action that runs one of the other macros you've already defined. You won't be able to pick the macro you're currently editing, as this would set up a never-ending loop.

Run Executable

This inserts an action that runs a command line of your choosing. Much like the Windows "Run.." box, you can enter the command by browsing, by typing, and by dropping files onto the edit box.

Take care to quote paths that include spaces - e.g. use "c:\program files\mybatfile.bat". If in any doubt, use the "Run Now" button to test the command line in the edit box! If it doesn't work, the resulting error message should help you fix your command line.

Repeat... Loop

If you want to carry out a series of actions more than once, you could copy and paste them into the list several times. A more efficient way however would be to wrap a Repeat Loop around them.

When you add a Repeat Loop, you're first asked how many times you want the loop to repeat. To save any confusion, the number you supply is the total number of times the actions inside the loop will be run.

Add a Repeat Loop actually places two new items in the list: A "start" item and an "end item". Initially, these two items are placed next to one another - it's up to you to drag/drop (or copy/delete/paste) items until the start and end items enclose the actions you want to repeat.

Forced Delay

Many of the actions already have a delay that you can edit, but this delay is reduced or increased on the fly according to the playback speed you've chosen. The "Forced Delay" action inserts an absolute delay that is not affected by the playback speed.

Switch To Prog

Use this action to switch to another program that is already running on your computer. PTFB Pro finds the main window for the program, restores it if it is hidden or minimized, and brings it to the front of the display.

The action takes the name of the program's executable file, including the extension. For example, Outlook's executable file is "Outlook.exe".

To help you get the right name, the drop-down list in the Add/Edit box contains the names of the executables behind all the currently visible top level windows. If your target app isn't listed, it might not be running, or it might be hidden or minimized to the tray. In that case, cancel out of the Add/Edit box, get the target program's main window visible on the screen and try again. Alternatively, if you're an experienced Windows user, you might find the exectuable name listed in the "Processes" tab of Windows Task Manager (on XP, use CTRL+ALT+DEL to summon Task Manager).

Note: Remember that when you switch to another program, the coordinates for any subsequent mouse activity might not be correct. Depending on your goals, you might find it better to create a second macro for the other program, and use the Run Macro action to launch it from within your main macro.

Comment

You can place comments at any point within the macro to help remind you what a particular group of actions does. The comments are completely ignored during playback.

Modifying an Existing Action

To modify an existing action, select it in the central list and press one of the buttons on the right-hand side of the page. Alternatively, if you want to edit an item, you can just double-click it.

To move an item's position within the list, you can either use drag-and-drop with the mouse, or copy/delete/paste.

To create a duplicate of an item either use copy/paste, or hold the CTRL key down while dragging/dropping with the mouse.

Quick Access to Editing Operations

If you right-click in the macro contents list, a popup menu will appear. This contains all the principal editing operations, plus others that may be of use in certain circumstances such as:

Select Redundant Mouse Moves - this selects the items that PTFB Pro will skip if the playback option "Skip redundant mouse movement" is set.

Testing the Macro

It's always a good idea to test your macro after making changes. Once you hit the OK button on the sheet, your changes are saved and there's no way of undoing them (other than by manually re-editing). That's why the page has the "Test Now!" button. Clicking this temporarily hides PTFB and runs your macro there and then, regardless of the triggering options you've set. Also note that macro test runs will not cause any notifications to fire.

It's often easier to see what the macro is doing if you reduce its playback speed. For convenience there's the familiar speed control on this page as well as on the General page. Note that these two pages share the the speed setting - change it on one and you've changed it on both.

 

Additional Notes

Here are a few notes about the meaning of particular item values:

About the Time Delay Value

All the mouse actions, and some of the keyboard actions have an optional delay value. This value is the time in milliseconds that the system should wait before carrying out the action when playing back at 1x speed. When playing back at a different speed, the value is multiplied by an appropriate factor to increase it (for slower playback) or decrease it (for faster playback).

Specifying Mouse Coordinates

Window-relative versus Absolute (screen) coordinates

Most macros are recorded for a target window, rather than for the screen as a whole. Mouse actions recorded in this way store their coordinates relative to the target window - in other words that coordinates are really an offset from the top/left corner of the target window. This allows PTFB to always hit the correct spot within the window, even if it appears a different position on your monitor each time.

By contrast, absolute coordinates are always an offset from the top/left corner of your monitor, in other words they do not allow for any movement of items between one run and the next.

As a general rule, if you are editing a macro with a target window, you should use window-relative coordinates. If your macro is for the whole screen, then you should use absolute coordinates.

Setting the Coordinates

You can either type the coordinates directly into the X and Y boxes, or use the "Set Using Mouse" button.

Hitting this button lets you locate an exact point on the screen using the mouse. However, there is a complication! If you're using window-relative coordinates, you'll first be asked to indicate which window to use to record the coordinates. In almost all cases, you should choose the target window - otherwise you'll find that during playback the mouse does not end up where you planned!


TIP: This page's test facility is handy if a particular program is having trouble when the macro plays at full speed. You can incrementally lower the speed and test until you find a good compromise between speed of execution and reliability.