Page 1 of 1 1
Topic Options
#5086 - 2000-11-14 04:49 PM Get Office ver on list of workstations
CLPowell Offline
Getting the hang of it

Registered: 2000-05-08
Posts: 59
Loc: San Angelo, Texas, USA 76903
After two days or butting my head aginst the monitor I turn to the Kix Guru's for help.

Problem:
I have combined 2 seperate scripts trying to get the MS office version on a wrks from a text file of wrks names. It will run and create the desired text file but with the incorrect content (it lists the wrks name but the ver of MS office on the local wrks is listed for each wrks).

The code:
================================

Break on CLS
$input = "%0\..\wrksta.txt"
$output = "%0\..\msover.txt"IF OPEN(1,$input,2) = 0
IF OPEN(2,$output,5) = 0
ELSE
?" There is something wrong !!!"
GOTO END
ENDIF
$Wrksta = ReadLine(1)
WHILE @error = 0

IF @error = 0
$dir=readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe","Path")
if exist("$dir"+"\excel.exe")
$excel=getfileversion("$dir"+"\excel.exe")
select
case $excel=8.0a
$esr="97 SR-1"
case $excel=8.0e
$esr="97 SR-2"
case $excel=9.0.2719
$esr="2000"
case $excel=9.0.3822
$esr="2000 SR-1a"
endselect
$nul = WriteLine(2,$Wrksta + "MS Office Ver is " + $esr + chr(13) +chr(10))
endif
ELSE
$nul = WriteLine(2,$Wrksta + " Not online" + chr(13) +chr(10))
ENDIF
$Wrksta = ReadLine(1)
LOOP
ELSE
?"Wrksta.txt not available!"
EXIT
ENDIF
$nul = Close(2)
:END
$nul = Close(1)
EXIT

------------------

_________________________
Chris Powell
Fire Technology Manager

Top
#5087 - 2000-11-14 07:35 PM Re: Get Office ver on list of workstations
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
just did a quick onceover... and it looks like you are missing a ENDIF somewhere...

So... just by eyeballing it.... I made the folllowing changes. (i haven't ran this!!! don't know if it works)

things i changed

1. remmoved the line if @error = 0, i think this was the missing ENDIF

2. Changed the WHILE...LOOP to a DO...UNTIL.

code:

Break on CLS
$input = "%0\..\wrksta.txt"
$output = "%0\..\msover.txt"

IF OPEN(1,$input,2) = 0
IF OPEN(2,$output,5) <> 0
?" There is something wrong !!!"
GOTO END
ENDIF

$Wrksta = ReadLine(1)
do
$dir=readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe","Path")
if exist("$dir"+"\excel.exe")
$excel=getfileversion("$dir"+"\excel.exe")
select
case $excel=8.0a
$esr="97 SR-1"
case $excel=8.0e
$esr="97 SR-2"
case $excel=9.0.2719
$esr="2000"
case $excel=9.0.3822
$esr="2000 SR-1a"
endselect
$nul = WriteLine(2,$Wrksta + "MS Office Ver is " + $esr + chr(13) +chr(10))
endif
ELSE
$nul = WriteLine(2,$Wrksta + " Not online" + chr(13) +chr(10))
ENDIF
$Wrksta = ReadLine(1)
until @error <> 0
ELSE
?"Wrksta.txt not available!"
EXIT
ENDIF

$nul = Close(2)
:END
$nul = Close(1)
EXIT


Bryce

Top
#5088 - 2000-11-14 07:55 PM Re: Get Office ver on list of workstations
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I think you need to specify remote access in your readvalue() function, like this ...

$dir=readvalue("\\$WRKSTA\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe","Path")

Shawn.

[This message has been edited by Shawn (edited 14 November 2000).]

Top
#5089 - 2000-11-14 11:18 PM Re: Get Office ver on list of workstations
CLPowell Offline
Getting the hang of it

Registered: 2000-05-08
Posts: 59
Loc: San Angelo, Texas, USA 76903
Bryce - yours did not work...

Shawn - yours did thanks...

------------------

_________________________
Chris Powell
Fire Technology Manager

Top
Page 1 of 1 1


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

Who's Online
0 registered and 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.046 seconds in which 0.023 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