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
 passing argument to script file

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
sjwu77 Posted - 11/28/2004 : 03:48:25 AM
Hi there,

I'm confused by this problem:

I tried to call a script and pass a number (say, 3) to the file, as

run.section(myScript,Main,3);

In my Script, 3 is used to make the name of a worksheet
[Main]
...
%I=data$(%1);
...

Then some data manipulation is performed. Everything seems to be fine.

Now I try to run the scripts with a sequence of numbers as argument:

for (num=1;num<=10;num++) {run.section(myScript,Main,num);}

The labTalk seems always perform the last one, e.g., num=10, and do nothing to num from 1 to 9...

Could anyone help me to figure out any possible problem here?

Thanks a lot

Saijun
4   L A T E S T    R E P L I E S    (Newest First)
sjwu77 Posted - 11/29/2004 : 1:16:25 PM
all right. I never thought of ";"
It works now
thanks a lot Mike
Mike Buess Posted - 11/29/2004 : 08:40:04 AM
An extra semicolon is delaying execution...

curve.data$=%(%I,2); ;

Remove the 2nd semicolon and your script will work fine.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 11/29/2004 08:58:09 AM
sjwu77 Posted - 11/28/2004 : 3:19:03 PM
Hi Mike,

Here is my subroutine:

myScript.ogs
//////////////////////////////////////////////////////
[Main]

pts=50;
curve.reset();
curve.smoothleftpts=pts;
curve.smoothrightpts=pts;
curve.smoothpts=2*pts+1;
%I=data$(%1);
type %I; // I add this line as you suggested
curve.x$=%(%I,1);
curve.data$=%(%I,2); ;
curve.result$=%(%I,3);
curve.adjave();
sum(%(%I,3));
return;

/////////////////////////////////////////////////////////
run.section(myScript,Main,1)
gives
data1
and correct data smoothing as I expected

When I run
for (num=1;num<=3;num++) {run.section(myScript,Main,num)
gives:
data1
data2
data3
However, the data smoothing only happen at the worksheet "data3"!

If, I manually input
run.section(myScript,Main,1) and run
run.section(myScript,Main,2) and run
run.section(myScript,Main,3) and run
The data1,2,3 are smoothed accordingly.

If, However, I select the three line altogether and run at once, same thing happens as when I use the for loop...

Any further suggestion? Thanks a lot





Mike Buess Posted - 11/28/2004 : 08:20:32 AM
Hi Saijun,

The problem must lie in your [Main] scripts. To verify, change them to this...

[Main]
type $(%1);
return;
...

I will be very surprised if you don't see this...

for (num=1;num<=10;num++) {run.section(myScript,Main,num);}
1
2
...
9
10

Mike Buess
Origin WebRing Member

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