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
 Thread handling in Origin

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
smith.panther Posted - 03/31/2013 : 08:01:09 AM
Origin Ver. and Service Release (Select Help-->About Origin): 8.6.0G Sr3 b99
Operating System: Win 7

Hi,

I have a strange problem with my script and I hope somebody can help me to solve it or tell me a workaround. In principle, I want to import files, copy some of the imported columns to a template (.otw file) which performs some calcualtions and access the processed data for further calcualtions.
Here is an excerpt of my script:

string path;
path$ = "d:\Test\testsheet\";
findFiles e:="*.dat";
impfile location:=data fi:="d:\test\testsheet\templates\import.oif";

win -t wks "d:\Test\testsheet\templates\mobility_sat.otw" "MobilitySat";
colcopy irng:=[Book7]1!Col(1:2) orng:=[mobilitysat]1!Col(1:2);
csetvalue col:=[mobilitysat]1!Col(4) formula:=die*1e-7;
csetvalue col:=[mobilitysat]1!Col(5) formula:=eps;
csetvalue col:=[mobilitysat]1!Col(3) formula:=1/wl;

range r1 = [mobilitysat]1!Col(9);
win -t wks "d:\test\testsheet\templates\mobility.otw" "Mobility";
csetvalue col:=[mobility]1!Col(11)[1:1] formula:="r1[51]";

The script finds and imports the files as intended. It also copies the specified columns to "mobility_sat.otw" but afterwards it opens the next template "mobility.otw" without processing the pending calculations in the "mobility_sat.otw". Only after it has opened "mobility.otw" it starts to calculate the column operations in "mobility_sat.otw". But "mobility.otw" already tries to access the data by range variable from "mobilitysat" book when it opens and of course it is not defined at this moment because the calculations were not performed yet.
I thought that Labtalk executes the script line by line but obviously this is not the case. Is there any thread handling or priorisation within Origin script execution? E.g. it tries to execute the less computation-intensive operations first and the calculations last?

I have also tried to use sections within the script but it does not change anything. It waits e.g. 10 seconds than opens the "mobility.otw" and once again calculates the "mobility_sat.otw" as the last operation.

[main]
run.section( , section1);
run.section( , section2);
sec -p 10;
run.section( , section3);

[section1]
string path;
path$ = "d:\Test\testsheet\";
findFiles e:="*.dat";
impfile location:=data fi:="d:\test\testsheet\templates\import.oif";

[section2]
win -t wks "d:\Test\testsheet\templates\mobility_sat.otw" "MobilitySat";
colcopy irng:=[Book7]1!Col(1:2) orng:=[mobilitysat]1!Col(1:2);
csetvalue col:=[mobilitysat]1!Col(4) formula:=die*1e-7;
csetvalue col:=[mobilitysat]1!Col(5) formula:=eps;
csetvalue col:=[mobilitysat]1!Col(3) formula:=1/wl;

[section3]
range r1 = [mobilitysat]1!Col(9);
win -t wks "d:\test\testsheet\templates\mobility.otw" "Mobility";
csetvalue col:=[mobility]1!Col(11)[1:1] formula:="r1[51]";

Can somebody help me and tell me what I am doing wrong? How I can access and handle the data, which is first to be calculated by a template? Thank you very much in advance!

Smith.Panther
2   L A T E S T    R E P L I E S    (Newest First)
smith.panther Posted - 04/02/2013 : 07:04:10 AM
Thank you very much! The command "run -p au" does exactly what I was looking for. Now it seems to work perfectly and calculates the pending operations before openening the next template.
Kathy_Wang Posted - 04/01/2013 : 04:49:01 AM
Hi,

Not sure what your workbook template looks like, but according to your description, you may try the command run -p au; which will update all pending operations including operations with Recalculate set to Manual before executing the next line.

So parts of your script may be modified to:

win -t wks "d:\Test\testsheet\templates\mobility_sat.otw" "MobilitySat";
colcopy irng:=[Book7]1!Col(1:2) orng:=[mobilitysat]1!Col(1:2);
csetvalue col:=[mobilitysat]1!Col(4) formula:=die*1e-7;
csetvalue col:=[mobilitysat]1!Col(5) formula:=eps;
csetvalue col:=[mobilitysat]1!Col(3) formula:=1/wl;
run -p au;
range r1 = [mobilitysat]1!Col(9);
win -t wks "d:\test\testsheet\templates\mobility.otw" "Mobility";
csetvalue col:=[mobility]1!Col(11)[1:1] formula:="r1[51]";


BTW, it's also important to make sure the recalculation mode of all operations are set to "Auto" instead of "Manual".

If this doesn't solve your problem, perhaps it's better to share your template with us, so that we could further investigate. To do this, click the Send Files to Tech support link at the right-top corner of the forum main page.

Kathy
Originlab

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