N00NchieS
(Fresh Scripter)
2002-09-26 11:18 AM
Readline Query

Hey Guys,

I am pretty new to Kix, here`s my problem. I have a text file within which is a list of computer names on the network which i piped from net view, what i want to do with this is have ReadLine read each line one after another in some sort of loop so that it returns each line of text one after another from the textfile in order, just can`t seem to get my head round this one i`m afraid... doh any help is greatly appreciated ta!


LonkeroAdministrator
(KiX Master Guru)
2002-09-26 11:40 AM
Re: Readline Query

see these manual links:
open()
readline()

and once you get there (they are the same as in kixtart-manual) read them.

there is simple already made script just for what you are asking.

 


Richard H.Administrator
(KiX Supporter)
2002-09-26 11:41 AM
Re: Readline Query

The example in the manual does exactly what you are asking for:
code:
IF Open(3, @LDRIVE + "\CONFIG\SETTINGS.INI")  = 0
$x = ReadLine(3)
WHILE @ERROR = 0
? "Line read: [" + $x + "]"
$x = ReadLine(3)
LOOP
Close (3)
ELSE
BEEP
? "Config file not opened, error code: [" + @ERROR + "]"
ENDIF

Or have I misunderstood your query?


Schuliebug
(Hey THIS is FUN)
2002-09-26 11:42 AM
Re: Readline Query

It's in the manual:

code:
If Open(1,$file)=0
$Line=ReadLine(1)
$ReadError=@Error

While $ReadError=0
? $Line

$Line=ReadLine(1)
$ReadError=@ERROR
Loop

$=Close(1)
EndIf

Oops, too late [Wink]

[ 26. September 2002, 11:43: Message edited by: Schuliebug ]


LonkeroAdministrator
(KiX Master Guru)
2002-09-26 11:43 AM
Re: Readline Query

 

me fastest!

 


Schuliebug
(Hey THIS is FUN)
2002-09-26 11:44 AM
Re: Readline Query

Lonkero's the greatest [Smile] [Smile]

N00NchieS
(Fresh Scripter)
2002-09-26 11:56 AM
Re: Readline Query

Hehe doh guess i`m just havin a bad day huh looked at that chm page like 20 times... simple case of RTFM ... oh well cheers for your help neways guyz ... N00NchieS = Oficially blind

Richard H.Administrator
(KiX Supporter)
2002-09-27 12:12 AM
Re: Readline Query

N00NchieS,
Don't worry. If you posted it in one of the other forums you might have got stomped on, but we're more gentle in Starters. The first time, anyway [Wink]

PS, Welcome to the board.

PPS, "N00NchieS" - crazy monicker!


N00NchieS
(Fresh Scripter)
2002-09-27 12:25 AM
Re: Readline Query

Cheers,

I knew i had prob done somethin stupid so thas y i posted it in the starters forum.. as i say today i feel like a bit of a badger... expect less silliness in future [Razz] ...END OF LINE...