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
 doc -e loop and graph label formatting error

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
Lars_de Posted - 12/17/2014 : 04:03:19 AM
Origin Ver. and Service Release: 8.5.1 SR2
Operating System: Windows 7

Hello,
I have written a Labtalk script to change label positions of all graphs in an Origin project folder. The script looks like this:

doc -ef P
{
layer.unit = 5;
legend.top = (Layer.Top + (Layer.Height - legend.Height) - 15);
legend.left = (Layer.Left + (Layer.Width - legend.Width) - 15);	
title.left = (Layer.Left + (Layer.Width - title.Width)/2);
title.top = (Layer.Top - (1.05 * title.Height));
yl.top = (Layer.Top + (Layer.Height - yl.Height)/2);
xb.left = (Layer.Left + (Layer.Width - xb.Width)/2);
};	

Unfortunately, the script is not working correctly in the way, that only some of the graphs are formatted correctly and other not. Running the script at least several times solves the problem, because in each run, other graphs are formatted correctly, but this could not be the final solution.

Does anyone has the same problem and knows a solution?

Best regards,
Lars
5   L A T E S T    R E P L I E S    (Newest First)
cdrozdowski111 Posted - 12/17/2014 : 8:50:37 PM
Try adding:


sec -p 0.25;


as the last statement within your doc {} loop. It simply pauses the script for 0.25 seconds before continuing the loop.

There are occasionally times when scripts must be paused briefly for Origin to catch up with what the script is asking it to do.

It might not fix your issue but it can't hurt to give it a try.

The sec command is documented here: http://www.originlab.com/doc/LabTalk/ref/Second-cmd
Lars_de Posted - 12/17/2014 : 07:00:21 AM
Hello,

still the same problem, even with doc -e instead of doc -ef

This is how it looks like after running the script the first time:


And this is how it looks like after running the script a second time (maybe with this graph activated)


I cant really figure out a rule, which graphs are correctly formated in which run of the script.
Could it be a timing problem?

Best regards

ps. I figured out, that the number of graphs formatted correctly in the first script run strongly depends on the window which is active when the script is started. When the active window is the workbook, most (but not all) graphs are done correctly in the first script run ... strange
jasonzhao Posted - 12/17/2014 : 05:21:59 AM
Hello,

Please try to use doc -e p instead of doc -ef p,

Execute for all graph windows and layout windows in the project.


Best regards,
Jason Zhao
OriginLab Tech
Lars_de Posted - 12/17/2014 : 05:10:06 AM
Thanks for the fast answer.

No, my graphs are all located in the same folder and not in any subfolder.



Regards,
Lars
jasonzhao Posted - 12/17/2014 : 04:37:40 AM
Hello,

This problem may be due to the doc -ef works for current folder only, without subfolder, So Does your Graph window locates in several
sub-folder?
You can try the solution below:

  • Enter
    
    @per=1
    

    in commend window, click ENTER to execute.

  • Select View->View Mode->Result in Active Folder&Sub Folder in Origin menu

  • Now, you can see all graph in sub folder with parent folder active, please try to Execute your commend in parent folder again and check the results.



Best regards,
Jason Zhao
OriginLab Tech

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