#69089 - 2002-08-16 11:13 AM
Re: Read only a portion of a string
|
pommie
Fresh Scripter
Registered: 2002-02-01
Posts: 27
|
Hi again, Many thanks for your advice. My script has now grown and changed somewhat and appears to work fine on W2K machines but not Win95.
The portion of the script if open(1,$file) = 0 works ok on W2K, but on Win95 it always returns a 1 and ends the script??
I may get round to your previous advice once this bug is sorted, but these needs to be up and running for Monday morning
Any ideas??
I'm sure my script is not the most efficient in it's operation, as I'm new to this I had to pinch others work and piece it together, so if anyone else has any pointers I'd appreciate it.
Break on
select case @inwin = 2 ;? "This is a Win9x computer" $os=Win9x $value = ReadValue("HKEY_LOCAL_MACHINE\software\Symantec\Norton Antivirus\", "currentversion") $Tivolihome = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices\", "lcfd1") $file="$tivolihome\last.cfg" $string="lcfd_version" $found = 0
case @inwin = 1 and @dos = "4.0" ;? "this is an NT4 computer" $os=NT4 $NAVHome = ReadValue("HKEY_LOCAL_MACHINE\software\INTEL\LANDesk\VirusProtect6\CurrentVersion\", "Home Directory") $value = GetFileVersion($NAVHome +"\vpc32.exe","ProductVersion") $TivoliHome = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lcfd\", "run_dir") $file="$tivolihome\last.cfg" $string="lcfd_version" $found = 0 case @inwin = 1 and @dos = "5.0" ;? "this is a Windows 2000 computer" $os="WIN 2000" $NAVHome = ReadValue("HKEY_LOCAL_MACHINE\software\INTEL\LANDesk\VirusProtect6\CurrentVersion\", "Home Directory") $value = GetFileVersion($NAVHome +"\vpc32.exe","ProductVersion") $TivoliHome = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lcfd\", "run_dir") $file="$tivolihome\last.cfg" $string="lcfd_version" $found = 0
endselect
$filename='\\Servername\share\@wksta.csv' IF EXIST($filename) DEL $filename ENDIF
if open(1,$file) = 0 $line = readline(1) while @error = 0 if instr($line,$string) $found = 1 if $found = 1 goto data endif endif $line = readline(1) loop $q=close(1)
endif exit
:data If Open(5,"\\servername\share\@wksta.csv",5)=0 $RC=WriteLine(5,"Workstation, OS, User Name, IP Address, Domain Controller, Date, Time, NAV Version, Tivoli Ver"+Chr(13)+Chr(10)) $RC=WriteLine(5,"@WKSTA, $os, @USERID, @IPADDRESS0, @LSERVER, @DATE, @TIME, $value, $line") $RC=Close(5) EndIF
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 538 anonymous users online.
|
|
|