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
 doc -e loop and graph label formatting error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Lars_de

Germany
3 Posts

Posted - 12/17/2014 :  04:03:19 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

jasonzhao

China
262 Posts

Posted - 12/17/2014 :  04:37:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - jasonzhao on 12/17/2014 04:58:22 AM
Go to Top of Page

Lars_de

Germany
3 Posts

Posted - 12/17/2014 :  05:10:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the fast answer.

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



Regards,
Lars
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 12/17/2014 :  05:21:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - jasonzhao on 12/17/2014 05:22:45 AM
Go to Top of Page

Lars_de

Germany
3 Posts

Posted - 12/17/2014 :  07:00:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - Lars_de on 12/17/2014 07:26:22 AM
Go to Top of Page

cdrozdowski111

USA
247 Posts

Posted - 12/17/2014 :  8:50:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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