Home

Cardbox

 
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 forum system contains a Macros and Programming forum in which you are welcome to ask questions. Members of the forum are all interested in using Cardbox macros and several of them are experts. 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.

Getting someone to write a macro for you

VBScript is one of the simplest programming languages around. This means that anyone who has a feel for programming can put together a short macro with very little trouble. In fact, one of the problems with commercialising the writing of macros is precisely that a macro is often such a very small job! So if you have a friend or relation who knows computers (or perhaps is studying computer science) then ask for help on an informal basis.

Your next stop might be your local computer shop. Not one of the chains, but one of those small personally-run places that are equally happy building a computer to your own requirements or replacing a faulty cable or power supply. Almost certainly one of the people who work there will have some knowledge of VBScript or will be interested in learning more about it. This kind of shop is always worth supporting in any case, and it is good to establish an ongoing relationship with them in advance of the day when your computer doesn't wake up when you switch it on! If you find anyone really good, let us know and we'll list them on this site.

The Macros and Programming forum is also a good place to ask. You can't really expect someone to put together a whole macro for you for nothing, but if you say at the outset "I want a macro to do X and Y and Z. Can anyone write it? If you can, then email me and let's discuss a price" then you may get some useful responses.

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