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: How do I get command line arguments in batch mode?
Topic Summary:
Created On: 22-Jun-2004 15:54
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 Louie Landale, on Wednesday, June 23, 2004 3:34 PM

Answer:
As far as I know you cannot pass parameters such that the DXL will read them and then act on them. You can only pass command line switches from the manual, and yes "-p" project is one of them.

The -p project parameter is an artifact from DOORS v4 where you HAD to log into a project (rather than log into the database); and in v5 it didn't work as expected when I feebly practiced with it (IIRC the project gets locked but not opened). Write a simple batch file that prints the name of the current project, then fire it up from DOS window using -p; just to see if it works.

As for parameters, you could try this:
DOS *.bat file:
set MyParameter = MyValue
doors.exe -dxl MyDXL.dxl

MyDXL.dxl:
string Parameter = getenv("MyParameter")
print "MyParameter = '" Parameter "'\n"

- Louie
 22-Jun-2004 15:54
User is offline View Users Profile Print this message


Austin Hastings

Posts: 2
Joined: 21-Jun-2004

Howdy,

I'm trying to write a report script that can extract metrics from any named project. I'd like to specify the project name as a command line parameter in batch mode, something like:

doors -batch count_vowels.dxl arg1 arg2

(where arg1 and arg2 would be the args I want to pass in, naturally.)

I cannot see a way in the DXL reference to get this information. The closest thing I can see is the -D/-dxl switch, for passing executable code.

Am I missing something, or do I have to use -dxl for feeding in argument data?

=Austin
Report this to a Moderator Report this to a Moderator
 23-Jun-2004 08:26
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Austin,

if You only want to pass the Project name, You can use commandline switch :


-project (-p) project_name The name of the project that you want to open at the start of the session. The contents of the project are displayed in the right pane of the DOORS Explorer.
If you use the -batch switch, the parameter specifies the current project.


as described in the DOORS help file .... ;-))

If You want to pass other parameters, You could use a file or registry(Windows)/Environment variables(UNIX)
A file can be read into a string with string foo = readFile "fileName".
The environment varibles can be accessed by using : string foo = getenv "variableName".

Another easier possebility could be the -dxl (-D) commandline switch :
doors -D "string foo1 = \"bla\";int foo2= 5" -u user -P password -b fileName.dxl"
In the DXL script fileName.dxl You can use foo1 and foo2 ...

I hope this will help You

greetings
Reik Schröder
Siemens AG Berlin





-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 23-Jun-2004 14:13
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Answer Answer
As far as I know you cannot pass parameters such that the DXL will read them and then act on them. You can only pass command line switches from the manual, and yes "-p" project is one of them.

The -p project parameter is an artifact from DOORS v4 where you HAD to log into a project (rather than log into the database); and in v5 it didn't work as expected when I feebly practiced with it (IIRC the project gets locked but not opened). Write a simple batch file that prints the name of the current project, then fire it up from DOS window using -p; just to see if it works.

As for parameters, you could try this:
DOS *.bat file:
set MyParameter = MyValue
doors.exe -dxl MyDXL.dxl

MyDXL.dxl:
string Parameter = getenv("MyParameter")
print "MyParameter = '" Parameter "'\n"

- Louie
Report this to a Moderator Report this to a Moderator
 23-Jun-2004 15:37
User is offline View Users Profile Print this message


Austin Hastings

Posts: 2
Joined: 21-Jun-2004

Reik, Louie,

Thanks for the feedback. I confirms what I've discovered over the last day.

As of v7.1, the -dxl option is non-viable: while you can do something like this:

doors -b script.dxl -dxl "int foo=0;"

It doesn't serve well in the general case because there is no effective way to handle a case where the variable is *not* defined via -dxl -- there's no good way to set a default value.

After experimenting, I've decided to use environment variables -- there's less hassle with OS switching, and it does just about everything I need it to do.

Thanks again for the help, guys.

=Austin
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 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 1 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.