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
 Many problems
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

66de250

China
24 Posts

Posted - 11/12/2024 :  06:13:17 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Edited by - 66de250 on 11/12/2024 07:26:59 AM

YimingChen

1607 Posts

Posted - 11/14/2024 :  10:16:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

YimingChen

1607 Posts

Posted - 11/14/2024 :  10:22:54 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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