The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.

Moderator: pjdixit

#72081 by dhs
Sun Aug 13, 2017 9:49 pm
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.
#72087 by Jsosnowski
Mon Aug 14, 2017 12:02 pm
I don't have an active DCAL compiler set up at the moment so I cannot test this, but the uconstants.pas file sets the value of pathCad = 0. Have you tried this constant in DCAL?
#72092 by Jsosnowski
Mon Aug 14, 2017 4:44 pm
I believe the path is in the Registry, although you have to use the Delphi tregistry class to access things.

Using regedit I went looking for the directory and discovered it is not listed under the software heading. I did find it under itellipoint which I believe is used to add/delete software and so the Datacad path should be consistently used for all Datacad user computers.

\HKEY_CURRENT_USER\Software\Microsoft\IntelliPoint\AppSpecific\DCADWIN.exe contained the value in 'path' field.
Last edited by Jsosnowski on Tue Aug 15, 2017 9:50 pm, edited 1 time in total.
#72096 by dhs
Tue Aug 15, 2017 12:40 am
Thanks for your suggestion Joe.
Yes, it is in the registry - I get the value from there for my install programs.
In Delphi it is probably better to use ExtractFilePath(Application.ExeName).
But my question relates to Classic DCAL, and I still don't have a reliable way to get it there.
I had my reasons for not using the 'Suppport Files' folder originally (which I can get easily in both classic & Delphi DCAL), but I think that may be the best option available to me, so will probably end up moving my support files to a dhsoftware folder within the Support Files folder (this does not effect any macros that I have publicly released, so I still have the flexibility to move the files without any inconvenience to users).
Regards,
David H.

p.s. I noted that you do not have a DCAL compiler set up (mentioned in your previous post)? If that is because of the difficulty running it on a 64 bit machine then I think the simplest thing to do is to install DOSBox (http://www.dosbox.com)
#72106 by Jsosnowski
Tue Aug 15, 2017 9:50 pm
Sorry, I skipped over your need to access the path in DCAL and went right toD4D.

I tried using ExtractFilePath(Application.ExeName). It extracts the path from a full filename string. I believe 'ExeName' is afield in a record (or class). It can be used to get the path of the current application, the Delphi program being written, but does not query to OS for other program paths.

Thanks for the suggestion re: dosbox. I have not tried setting up a DCAL compiler because I was not interested in its limited capabilities for use with some of the ideas I have in mind.

Edit: I just realized that when I tested ExtractFilePath(Application.ExeName) I was using a VCL program, not a dll macro. No wonder I could not find Datacad path, I was in a different program!

Who is online

Users browsing this forum: No registered users and 1 guest

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for AEC Professionals Since 1984