KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Macros, part I
PRODUCT: 4D | VERSION: 2003 | PLATFORM: Mac & Win
Published On: March 21, 2003

One of the many new features offered by 4D 2003 is the ability to use macros. A macro is a customizable section of commands, basically 4D code that is accessible and can be placed anywhere in your methods. The macros can be used in any database opened with 4D 2003.

When you launch 4D 2003 for the first time, an XML file called Macros.xml is created for you. Take a look below to find out where this file is created for your operating system.

System Location of active 4D folder

- Mac OS 9
{Disk}:System folder:Application Support:4D

- Mac OS X
{Disk}:Library:Application Support:4D

- Windows 98 & Windows Millennium
{Disk}:\{System folder}\All users\Application Data\4D

- Windows 2000 & Windows XP
{Disk}:\Documents and Settings\All Users\Application Data\4D
*{Disk}:\Windows\4D*

*Note: If the 4D folder is not available in the first location, it may be found in this location. If all else fails, you can use the 4D command Get 4D Folder to return the path to the 4D folder location if necessary.

There are several ways you can call a 4D Macro. You may do so through the contextual menu of the Method Editor, use one of the lists available at the bottom of the dialog window, or use the type-ahead function of 4D 2003.

The contextual menu can be accessed by the "Insert Macro" command from the "Method" attribute of the menu bar.

To display a list of your macros in the method editor list at the bottom of the method editor dialog window, simply click on the drop down arrow and select "Macros" from the list.

Type-ahead will allow you to substitute a selected command for the string of characters you have typed already. The list will display a list of commands and macros that matches what you have already typed.

Commented by Thomas Fitch on February 17, 2009 at 4:18 PM
There have been a lot of changes to Macros and they are a lot more powerful than they used to be. 4D v11 SQL made Macros much more interesting and now they offer new functionality. There is a tech note on all the new features too... http://kb.4d.com/search/assetid=47934