Cardbox > Support > Knowledge Base ...

Help with writing macros

Cardbox can record your actions and store them as macros. Because a recorded macro can only repeat the exact actions that you performed originally, you will often find it useful to make changes to a macro after you have recorded it.

For more sophisticated applications you may want to write a macro from scratch or adapt one of the sample macros from the Cardbox help file or this web site.

Cardbox macros are essentially mini-programs written in Microsoft's VBScript programming language. We can't write macros for you (just as we can't design your database formats or enter your data for you), but this page is a guide to useful help and resources.

Things you can do without help

Many of our sample macros are essentially complete as they stand. Often the only change you need to make is to fill in the actual names of the fields you are using. For instance, one of our send-a-fax macros starts like this:

' Names of Cardbox fields Const fieldNumber = "FAXNO" Const fieldName = "RECNAME" ' Omit this line if not needed.

All you need to do is replace the field name "FAXNO" with the field that you are actually using in your database to store the fax number of the recipient. Similarly, you should replace the field name "RECNAME" with the field that holds the name of the recipient (in this particular macro, you can also omit this field altogether).

For this sort of change you don't have to know anything about VBScript or about programming. Comments in the sample macro, or in the article that accompanies it, will give you all the information you need.

Learning to write macros

If you have never programmed before then the programmatic nature of VBScript may look a little daunting. Don't worry: if you progress at a slow and steady pace you may still end up achieving great things with the macro system. Several of the more enthusiastic macro writers we know about had never programmed anything before they set out to learn how to write Cardbox macros.

The Macros and Programming book leads you step by step through the use of macros with Cardbox. It gives examples of adapting macros and of writing macros of your own, and it gives a complete list of the commands that a macro can give to Cardbox. It also has a number of sample macros you can adapt. You can download it in PDF format here.

The Cardbox help file gives a complete reference to all macro commands ("methods and properties") with a full explanation of every parameter and option. It also has many sample macros for purposes such as sending faces and emails.

Our own documentation concentrates on the use of VBScript macros with Cardbox, but there are many commercially available books on the VBScript language itself, ranging from reference books to tutorials.

Getting help and advice

The Cardbox Talk forum is a good place to try. Quite a few members of the forum are interested in using Cardbox macros, sometimes in quite an expert way. Cardbox users are friendly people in general and any request that you make for advice is quite likely to be answered. Do remember, though, that the forum members are unpaid and providing their responses as a matter of mutual support.

One or two forum members also offer consultancy, including the writing of custom macros.

© 2019 Martin Kochanski
"Cardbox" is a registered trademark.
 Top of page