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
 Loop Works in Script Window but not Worksheet Scri

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
jsw Posted - 10/11/2002 : 3:29:10 PM
The following script works in a script window, but not in a worksheet script window. It is a slight modification of a script in the Knowledge Base.

%Z="";
jjmax= %[%F]; ; // Null out resultant string
loop(jj,1,jjmax) { // Loop for each character in %A
if(%[%F,jj:jj]=="\") %Z=%Z\\ // if char=\ replace with \ else %Z=%Z%[%F,jj:jj]; // if char!=\ keep char

};
type %[%F] $(jj) $(jjmax);

In a Script Window I get the following result typed:
54 55 54
Here Origin goes through the loop 54 times.

In a Worksheet Script Window I get the following:
54 1 54
In the Worksheet Script Window the loop only goes through once, even though my minimum and maximum values are 1 and 54.

Any idea how to fix? I am using Origin 6.1 with Patch 4.

Ultimately, I want to copy the label from a worksheet such as, "c:\mydocs\origin\data1.txt" and write it as a label on a graph. When I write the label on the graph it interprets each "\" as a delimiter and formats the text in a funny way. The above routine replaces each "\" by "\\" which then prints as "\" in the graph label.

Thanks,
Joe
3   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 10/15/2002 : 08:57:32 AM
You should put script into ogs file and call them from your worksheet script, like

run.section(%YmyScript.ogs,main)

or put script into buttons and execute them from the Worksheet Script, like

text.run();

The Worksheet Script dialog executes LabTalk line by line in the old days to avoid ';' and thus will have problem with multi-lined scripts.

CP



jsw Posted - 10/14/2002 : 09:53:51 AM
I never was able to get the script to work, even with taking out that extra semicolon. I had originally tried using %[%F] directly in the loop command and that did not work either.

\v( ) did do what I need however.

Thanks,
Joe
Mike Buess Posted - 10/11/2002 : 5:21:35 PM
Hi Joe,

There's an escape sequence that's not well documented but will work for what you want to do. Try this...

%T=c:\mydocs\origin\data1.txt;
label -s \v(%T);

Hope that helps.

...As for your script, if the double semicolon in this line

jjmax= %[%F]; ; // Null out resultant string

is really there (and not just added to your post by mistake), then it might be causing your problems.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/11/2002 7:22:55 PM

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