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
 Turn 1 project into many
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

DDrennan

USA
3 Posts

Posted - 03/03/2016 :  1:33:35 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I have a chemist who likes to create 1 project with data from multiple sources. We need a way to script, preferably in LabTalk, a way to save each graph into its own project. I tried this but I only get 1 graph with the name "newName.ogg".

{ // section brackets for error handling
doc -e L
{ // loop over layers
string LayerName$ = %H;
if (find(LayerName$, "Graph")>0) {
save -i %H;
}
}
}
doc -s;
exit;

DDrennan

Hideo Fujii

USA
1582 Posts

Posted - 03/03/2016 :  2:25:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi DDrennan,

If you want to loop over every graph, you need to use "P" option in Doc -e command, insread of "L" option (which scans every layer in a single graph). E.g.:
doc -e P { // loop over graphs
  string GraphName$ = %H;
  if (find(GraphName$, "Graph")>0) {
    save -i %Y%H; //Save graph in the User Files Folder
  }
}

Hope I didn't misunderstand what you intended.

--Hideo Fujii
OriginLab
Go to Top of Page

DDrennan

USA
3 Posts

Posted - 03/03/2016 :  3:11:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo,
I tried that, and I'm still getting only one output file, called newName.ogg -- a name which doesn't appear anywhere in my project. It only has one graph in it, so it's at least getting that part right - but I want a separate file for each graph in the project.
Di


DDrennan
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 03/03/2016 :  3:42:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi DDrennan,

Your/my code will never produce "newName.ogg" because you filtered out such name by the condoition, "find(LayerName$, "Graph")>0" - therefore you should get only files like Graph1.ogg, Graph2.ogg, etc. You can try a debug command before save command like:
type -a %Y%H;

--Hideo Fujii
OriginLab
Go to Top of Page

DDrennan

USA
3 Posts

Posted - 03/03/2016 :  3:55:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
oops, never mind. I was running an older version...
(blush)
Thanks for your help !

DDrennan
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