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
 string::GetNumTokens?!

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
Moritz.Kurka Posted - 03/02/2009 : 10:40:08 PM
Hello everyone,
I'm trying to import some files with a script using the impasc-function. Most of that is just copied from an example and slightly adjusted.


 string fns_lowInt$;
 string search$ = RareGas$+"*.txt";
 findfiles fname:=fns_lowInt$ ext:=search$ path:=path_LowInt$;

 int nfiles_lowInt = fns_lowInt.GetNumTokens(CRLF);

 type fns_lowInt$;
 type "nfiles_lowInt = $(nfiles_lowInt)";


the output looks sth like this
G:\lowInt\MirrorHeight\Ar_MirHGT_SbS.txt
G:\lowInt\MirrorHeight\Ar_MirHGT_Ar2P.txt
G:\lowInt\MirrorHeight\Ar_MirHGT_Ar3P.txt
nfiles_lowInt = 0

If I understand it correctly then he just prints the filenames he finds into the string "fns_lowInt$" and seperates each filename by a CRLF. So i would assume that GetNumTokens on the same string should give me the number of files?! But in my case he returns 0...

Any suggestions. Or did i just miss sth.?
Thank you for help
Moritz

PS: I should mention that the strings RareGas$ and path_LowInt$ are set globally before the execution command of the section






Origin Ver.8 SR1
Operating System: Vista
5   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 03/08/2009 : 09:31:26 AM
I simply copy paste that code into script window and highlight all the code and hit enter.

So looks like there is something different on your computer.

CP
Moritz.Kurka Posted - 03/06/2009 : 02:30:18 AM
That's strange?! Because if i take your few lines of code i still get nfiles_lowInt = 0!

Did you take the string as it is or did you artificially insert CRLF's
like: str$="line1%(CRLF)line2%(CRLF)line3";

cpyang Posted - 03/04/2009 : 07:33:38 AM
if I take your string to do the following:

fns_lowInt$=G:\lowInt\MirrorHeight\Ar_MirHGT_SbS.txt
G:\lowInt\MirrorHeight\Ar_MirHGT_Ar2P.txt
G:\lowInt\MirrorHeight\Ar_MirHGT_Ar3P.txt;
int nfiles_lowInt = fns_lowInt.GetNumTokens(CRLF);
type "nfiles_lowInt = $(nfiles_lowInt)";


I got

nfiles_lowInt = 3

so maybe you can try different folders/files and see if it works in any other places?

CP
Moritz.Kurka Posted - 03/04/2009 : 01:48:54 AM
I did, but unfortunately the result is still the same.
cpyang Posted - 03/03/2009 : 07:32:37 AM
Could you first update to SR4 and see if you still have such problem?

CP

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