Macros vs. SBasic Programming
SBasic has many advantageous over macros. While macros may sometimes be required, consider the SBasic options first.
In Q&A, macros were the only available option for automation. In Sesame, macros play a much smaller role; they are created by recording and are therefore neither human readable, nor editable. Most of what you might have used a macro to accomplish can be done much more reliably using SBasic. (See, for example, ResultSetCurrentPosition, CreateNewRecord, CloseCommandArea, FormFieldValue, @SelectTreeItem, @Save, @Exit and the @Load[saved spec] and @Run[saved spec] commands.) Because programs can generate their own feedback as to the state of Sesame, and change what they do based on that state, Sesame's programming language is the recommended method to automate complex operations.
Programming does have a limitation in that it cannot run unless contained within a Layout. This means that you must run a macro if you want to automate the opening of another form. (In general, however, SBasic is a better choice for automation. Sesame provides a number of built-in functions to help you automate your applications.)
See the Creating and Using Macros section in the Sesame Programming Guide for details on recording and saving Macros, as well as information on launching macros using the @Macro command.
- Error Handling:
- Unlike Macros, which don’t have much ability to react to the unexpected, using SBasic allows you to test for and handle errors, as well as respond to different conditions.
- Containment:
- Your SBasic is contained within your application in the form of layout programming and saved Mass Updates. Macro files are external and can become separated from the application.
- Readability:
- It is much easier to tell what your SBasic program is intended to do. SBasic programs consist of generally readable instructions. Macros, especially in a GUI environment, consist of a complex series of cryptic "events" which don't make much sense to a human and are difficult to manually adjust. Manually figuring out to which pixel coordinates to warp your mouse is beyond most of us.
- Control:
- You can usually control when your SBasic runs. Macros, however, can be loaded up and run anytime from anywhere. Sesame macros (unlike Q&A Macros) have some limited ability to determine whether they are in the correct context, but it is still a dangerous situation.