SoulBlade Posted August 30, 2009 Posted August 30, 2009 Hi! I'm trying to create a simple array but unfortunately my knowledge is lacking. In this script i try to output the list of installed disks from WMI to an array. Can anyone point me in the right direction? Thanks! dim $hds MsgBox(-1,"",$hds[1]) Func HD() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $Instances = $objWMIService.InstancesOf("Win32_DiskDrive") For $hd In $Instances $hds = ($hd.Model) Next EndFunc
Belfigor Posted August 30, 2009 Posted August 30, 2009 (edited) Dim $array[10] For $i = 0 To 9 Step 1 $array[$i] = $i Next MsgBox(0,'',$array[0]&","&$array[1]&","&$array[2]&"..."&$array[9]) dim a vairable as array 1st Edited August 30, 2009 by Belfigor [size="1"]My bear is so cute asleep in the closet, not even drinking vodka. My nuclear bomb name is Natasha.[/size]
notta Posted August 30, 2009 Posted August 30, 2009 #include <array.au3> dim $hds $hds = HD() _ArrayDisplay($hds) Func HD() Local $return[1], $i = 1 $return[0] = 0 $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $Instances = $objWMIService.InstancesOf("Win32_DiskDrive") For $hd In $Instances Redim $return[Ubound($return) + 1] $return[0] = $return[0] + 1 $return[$i] = $hd.Model $i += 1 Next Return $return EndFunc
SoulBlade Posted August 30, 2009 Author Posted August 30, 2009 (edited) Thanks you very much for your answers! I'll will try to improve my knowledge on arrays. Edited August 30, 2009 by SoulBlade
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now