T O P I C R E V I E W |
surjpanj |
Posted - 03/01/2016 : 03:31:49 AM Origin Ver. and Service Release (Select Help-->About Origin): 2015 Operating System: Win 7
Hi,
I want to write script for renaming worksheets in particular workbook. For example, I have 14 worksheets that I want to name as 0, 3, 6, 9,......
I tried following script but it doesn't work ii=0; doc -ef LW{ wks.name$ = ii*3; ii++;}
Similar, I want to rename graphs, i.e., instead of Graph1, Graph2, Graph3,etc...I would like to have G0, G3, G9, etc... Any ideas how to make this work?
Thanks, Matt |
6 L A T E S T R E P L I E S (Newest First) |
Hideo Fujii |
Posted - 03/28/2016 : 10:04:48 AM Hi Matt,
To access the longname of the window, you can use the page.longname$ object property like:ii=0;
doc -e P{
ii++;
%H!page.longname$=G$(ii*3); //%H holds current window name
} See the details at: http://www.originlab.com/doc/LabTalk/ref/Page-obj
--Hideo Fujii OriginLab |
surjpanj |
Posted - 03/23/2016 : 07:47:08 AM Hi Jason and Hideo,
the script only renames short name of graphs. How can I make the same for the long name?
Thanks, Matt |
Hideo Fujii |
Posted - 03/01/2016 : 09:45:43 AM Hi Matt,
You can use Doc -ef command instead of Doc -e command to loop over limited within the current folder: http://www.originlab.com/doc/LabTalk/ref/Document-cmd#-ef.3B_Execute_the_given_script_for_all_objects_in_the_current_folder
To change the current folder to other location, you can use pe_cd x-function to navigate: http://www.originlab.com/doc/X-Function/ref/pe_cd
Hope this helps.
--Hideo Fujii OriginLab |
surjpanj |
Posted - 03/01/2016 : 04:59:00 AM Hey Jason,
I have little problem with renaming graphs. The script renames all graphs in the project. I want to rename only graphs in one subdirectory.
Matt |
surjpanj |
Posted - 03/01/2016 : 04:47:18 AM Great, it works! I should have remembered to put in the $ sign.
Thanks, Matt |
jasonzhao |
Posted - 03/01/2016 : 04:25:44 AM Hello,
To renaming worksheets in current book, please run script below:
ii=0;
doc -ef LW{
wks.name$ = $(ii*3);
ii++;}
if you want to rename all graph window with G0,3.., you can use script below:
doc -e p
{
strn$=$(ii*3);
str$="G"+strn$;
win -r %H %(str$);
ii++;
}
Best regards! Jason OriginLab Technical Service |
|
|