Dear All,
OK, I have found the response to my question (great!)
To execute an external program.bat using arguments:
proc InitGIDProject { dir } {
----------------------------------------------------------------------
InitGIDProject
----------------------------------------------------------------------
…
InsertMenuOption “Calculate” “Run IDRA” 5 {RunExternalProgram $dir} “PRE”
“insert”
UpdateMenus
…
----------------------------------------------------------------------
End InitGIDProject
----------------------------------------------------------------------
}
proc IdraIsRunning {repertoire} {
----------------------------------------------------------------------
RunExternalProgram
----------------------------------------------------------------------
set repertoire [file native $repertoire]
set exttrans “\”
set nothing “”
set aa [.central.s info Project]
set ProblemType [lindex $aa 0]
set ProjectName [lindex $aa 1]
set ProjectName [file root $ProjectName]
set executable “ExternalProgram.exe”
Corresponding to GID’s %1
set basename [file tail $ProjectName]
set basenameFF [file native $basename]
Corresponding to GID’s %2
set directory $ProjectName.gid
set directoryFF [file native $directory]
set directoryFFF [file attributes $directoryFF -shortname]
set directoryFFF [file native $directoryFFF]
Corresponding to GID’s %3
set repertoireFF [file native $repertoire]
set repertoireFFF [file attributes $repertoireFF -shortname]
set repertoireFFF [file native $repertoireFFF]
Script to execute
append script $repertoireFF$exttrans$executable
exec $script $basenameFF $directoryFFF $repertoireFFF & NUL: &
----------------------------------------------------------------------
End RunExternalProgram
----------------------------------------------------------------------
}
Ouf !
G.W.R. Geis
ieea a écrit :
Thank you Enrique for your response, neverthless, my problem is not exactly
this one and I had surely not well explained it !
I wish execute an external program without generating a mesh (that means, it is
not possible to use a problem_type.win.bat).
So, I’d execute an external program called PROGRAM.exe, for example.
This program needs the name of the problem type directory and the name of the
current project, which will be recognized as argument %1 and %2 by PROGRAM.exe
.
For the moment I use this Tcl command:
exec PROGRAM.exe $problem_type_directory $current_project_name &
NUL: &
where :
$problem_type_directory is the variable containing the name of the
problem typedirectory which is here: C:\Program
Files\GID\GID7.2\problemtypes\IDRA.gid
and
$problem_type_directory is the variable containing C:\Documents and
Setting\IDRA\test.gid
But this doesn’t work, because the directories names are not given by their
Window 3.1 name (there is blank space in the name).
Could you tell me if it is the good way to execute without meshing or if there
is an other good solution.
Thank you if you have a response.
G.W.R. Geis
Enrique Escolano a écrit :
To run a bat file is needed call a interpreter command as “command.com” for
Win9x or “cmd.exe” of WinNT/2000
You can use auto_execok to write a “system independent” command (it set
automatically the appropiate paht
and cmd.exe or command.com)
exec [auto_execok $batfile]
You can also use command.exe provided with GiD to avoid some limitations of
the
Windows command.com and cmd.exe (size of parameters with small limit, etc)
See GiD help on Tcl/Tk extension-Using EXEC in GiD
exec [[file join $GIDDEFAULT command.exe] $batfile]
Enrique
----- Original Message -----
From: “ieea” ieea at club-internet.fr
To: “GID” GiDlist at gatxan.cimne.upc.es
Sent: Thursday, March 20, 2003 4:56 PM
Subject: [GiDlist] Finding a Tcl procedure to execute *.win.bat
Dear All,
I am looking for a Tcl procedure to execute a problem_type.win.bat.
I wish to reproduce the same command as GID, that means:
problem_type.win.bat project_name project_name_directory
problem_type_directory
and now, don’t.
For example I execute the Execute command from the InitGIDProject
procedure something like this :
proc InitGIDProject { dir } {
# The Execute Tcl command is called here
source $dir/scripts/Execute.tcl
…
# the variable GidRepertoire take the value of the
problem_type_directory directory
set GidRepertoire $dir
…
# the variable GidRepertoire take the value of the
problem_type_directory directory
Execute GidRepertoire
…
}
with:
proc Execute {repertoire} {
# The name of the executable problem_type.win.bat
set executable “IDRA.win.bat”
set exttrans “/”
set aa [.central.s info Project]
set ProblemType [lindex $aa 0]
set ProjectName [lindex $aa 1]
set ProjectName [file root $ProjectName]
set repertoire [file native $repertoire]
# the argument %1
set basename [file tail $ProjectName]
# the argument %2
set directory $ProjectName.gid
# the argument %3 corresponds to $repertoire
append script $repertoire$exttrans$executable
exec $script "$basename" "$directory" "$repertoire" &
NUL: &
}
This procedure doesn’t work here because the directory names are written
as:
C:\Program Files\GID\GID7.2\problemtypes\IDRA.gid
and should be written as:
C:\PROGRA~1\GID\GID7.2\PROBLE~1\IDRA.GID
Can somebody help me to use the right Tcl command.
Thank you in advance,
G.W.R. Geis
GiDlist mailing list
GiDlist at gid.cimne.upc.es
_http://gid.cimne.upc.es/mailman/listinfo/gidlist_
GiDlist mailing list
GiDlist at gid.cimne.upc.es
_http://gid.cimne.upc.es/mailman/listinfo/gidlist_