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
 Many problems

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
66de250 Posted - 11/12/2024 : 06:13:17 AM
Dear Sir, I have encountered many problems with data processing using LabTalk scripting language these days, as follows:
1. I run the following code:
string opj1$ = "F:\\gain_1.opj";
string opj2$ = "F:\\gain_2.opj";
int opj_num = 2;
StringArray opj;
opj.setsize(opj_num);
for(int index=1; index<=opj.getsize(); index++)
opj.SetAtGrow(index, opj$(index)$);
for(int opj_index=1; opj_index<=opj_num; opj_index++){
string temp$ = opj.GetAt(opj_index+1)$;
temp$=;
}
The following error occurs:
F:\\gain_2.opj
opj.GetAt(opj_index+1)$
string expression error!
TEMP:failed to add variable to local stack!
#Command Error!
Although temp$was successfully assigned, an error was reported. How to eliminate the error?
2. After using the command 'spectrum -i', how to use the current image as a reflection of the new color scale? Because the color scale created with this command are not related to the line color in my chart. In addition, how to set the color scale to show only the maximum and minimum values?
3. How do I draw an arrow between two points in an image and set properties such as its width and color?
4. How to attach all workbooks in the root folder of another project file (which has only one root folder and no subfolders) to the root folder of the current project (which has only one root folder and no subfolders) without creating a new subfolder. Since I found when using doc-a that my colleague's origin creates a new subfolder and mine does not (both versions are 2021), I used the doc-afa command without any reaction in my origin. Here's my code:
string opj1$ ="F:\\gain_1.opj";
string opj2$ = "F:\\gain_2.opj";
int opj_num = 2;
StringArray opj;
opj.setsize(opj_num);
for(int index=1; index<=opj.getsize(); index++)
opj.SetAtGrow(index, opj$(index)$);for(int opj_index=1; opj_index<=opj_num; opj_index++){
if(opj_index>1){
string temp$;
temp.insert(0, opj.GetAt(opj_index)$);
//doc -afa %(temp$);
//doc -afa %(opj.GetAt(opj_index)$);
doc -afa %(temp$) %(temp.getfilename(1)$);
}
}
Can you give me a specific LabTalk code? Thank you very much, I wish you a long and healthy life and everything goes well.
2   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 11/14/2024 : 10:22:54 PM
Please refer to this video on generating Labtalk script from mini toolbar buttons, it also works for toolbar buttons. e.g. Ctrl + Shift + Add Colorscale button.
https://www.originlab.com/videos/details.aspx?id=578

James
YimingChen Posted - 11/14/2024 : 10:16:01 PM
1.
string temp$ = opj.GetAt(opj_index+1)$; ==> string temp$ = opj.GetAt(opj_index)$;

2.
Spectrum -s;
SPECTRUM1.LEVELS.MAJOR=4;

3.
GObject myLine = line1;
draw -n myLine -lm {1,2,3,4};
line1.Color=2;
line1.linewidth=2;
line1.ARROWENDSHAPE=3;

4.
According to the doc below, you cannot append root folder to the current project.
https://www.originlab.com/doc/en/LabTalk/ref/Document_Options_to_Append#-afa

James

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