Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Tony Goodman, on Friday, August 11, 2006 1:29 AM

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"
 9-Aug-2006 08:31
User is offline View Users Profile Print this message


Michael Cvitanovich

Posts: 21
Joined: 31-Mar-2006

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?
Report this to a Moderator Report this to a Moderator
 9-Aug-2006 15:24
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

//try

print getenv("addins")
Report this to a Moderator Report this to a Moderator
 9-Aug-2006 16:21
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 10-Aug-2006 03:17
User is offline View Users Profile Print this message


Michael Cvitanovich

Posts: 21
Joined: 31-Mar-2006

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).
Report this to a Moderator Report this to a Moderator
 10-Aug-2006 03:21
User is offline View Users Profile Print this message


Michael Cvitanovich

Posts: 21
Joined: 31-Mar-2006

Thanks Tony,
I tried what you wrote and it works as you say, however unfortunately it's the main script I want to know the location of.

Report this to a Moderator Report this to a Moderator
 10-Aug-2006 17:43
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Answer 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"

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 11-Aug-2006 01:32
User is offline View Users Profile Print this message


Michael Cvitanovich

Posts: 21
Joined: 31-Mar-2006

Tony,
Thanks, looks like the best solution.
It's still a shame that dxlHere() only has a path for include files.
Michael.
Report this to a Moderator Report this to a Moderator
 15-Aug-2006 10:31
User is offline View Users Profile Print this message


Michael Werner

Posts: 15
Joined: 29-May-2006

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
Report this to a Moderator Report this to a Moderator
 15-Aug-2006 10:49
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Yes, the dxlHere perm seems to get its path from whatever was in the include statement.

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.