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
 Creating Folders In User 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
Mulvenna Posted - 11/12/2013 : 04:45:54 AM
Origin Ver. 8.6
Operating System: Windows 7

Hi,

I have a problem, I'm trying to save workbooks and excel files using the "save -i" function. This works no problem if the destination folder already exists but if it does not, it will not automatically create the folder. (When exporting graphs, this is done automatically)

Is there a way to create new folders from labtalk? And if not is there any other way I could automate the process?

Thanks,
Mulvenna
1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 11/12/2013 : 4:31:43 PM
Unfortunately there is no LabTalk to create a folder in the OS. You can check if a path exists with the exist function as in:

if( !exist("D:\Temp\Example3",5) )
{
ty Sorry. I don't exist!;
}

There's a CreateDirectory Origin C function, but the programmers ( in their infinite wisdom no doubt ) decided to type that function as a Boolean ( I hate when they do that ) which means you would have to create a wrapper function to make it callable from LabTalk.

Time to set the Way Back Machine to the early days of computing ...

Run this script:
type -gb %YMakeDirectory.BAT;
type "md %1";
type -ge;

That creates a file named "MakeDirectory.BAT" in your User Files Folder.

Now we can use the exist function to test if our folder structure exists and if not, use this file to create folders for us:

string str$ = C:\Deep\In\TheOS;
if( !exist(%(str$),5) )
{
run -e %YMakeDirectory.BAT "%(str$)";
}

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