T O P I C R E V I E W |
cqy2016 |
Posted - 08/18/2016 : 06:52:41 AM Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015 Operating System:WIN 7 Hi,
We have a problem with the Graph Title. We have all datas from different DUTs imported into different sheets, and the names we want to use are part of the long names of each sheets. We actually want to use the first 20 Characters including _ as Graphic title, and use 8 Characters from the middle of long names as layer title.(each graph has 18 layers). Currently we use a combination of labtalk and template to create our graph, and in the template we used %(1,@WS) to use the sheet name. However, is there anyway we could trim it?
Looking forward to your reply.
Thanks and best regards!
CQY |
7 L A T E S T R E P L I E S (Newest First) |
cqy2016 |
Posted - 08/23/2016 : 08:50:57 AM quote: Originally posted by yuki_wu
Hi CQY,
layer.namemode = 0;
//0 = Show Long Name if available, 1 = Short Name(default), 2 = Long Name
This property of layer can determines how sheet name should display. More detailed can be found on this page: http://www.originlab.com/doc/LabTalk/ref/Layer-obj
Yuki OriginLab
Hi Yuki,
Yep, it works perfectly. Thanks again.
Best regards!
CQY |
yuki_wu |
Posted - 08/23/2016 : 03:28:40 AM Hi CQY,
layer.namemode = 0;
//0 = Show Long Name if available, 1 = Short Name(default), 2 = Long Name
This property of layer can determines how sheet name should display. More detailed can be found on this page: http://www.originlab.com/doc/LabTalk/ref/Layer-obj
Yuki OriginLab |
cqy2016 |
Posted - 08/22/2016 : 04:35:31 AM Hi Yuki,
Good day. Do you also know the labtalk code to let all worksheets in a workbook to show long name? Like currently what i do is right click on a worksheet, then select show and then select "long name if available", however, sometimes i have 16 or more worksheets in one workbook, is there a way to do this automatically?
Regards!
CQY |
cqy2016 |
Posted - 08/19/2016 : 06:42:07 AM quote: Originally posted by yuki_wu
Hi CQY,
I think you can try the scripts as follow:
str$ = %(1,@W); //Get the name of the first worksheet
%A = str.left(3)$; // Extract the first 3 characters from the worksheet name
label -s %A; //Place a new label on a graph
Yuki OriginLab
Hi Yuki,
Everything works now perfectly, thanks a lot. Wish you a nice weekend!
Best regards!
CQY |
yuki_wu |
Posted - 08/19/2016 : 05:37:52 AM Hi CQY,
I think you can try the scripts as follow:
str$ = %(1,@W); //Get the name of the first worksheet
%A = str.left(3)$; // Extract the first 3 characters from the worksheet name
label -s %A; //Place a new label on a graph
Yuki OriginLab
|
cqy2016 |
Posted - 08/19/2016 : 03:10:55 AM quote: Originally posted by yuki_wu
Hi CQY,
You can extract the first nCount characters from a string by String::Left. http://www.originlab.com/doc/LabTalk/ref/String-obj#Left
You can also extract a substring of length nCount characters starting at position nFirst from a string by Strting:Mid. http://www.originlab.com/doc/LabTalk/ref/String-obj#Mid
Hope it helps.
Yuki OriginLab
Hi Yuki,
Thanks for the reply,i think the way of trimming a string could work. At the same time our problem was also, how to get the string from the worksheet short name, and how to put it as a label into our graph. For example, if we use in the template %(1,@WS) in script, and give the value to a string variable it won't work. For example, if we use: string str1$=%(1,@WS) will it work? And for using the trimmed string as a label, could you give an example? Currently we use something like : label -a (-600) 731 \p200(xxx) Could you tell us which formular should we put in xxx?
Thanks and best regards!
CQY |
yuki_wu |
Posted - 08/19/2016 : 01:33:33 AM Hi CQY,
You can extract the first nCount characters from a string by String::Left. http://www.originlab.com/doc/LabTalk/ref/String-obj#Left
You can also extract a substring of length nCount characters starting at position nFirst from a string by Strting:Mid. http://www.originlab.com/doc/LabTalk/ref/String-obj#Mid
Hope it helps.
Yuki OriginLab
|
|
|