Jump to content

Sarg

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Sarg

  1. After much experimentation, I discovered that I could read from an array with a string reference like so: CODE Const $num_PCs = 13 Const $num_attrs = 12 Const $IPAddr = 3 Const $SubMask = 4 Const $DefGate = 5 ... ... ... Func qr ( $sArrayName, Const $iElement ) ; this is the function in question, qr for Quick Read, takes a string and an index Local $iTrueElement If IsNumber($iElement) Then ; if iElement is really an index ... Return Execute("$avPC_" & $sArrayName & "[" & $iElement &"]") ; ... then read the value and return it Else $iTrueElement = Execute("$" & $iElement) ; otherwise convert it to an index by using the constants Return Execute("$avPC_" & $sArrayName & "[" & $iTrueElement &"]") ; ... and read/return that EndIf EndFunc ... ... ... Dim $avPC_List [$num_PCs] = ["ttinsley","knguyen","jsmith","bwendall","tamhearst","wfarmer","sbrindal","jwerner","hfelton","vtucker","melder","aricker","dashmore"] Dim $avPC_ttinsley [$num_attrs] = ["ttinsley","MG97F3","Indianapolis","10.125.24.51","255.255.254.0","10.125.24.1","Win2k3",1494,"c:\vpnclient\corp_primary.pcf",1,0,0] ... ... ... Local $sActive_PC = "" ... For $sPCCounter in $avPC_List ; Loop through the list of PC, by username $sActive_PC = qr($sPCCounter,"IPAddr") ; set sActive_PC to the IP Address located in the PC's array ... ... ... This works well. However, the same can not be said for the function to alter the information in the array! No matter what I try, it just refuses to set. I managed to get it to store "$avPC_bwendall[11] = 2" in a variable named $setthis (my frustration is showing!) but even Execute($setthis) isn't doing anything. Anyone able to lend a hand?
×
×
  • Create New...