Page 1 of 1 1
Topic Options
#48087 - 1999-08-25 09:47 AM open, read and put comment on line in a file
Anonymous
Unregistered


Can you use kixtart script to open a file such as system.ini , read a line then put a ";" at the begin of a line so that line will not execute ? I have tried most of the commands but it does not seem to work. Please be advice. thanks
henry

Top
#48088 - 1999-08-25 10:15 PM Re: open, read and put comment on line in a file
Anonymous
Unregistered


Hi,

I'm sure you could come up with something based on readprofilestring() and writeprofilestring(), for an .ini file with standard windows sections.

Are you dealing strictly with Win31-style .ini files? Or text files in general?

-Harold

Top
#48089 - 1999-08-26 05:57 AM Re: open, read and put comment on line in a file
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
Try to modify this script: it will remove any vshare.386 and rename it *vshare, and remove unneeded entries of a specific DLL (vdcfd.386)
code:

$FlagTiv=0
$FlagVsh=0
$EOL=Chr(13)+Chr(10)
Copy "%WINDIR%\SYSTEM.INI" "%WINDIR%\SYSTEM.BAK"
Open(1,"%WINDIR%\SYSTEM.INI",2)
Del "%WINDIR%\SYSTEM.NEW"
Open(2,"%WINDIR%\SYSTEM.NEW",5)
Do
$LineIn=ReadLine(1)
$LineOut=$LineIn+$EOL
$Change=0
If $LineIn=""
$EndLine=$EndLine+1
If $EndLine<2
WriteLine(2,$LineOut)
EndIf
Else
$EndLine=0
If InStr(UCase($LineIn),"VDCFD95.386")>0
$LineOut="device=vdcfd95.386"+$EOL
$FlagTiv=$FlagTiv+1
$Change=2
EndIf
If InStr(UCase($LineIn),"VSHARE")>0
$FlagVsh=$FlagVsh+1
$LineOut="device=*vshare"+$EOL
$Change=3
EndIf
If $FlagTiv>1 And $Change=2
$LineOut=""
EndIf
If $FlagVsh>1 And $Change=3
$LineOut=""
EndIf
WriteLine(2,$LineOut)
EndIf
Until $EndLine=10

Close(1)
Close(2)
Del "%WINDIR%\SYSTEM.INI"
Copy "%WINDIR%\SYSTEM.NEW" "%WINDIR%\SYSTEM.INI"
Del "%WINDIR%\SYSTEM.TIV"


Top
#48090 - 1999-08-26 05:59 AM Re: open, read and put comment on line in a file
Flavien Offline
Getting the hang of it

Registered: 1999-07-21
Posts: 95
Loc: Geneva, Switzerland
Oops sorry, the last line should read:
code:

Del "%WINDIR%\SYSTEM.NEW"


Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1927 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.054 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org