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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Origin's current directory & run -e
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mike Buess

USA
3037 Posts

Posted - 06/29/2001 :  08:32:57 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm looking for a way to change the current directory while Origin is running and I want to do so without opening a project or any other Origin file. I often launch batch programs with 'run -e' and usually want their working directories to be the Origin program folder. Instead the batch program's working directory is Origin's current directory as described above. Now I am changing directories (cd) within the batch programs and explicitly write in the Origin path. But the batch programs are used in an add-on and the path must be rewritten for each user during setup. It would be easier if I could simply change Origin's current directory prior to launching the batch program. Is that possible?

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 06/29/2001 08:34:26

Edited by - Mike Buess on 06/29/2001 12:36:13

rtoomey

USA
184 Posts

Posted - 06/29/2001 :  3:54:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
What about passing each path as a string variable? For instance, you can pass the path to the Origin directory by executing the run -e as follows:

run -e filename.bat %Y;

The string in %Y would then get passed into the batch file as %1. Similarly, the default path for Origin projects could be obtained and passed:

fdlog.useGroup(Origin);
%A=fdlog.path$;
run -e filename.bat %A;
(** See Note **)

Both could be passed, too:

fdlog.useGroup(Origin);
%A=fdlog.path$;
run -e filename.bat %A %Y;


In this case, the paths would be held as follows:
1) Origin projects path: %1
2) Origin directory path: %2

I hope this helps. If this was not (in any way) what you were asking, please let me know!

- rtoomey



** Note ** %Y is a reserved string variable which always holds the path to the Origin directory. Check out the LabTalk Help file or Origin User's Manual to learn about it.



Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/29/2001 :  4:57:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That's actually the approach that I've been working on today. But it's implementation is a little more complicated if you must allow for any type of Origin installation. The complications arise from two possible situtations:
  • Long file names - If the Origin's path is C:\Origin Program Folder\Origin61.exe, then %Y=C:\Origin Program Folder\ will look like three arguments when passed to the batch program. The simple solution is to enclose %Y in quotation marks.
  • Partitioning, or muliple drives - If you just opened a project on a different drive letter, say E:\Projects, then you must change back to the drive containing Origin before switching to its program directory.
I've settled on this approach:
run -e filename.bat %[%Y,3] "%Y";
and start the batch program with these two lines:
%1
cd %2
For the Origin path in my example this becomes
C:
cd "C:\Origin Program Folder\"
This works well, but some of my batch programs already have several arguments and I was looking for a way to avoid adding two more. But that's probably more a matter of taste than anything else.

Thanks,

Mike Buess
Origin WebRing Member
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000