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
 Using 'save -i' in a doc-loop: Origin hangs

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
johannes.kastl Posted - 11/09/2012 : 04:45:34 AM
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
2   L A T E S T    R E P L I E S    (Newest First)
johannes.kastl Posted - 11/13/2012 : 05:36:27 AM
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
greg Posted - 11/12/2012 : 1:38:18 PM
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

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