The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 DOS batch file starting from project directory

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
tib Posted - 11/12/2003 : 11:32:57 AM
Hi,
I want to start a DOS batch file from a project with the path %X.
run -e %XBatch.bat
Only if I started the Origin project by double clicking then the batch file will be started from directory %X.
However, when I start Origin and load the project the command starts the program in the Origin directory %Y.
I tried fdlog.path$=%X but without success.
Any ideas how I can set the DOS window start directory?
Thanks, Tilman.


5   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 12/18/2003 : 2:27:39 PM
Hi Ricardo,

Whether or not you need the final '\' depends on how the path was generated. Most LabTalk commands that return paths automatically append '\'. Examples... %B=fdlog.path$, %B=%Y and %B=%X. (Although %X is empty until the project is saved.)

Mike Buess
Origin WebRing Member
srmcarneir Posted - 12/18/2003 : 1:50:20 PM
Hi,

I had several problems with the calling of
batch files from a LabTalk script and sometimes
the same script does not work the same way
in different machines.

Concerning your example I guess I was luckier
by inserting the character '\' between the
string variable %B of the path and the batch file name:

run -e %B\BatchFile.bat;

Good Luck!

Ricardo Carneiro
Mike Buess Posted - 11/13/2003 : 07:31:55 AM
Sorry, mixed up the function name with the name of the example given in the help file.

ExecuteApp is Origin 7.5.

Mike Buess
Origin WebRing Member
tib Posted - 11/13/2003 : 06:23:42 AM
Hi Mike,
thanks, I would have preferred the pure C solution.
BUT it doesn't work.
First the command _chwd should be _chdir.
And OriginC seems not know the command ExecuteApp.
I also couldn't find it in the help.

Your first example works only if I replace
_chwd with _chdir

Tilman.



Edited by - tib on 11/13/2003 06:47:24 AM
Mike Buess Posted - 11/12/2003 : 5:39:42 PM
Hi Tilman,

You can't change the working directory from LabTalk, but you can from Origin C. I'm not positive that this will do what you need, but it might be worth trying...

# OC function
int ChgDir(string strPath)
{
return _chwd(strPath); // change working directory to strPath
}

# LabTalk usage
if( ChgDir(%X)==0 ) run -e Batch.bat;

(Now you don't need the full path in the run argument.)

...You might as well do it all in Origin C

# OC function
void Launch(string strApp)
{
string strPath = GetFilePath(strApp); // file path
string strFile = GetFileName(strApp); // file name
if( _chwd(strPath)==0 ) ExecuteApp(strFile,"");
}

# LT usage
Launch "%XBatch.bat";

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 11/12/2003 6:57:11 PM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000