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
 string::GetNumTokens?!
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Moritz.Kurka

Germany
11 Posts

Posted - 03/02/2009 :  10:40:08 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

cpyang

USA
1406 Posts

Posted - 03/03/2009 :  07:32:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Could you first update to SR4 and see if you still have such problem?

CP
Go to Top of Page

Moritz.Kurka

Germany
11 Posts

Posted - 03/04/2009 :  01:48:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I did, but unfortunately the result is still the same.
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 03/04/2009 :  07:33:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Moritz.Kurka

Germany
11 Posts

Posted - 03/06/2009 :  02:30:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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";

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 03/08/2009 :  09:31:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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