One of our customers has a laptop that he uses to access Cardbox databases across the Internet. When he travels from one office to another, he loses his Internet connection, and so he has to close Cardbox and re-open it again to get reconnected to his databases. He was wondering if there was a one-click way of doing this.
Here’s a VBScript macro that closes and reopens any chosen Cardbox workspace.
Const WORKSPACE="C:\My Documents\Address Book.cbw" On Error Resume Next Set x=GetObject(WORKSPACE) x.Visible=False Set x=Nothing WScript.CreateObject("WScript.Shell").Run """" & WORKSPACE & """"
To put this macro on your system, copy it to the Clipboard, then use Notepad to create a file called “Reopen.vbs” and paste the text of the macro into it. Obviously you’d change the first line to reflect the name of your own workspace.
To make the macro easy to access, you can add it to your Quick Launch bar so that it’s always available.
How the macro works
The macro connects to the copy of Cardbox that is running the workspace, it tells it to hide itself, and it deletes its connection to that copy of Cardbox. Cardbox now has no reason to stay alive, so it closes. The macro then opens the workspace afresh.
Could we do better?
- This is a Windows macro, not a Cardbox one. and it has to be run from Windows – the Quick Launch bar, or the desktop, or wherever.
- This macro has the name of the workspace built in to it, so if you have several Cardbox workspaces then you’d need several macros.
Tomorrow, a solution that removes both these drawbacks.