Hi,
In the past I've always put support files required by a macro in the macro folder itself, and used pathmcr in the macro to get the path where I look for the support files.
But it has come to my attention that pathmcr may not always point to the folder where the currently running macro is located. There are 2 instances that I know of where this can happen:
1. The macro has been launched from the Toolbox icon on the top menu bar. Launching a macro from this icon does not appear to update pathmcr. Pathmcr reflects the path of the macro that was most recently launched from the toolbox option under the Edit menu.
2. Where multiple documents are open and you are running macros in both, then pathmcr appears to reflect the path of the most recently launched macro.
I suspect that most people have all their macros in the same folder, but the creation of a DMX subfolder under the Macro folder by the DataCAD install got me thinking about the problems that could be caused by having macros in different paths, As a result when I was recently working on D4D macro I decided to put the support files in a dhsoftware sub-folder in the main Datacad directory. It is easy to get the path of the current executable in Delphi, but now that I am doing a bit of work on a Classic DCAL macro I realise that I don't know how to get the main DataCAD folder in classic Delphi. Getting any one of a number of other paths that DCAL supplies and then removing the last folder would work in most cases, but is probably not 100% reliable. Does anybody know if this can be accomplished reliably in DCAL?
Thanks,
David H.
In the past I've always put support files required by a macro in the macro folder itself, and used pathmcr in the macro to get the path where I look for the support files.
But it has come to my attention that pathmcr may not always point to the folder where the currently running macro is located. There are 2 instances that I know of where this can happen:
1. The macro has been launched from the Toolbox icon on the top menu bar. Launching a macro from this icon does not appear to update pathmcr. Pathmcr reflects the path of the macro that was most recently launched from the toolbox option under the Edit menu.
2. Where multiple documents are open and you are running macros in both, then pathmcr appears to reflect the path of the most recently launched macro.
I suspect that most people have all their macros in the same folder, but the creation of a DMX subfolder under the Macro folder by the DataCAD install got me thinking about the problems that could be caused by having macros in different paths, As a result when I was recently working on D4D macro I decided to put the support files in a dhsoftware sub-folder in the main Datacad directory. It is easy to get the path of the current executable in Delphi, but now that I am doing a bit of work on a Classic DCAL macro I realise that I don't know how to get the main DataCAD folder in classic Delphi. Getting any one of a number of other paths that DCAL supplies and then removing the last folder would work in most cases, but is probably not 100% reliable. Does anybody know if this can be accomplished reliably in DCAL?
Thanks,
David H.
David Henderson
dhSoftware - Add-on Macros for DataCAD
dhSoftware - Add-on Macros for DataCAD