![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Get directory of current DXL script Topic Summary: Script directory? Created On: 9-Aug-2006 08:31 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Try this. Create a file called whereAmI.inc containing the code in the code window. Install this file in the same directory as your main script. Then use in your main script as follows: #include "./whereAmI.inc" print "I am running in directory " whereAmI() "\n" | |
![]() |
|
I want to save a file in the same local directory as the DXL script that is running.
Is there a way of getting the directory of the script from DXL? I know that there is a command currentDirectory but this is not the same thing. Any ideas? |
|
![]() |
|
![]() |
|
//try
print getenv("addins") |
|
![]() |
|
![]() |
|
The function dxlHere() will return the path name of the file if and only if it has been #included.
Note that the path may or may not be relative to doorsHome/lib/dxl. For example, you have two dxl files, myScript.dxl and myScript.inc. myScript.dxl contains the following: #include <c:/temp/myScript.inc> print "from main script: " dxlHere "\n" myScript.inc contains the following: print "from included script: " dxlHere "\n" If you load and run myScript.dxl, the output is as follows: from included script <c:/temp/myScript.inc><Line: 1> from main script <Line: 3> ------------------------- Tony Goodman http://www.smartdxl.com Edited: 9-Aug-2006 at 16:23 by Tony Goodman |
|
![]() |
|
![]() |
|
Thanks for the response.
I tried print getenv("addins") as well as getenv on the other standard environment variables referenced in DXL help. For some reason I get nothing back from any of them. I don't think that I have these variables set up. Are they supposed to be set up when the DOORS client is installed? Can I set them up now, and what should they be set to? For reference I'm using a Windows PC (2000). |
|
![]() |
|
![]() |
|
Thanks Tony, |
|
![]() |
|
![]() |
|
Try this.
Create a file called whereAmI.inc containing the code in the code window. Install this file in the same directory as your main script. Then use in your main script as follows: #include "./whereAmI.inc" print "I am running in directory " whereAmI() "\n" ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
Tony,
Thanks, looks like the best solution. It's still a shame that dxlHere() only has a path for include files. Michael. |
|
![]() |
|
![]() |
|
Hi,
I have tested the Script, too but i have a problem (Doors 7.1) my Output is: <./whereAmI.inc:30> current Directory: . I mean, of course . is a directoryname, but sth. like D:\scripts\ would be nicer. regards Michael Edited: 15-Aug-2006 at 10:32 by Michael Werner |
|
![]() |
|
![]() |
|
Yes, the dxlHere perm seems to get its path from whatever was in the include statement.
------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Get directory of current DXL script
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.