Installation of macros

After you have downloaded the WinEdt Macro Library or some single macros, put the file(s) in a subdirectory of %b\Macros.

%b is WinEdt's local directory, which is different from %B. While %B always means the WinEdt program directory (usually it is C:\Program Files\WinEdt Team\WinEdt), %b means:

on Windows 95/98/Me:
equals %B (e.g.: C:\Program Files\WinEdt Team\WinEdt)
on Windows NT/2000/XP working as Administrator (or single user mode):
equals %B (e.g.: C:\Program Files\WinEdt Team\WinEdt)
on Windows NT/2000/XP working as an ordinary user:
equals <userprofile>\Application Data\WinEdt

Note that this has changed from earlier versions of the macro library, which was to be saved in %B. Why? Because putting all user additions into the local directory makes it much easier for you to maintain your additions over WinEdt upgrades.

Now what?

To run a macro once, use the Menu Item "Macro | Execute Macro", and choose the macro file you want to execute.

However, if you want to use a macro frequently, you should consider either putting it in a Menu or assigning a keyboard shortcut to it (or both):

WinEdt's Menus are completely user definable. All customizations are performed in the Dialog "Options | Menu Setup".
WinEdt provides two types of menus:

• Popup Menus (visible or invisible)

If you prefer to use a mouse interface, you might want to make an entry in a Main Menu:

• Open "Options | Menu Setup",
• and double-click on the menu in which you want to have the new menu item for the macro ("Tools" or "Macros" are probable candidates).
• A new dialog opens, showing all items in that menu. Go to the position where you want the new Menu Item to appear, right-click there and choose "Insert --> Macro".
• Assign a name to the new item (in the box on the top),
• and put the line
[Exe("%b\path\to\your\macro.edt");]

in the "Macro" box. (Replace with the path to your macro, of course).
• Your new macro is ready to run now. If you say OK to both dialogs, you will see it in the Menu.
• However, you might also want to assign a shortcut to your macro, if you're going to use it a lot. To do this, click in the "Shortcut" box, and type the shortcut you want to assign to it (some combination of one or more meta keys (CTRL, ALT, SHIFT) and a "normal" key). If you want to check whether that combination is already used for another item, right-click in the "Shortcut" box and choose . . .  (I'll let you guess here ... ;-).
• You can safely ignore all other options in the dialog.

A different interface is provided with Popup Menus. You can use either visible popup menus or invisible menus. These are especially efficient for use with (Emacs-like) double-shortcuts:

• Open "Options | Menu Setup",
• go to the tab "Popup Menus",
• and double-click on the menu in which you want to have the new menu item for the macro. You could also create a new one, and define a shortcut to it. You can either have visible or invisible popup menus. Don't forget to enable the popup menu by checking "Enabled".
• A new dialog opens, showing all items in that menu. Go to the position where you want the new Menu Item to appear, right-click there and choose "Insert ... Macro".
• Assign a name to the new item (in the box on the top),
• and put the line
[Exe("%b\path\to\your\macro.edt");]

in the "Macro" box.
• If your popup menu is visible, you can define the shortcut key by putting a "&" before the chosen letter in the name of the item (e.g. "&Abbrv". To run this macro you would first have to press the shortcut key to the popup menu and then "a"; these shortcuts are case-insensitive).
• If your popup menu is invisible you can define the shortcut key by typing the shortcut in the "Shortcut" box (some combination of one or more meta keys (CTRL, ALT, SHIFT) and a "normal" key; e.g. "CTRL-a"; "a" would also be OK; these shortcuts are case-sensitive).
• Note: If your popup menu is invisible, shortcuts defined by a "&" will not work;
if your popup menu is visible, shortcuts that you defined in the "Shortcut" box, will not work.
This is not WinEdt's fault, but the way Windows handles menu.