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
 Creating Folders In User Directory
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mulvenna

Germany
46 Posts

Posted - 11/12/2013 :  04:45:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

greg

USA
1379 Posts

Posted - 11/12/2013 :  4:31:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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$)";
}
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