Macros and Programming


CardboxForumsMacros and Programming > "How to macro 'New Window'?"

How to macro 'New Window'?

Posted By Post


12-Jul-2006 15:43

Does anyone know how I can open a new window in a macro? i.e. Like selecting 'Window' and then 'New Window'.

I've tried recording a macro while doing this but just get 'Activate ""' which doesn't actually open a new window.

I know I can use OpenFile, but that's a performance hit, a new window is instant!

Thanks in advance.

Charles Welling

15-Jul-2006 19:37

An obvious solution would be to use the "SendKeys" method, which can be used to "type" ALT+W and N, but I haven't been able to make it work. I'm not sure whether I'm making some mistake or that Cardbox simply doesn't respond to SendKeys.

There is however a script language, similar to VBscript, that is called Autoit3 (www.autoitscript.com). You can use it to script any application and even Windows itself. It is very easy to use, you can merge the commands with the Cardbox macro language, it's very small (± 123 kb), well-documented, and it's free. I managed to make a new window in Cardbox using a one-line Autoit3 script: Send("%wn").

Autoit3 scripts can be compiled to .exe which I did with the above mentioned oneliner. You can either download Autoit3 yourself and have a good time doing all the things Vbscript can't do (recommended), or you can download my "newwindow.exe" using the following link:


Make a Cardbox macro launch the newwindow.exe and your done.


Charles Welling

16-Jul-2006 09:51

I'd like to add two things to my reply:

first: the above mentioned line Send("%wn") should be Send(!wn"). My mistake.

Second: in one of your earlier messages (Complex Database) you asked about changing drop-down lists in the format file. I tried to use Autoit3 to do this and it works perfectly. It takes just one line of code to open the format, i.e. Send("!efe"), another to move the mouse to the right field and click it (mousemove("left",X,Y) and a third to send ALT+ENTER. You are then in the Field Properties box.
Autoit3 has a small utility that you can use to retrieve window information and it shows the coordinates of the mouse pointer, so you can easily determine where the mouse should move to. You can even allow for different screen resolutions.



23-Jul-2006 19:36

Perhaps you mean this:
Add in a macro:
      Set cbx=CreateObject("Cardbox.Application")
      Set second = cbx.windows
      cbx.visible = True

With this you open a second window using the default workspace.



28-Jul-2006 09:50

If do don''t want a new instance but only open a new copy of the 'current' database with same selection/browseposition use this macro:

x = Name
OpenFile Database
y = Name
Activate y
SetSameAs x,1
SetSameAs x,2
SetSameAs x,0

No need for sendkeys!

© 2010 Cardbox Software Limited   Home