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
 Using 'save -i' in a doc-loop: Origin hangs
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

johannes.kastl

Germany
71 Posts

Posted - 11/09/2012 :  04:45:34 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everyone,

I tried to save all graph windows in a project into separate OGG-files. Therefore I used

doc -e P {save -i C:\PATH\TO\SOMEWHERE\%(page.longname$);}


Or rather, I tried to use it. If there is only one graph, it works.

If there are two or more graphs, Origin goes into an endless loop. I see all OGG-files, but still origin tries to save and save (If you include a type-statement in the doc-loop, you see that output appear til infinity). I have to kill Origin, it wont stop, even after some minutes (and it should not take that long to save two graphs into ogg files).

Do I have an error in my command? An error in my thinking process? or is this a bug in Origin?

Thanks in advance,
Johannes

Origin Ver. and Service Release (Select Help-->About Origin): 8.6G SR3
Operating System: Win XP

greg

USA
1378 Posts

Posted - 11/12/2012 :  1:38:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This appears to be a bug specific to the "save" command when used inside a "doc -e P" loop. I checked and this bug has gone undiscovered since at least version 4.13, so this is one very old bug.

Until it we have a fixed version, you can move the loop outside the "doc -e P" by working off a string array:

// BEGIN SCRIPT
stringarray sa;
doc -e P {
%A = page.longname$;
if(%[%A] > 0) sa.Add(%A); // Just add the name to the array
else sa.Add(%H); // If no long name, just add the short name
}
// Now loop over the array elements
loop(ii,1,sa.GetSize())
{
%A = sa.GetAt(ii)$; // Get next name
win -o %A {save -i D:\TEMP\%A;} // Make it active, save it
}
// END SCRIPT
Go to Top of Page

johannes.kastl

Germany
71 Posts

Posted - 11/13/2012 :  05:36:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Greg,

thanks for your answer. Sad to hear its a bug that has been going for so long, but at least its not me being stupid... ;-)

It appears that 'win -o' works with shortnames only, so I had to adapt your script like this to get it working (not sure if the if-statement is necessary):

// BEGIN SCRIPT
stringarray sa;
doc -e P {
	%A = %H;
	if(%[%A] > 0) sa.Add(%A); // Just add the name to the array
}

// Now loop over the array elements
loop(ii,1,sa.GetSize())
{
%A = sa.GetAt(ii)$; 
win -o %A {save -i %(page.longname$);}; // Make it active, save it
}


But you can use '%(page.longname$)' inside the command given to 'win -o', so the files are saved with the longname as intended.

Thanks for your help, now I know how to work with arrays, too. Very smooth.

Regards,
Johannes
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