Freeware XP

DMacro

Download the XP here!!

Here are my postings made on the FastCAD BBS in regards to this module. It covers most of the usage of DMACRO


A month ago I tested if there was a way for macros to handle dialogboxes. I wrote an XP that would take a list of virutal-key codes and just posted them to the active window. This actually worked, but had some troubles with timing and didn't have time to write a good user interface. I didn't put more time on this since Mike Riddle promised to provid tools for macros to run dialog boxes.

I have put this XP on the web if you like to try. You can download it from http://www.dd.chalmers.se/~f95peol/fcad/Dmacro.zip. I have included a script (PRINT.SCR) that (at least on my computer) will print the current drawing and then exit Fcad, saving the drawing.

DMACRO and DMACROT will take a list of virtual-key codes and then return to FastCAD. Now it starts to post the codes back to FastCAD as if the user were typing them at the keyboard. DMACRO takes the list as integers and DMACROT will take an ASCII string. ASCII codes is entered by typing \ and then the decimal ASCII code. Only decimal numbers are allowed.

Two more features are needed. First the codes has to be posted to the right window. Posting them to FastCAD doesn't help if there is an dialog box active. To solve this place a code 0 when a change of active window occurs. This will force the XP to wait until a new window appears and post to that instead. Second sometimes the posting might be to fast. This happens when typing a text and then for example ENTER. ENTER will sometimes be captured before the text. To solve this insert code 255. This will have the XP sleep for 100 ms to allow Windows to catch up.

DMACRO and DMACROT will need to be the last command in all scripts because the actions performed by the commands will for FastCAD seem as a user typing them at the keyboard. To continue a script after DMACRO, have DMACRO call anorther script to continue.

As you can see this isn't to tempting to use DMACRO, but you are welcome if you like to try.

Virtual-key codes can be found in the WIN32 Reference - a Microsoft helpfile. I have also found a WEB-page listing most of them: http://msdn.microsoft.com/library/psdk/winui/vkeys_529f.htm

You can use capital A..Z for letters, the digits 0..9, ENTER (ascii 13) without changing them into virtual-key codes. This will hopefully solve most of your problems.

Now to the PRINT.SCR:

DMACROT PRINT\13\0\9\255\9\255\9\255\9\255\9\255\9\255 1\255\13\0\0QUIT\255\13\0\255\13;

Call DMACROT (text version) to:

  • type PRINT {ENTER} at the prompt
  • wait for the print dialog box
  • Press {TAB} 6 times with delay (these might not be needed)
  • Enter 1 for one copy
  • Press {ENTER} to print
  • wait for the printing dialog box
  • wait for FastCAD to become active (no more dialog boxes)
  • type QUIT {ENTER} at the prompt
  • wait for the quit dialog box
  • press {ENTER} to save the drawing

If you don't need to set number of copies it would be much shorter:

DMACROT PRINT\13\0\255\13\0\0QUIT\255\13\0\255\13;

I can't promise you that this will work on your computer. There is to many maybes in there.


There is one fundamental error in using DMACRO as above. The DMACRO command has to be the last command in the script and also in all scripts. After DMACRO has executed there should be time for the user to enter things at the keyboard (DMACRO will play the user). It doesn't seem to be the problem above, but you will run into this later if continuing on this approach.


You have previously seen DMACRO, but Lars-Gunnar Andersson found a way to make it useful.

DMACRO can be used inside scripts and macros to drive dialog boxes without terminating the script. You just need to place a delay after the command to allow time for DMACRO to execute.

An example of how to use the print dialog:

:
Macro code
:
PAUSE 1 ' Allow Windows to catch up (might not be needed)
DMACROT PRINT\13\0\13
PAUSE 1 ' Wait for DMACROT to execute
:
Macro continued
:


Installation
Download and run the installation file. Be sure to give your FastCAD32 or EasyCAD32 folder when prompted for the installation directory. The commands will automatically be available for use the next time you start your CAD-program. To see a list of available commands, type XPCFG at the command prompt, or select [Specs > Installed XPs...] from the Main menu.

WARRANTY AND LICENSE AGREEMENT
This software requires a legal copy of FastCAD or EasyCAD.

WARRANTY: This software is provided "as is" without any warranties or conditions whatsoever.

PK Data is not liability to any degree what so ever. In no event will PK Data or its distributors be responsible for any direct, indirect or consequential damages that arise from use of this software, or its failure to perform any of its intended functions.

LICENS AGREEMENT: PK Data grants you the right to install and use this software on as many computers as you wish. You are free to distribute this module to others as long as no charge is included.

You may not rent or lease this software and you may not decompile or disassemble this software.


The content of this site and our XPs are copyright © 1999 to PK Data.