Page 1 of 1 1
Topic Options
#156344 - 2006-01-31 09:37 PM help with array...
emw1972 Offline
Fresh Scripter

Registered: 2004-03-09
Posts: 26
Loc: Lincoln, Nebraska
Hello!

I'm trying to populate all the installed updates\hotfixes into an array. The error I receive is "this type of array not supported in expressions". I really don't know what the problem is; I'm sure it's something simple.

Below is my code; any guidance would be much appreciated!

Code:
  
Dim $HotfixesKey, $intCount, $Hotfixes
Dim $HotfixesArray [500]
$intCount = 0
Select
Case @PRODUCTTYPE = "Windows XP Professional"
$HotfixesKey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP3'
Case @PRODUCTTYPE = "Windows 2000 Professional"
$HotfixesKey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5'
Case @PRODUCTTYPE = "Windows Server 2003"
$Hotfixeskey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows Server 2003\SP2'
Case @PRODUCTTYPE = "Windows 2000 Server"
$Hotfixeskey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5'
EndSelect
$Hotfixes = EnumKey($HotfixesKey, $intCount)
$HotfixArray ($intCount) = $Hotfixes
While @ERROR = 0
;MessageBox ($Hotfixes,"TEST",4160)
$intCount = $intCount + 1
$Hotfixes= EnumKey($HotfixesKey, $intCount)
$HotfixArray ($intCount) = $Hotfixes
Loop


Top
#156345 - 2006-01-31 09:40 PM Re: help with array...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
() is not kixtart array syntax.
this will work:
$HotfixArray[$intCount] = $Hotfixes
_________________________
!

download KiXnet

Top
#156346 - 2006-01-31 09:47 PM Re: help with array...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Seems he knew that square brackets were needed on this line:
Dim $HotfixesArray [500]

but if you look at the array var closely, they are spelled different so it isn't even DIMmed.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#156347 - 2006-02-01 12:55 AM Re: help with array...
emw1972 Offline
Fresh Scripter

Registered: 2004-03-09
Posts: 26
Loc: Lincoln, Nebraska
I appreciate your responses. My issue was with not using square brackets and not using the correct name of the array; I guess that is what I get for using notepad! You have no idea how long I spent looking at this code trying to figure out what was wrong... That's just the way it goes sometimes!

How can I view the entire contents of the array after it has been populated? Will a simple messagebox do the trick?

Thank you.

Top
#156348 - 2006-02-01 01:07 AM Re: help with array...
emw1972 Offline
Fresh Scripter

Registered: 2004-03-09
Posts: 26
Loc: Lincoln, Nebraska
I answered my own question with the following command...

$HotfixList = JOIN($HotfixArray," ")

Thank you!

Top
#156349 - 2006-02-01 01:16 AM Re: help with array...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You can avoid a lot of pain by using SetOption('Explicit','On')
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#156350 - 2006-02-01 01:18 AM Re: help with array...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
lol.
les, I don't think so.
the line you gave will produce more pain
_________________________
!

download KiXnet

Top
#156351 - 2006-02-01 01:19 AM Re: help with array...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I fixed the typo
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#156352 - 2006-02-01 03:01 AM Re: help with array...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
fantastic.
_________________________
!

download KiXnet

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 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.034 seconds in which 0.016 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