Page 1 of 1

VbScrip macro: How to get Project directory

Posted: Thu 1. Sep 2022, 15:44
by se_akr
Hello,

I'd like to print my project directory on a Message Box. Something like

Code: Select all

MsgBox ProjectPath
How can I get this directory on my script ?
I succeed to print the path for active document, but not the project

Thanks in advance for your help

Re: How to get Project directory

Posted: Thu 1. Sep 2022, 17:43
by M.Maidhof
Hi,

which software/tool are you talking about? Please tell us name and used version.

regards

Michael

Re: How to get Project directory

Posted: Fri 2. Sep 2022, 07:33
by se_akr
Hello,

PCAN-Explorer 6 with Instruments Panel.

Just have a window which print the path of the project after clicking on a button. I need MsgBox, but I don't know how to get the path

Best regards

Re: How to get Project directory

Posted: Fri 2. Sep 2022, 10:44
by K.Wolf
Hi,
if you only want the directory name, there are two possibilities:

Code: Select all

MsgBox ActiveProject.Path
Or:

Code: Select all

MsgBox Documents.TranslateFileName("$(PrjDir)")
To also include the project file name:

Code: Select all

MsgBox ActiveProject.FullName
Or:

Code: Select all

MsgBox Documents.TranslateFileName("$(PrjPath)")

Re: How to get Project directory

Posted: Fri 2. Sep 2022, 11:11
by se_akr
MsgBox ActiveProject.Path is perfect

Thank you !

Best regards