gcue Posted April 14, 2009 Share Posted April 14, 2009 (edited) i dont know how many records the array will have so how do i declare the array in the beginning? (trying to inject into the array) i DO know how many columns there will be but not how many rows... not sure if that makes a difference... Dim $hkcu_array_yes[0][0], $hkcu_array_no[0][0] $reg_read = _HKCU_Read("\\\" & $asset & $dir, $fn) For $i = 1 To $reg_read[0][0] $reg_found = False If $reg_read[$i][1] = $regs[$r][1] Then If $reg_read[$i][0] <> "svcAltiris_DS" And $reg_read[$i][0] <> "Default User" Then $hkcu_array_yes[$i][0] = $asset_label $hkcu_array_yes[$i][1] = $asset $hkcu_array_yes[$i][2] = $reg_read[$i][0] $hkcu_array_yes[$i][3] = $regs[$r][0] $hkcu_array_yes[$i][4] = "YES" $hkcu_array_yes[$i][5] = "" $hkcu_array_yes[$i][6] = $regnote EndIf $reg_found = True ContinueLoop EndIf Next Edited April 14, 2009 by gcue Link to comment Share on other sites More sharing options...
KaFu Posted April 14, 2009 Share Posted April 14, 2009 Not enough code for a qualified answer, try something like If $reg_read[$i][0] <> "svcAltiris_DS" And $reg_read[$i][0] <> "Default User" Then redim $hkcu_array_yes[ubound($hkcu_array_yes)+1][7] $hkcu_array_yes[ubound($hkcu_array_yes)-1][0] = $asset_label $hkcu_array_yes[ubound($hkcu_array_yes)-1][1] = $asset .... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
gcue Posted April 14, 2009 Author Share Posted April 14, 2009 (edited) i get an error: "array variable subscript badly formatted" sorry i didnt post more code, didnt want to inundate you, what part of it do you want? (figured this was enough, isnt it?) expandcollapse popupDim $hkcu_array_yes[0][0] $reg_read = _HKCU_Read("\\\" & $asset & $dir, $fn) For $i = 1 To $reg_read[0][0] $reg_found = False If $reg_read[$i][1] = $regs[$r][1] Then If $reg_read[$i][0] <> "svcAltiris_DS" And $reg_read[$i][0] <> "Default User" Then ReDim $hkcu_array_yes[UBound($hkcu_array_yes) + 1][7] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][0] = $asset_label $hkcu_array_yes[UBound($hkcu_array_yes) - 1][1] = $asset $hkcu_array_yes[UBound($hkcu_array_yes) - 1][2] = $reg_read[$i][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][3] = $regs[$r][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][4] = "YES" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][5] = "" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][6] = $regnote EndIf $reg_found = True ContinueLoop EndIf NextoÝ÷ Ú&¥²kçZºÚ"µÍBBBBBBBQ[H ÌÍÚØÝWØ^WÞYÖÌVÌK ÌÍÚØÝWØ^WÛÖÌVÌBBBBIÌÍÜY×ÜXYHÒÐÕWÔXY ][ÝÉÌLÉÌLÉÌLÉ][ÝÈ [È ÌÍØÜÙ] [È ÌÍÙ ÌÍÙBBBBQÜ ÌÍÚHHHÈ ÌÍÜY×ÜXYÌVÌBBBBBIÌÍÜY×ÙÝ[H[ÙBBBBBRY ÌÍÜY×ÜXYÉÌÍÚWVÌWHH ÌÍÜYÜÖÉÌÍÜVÌWH[BBBBBRY ÌÍÜY×ÜXYÉÌÍÚWVÌH ÉÝÈ ][ÝÜÝÐ[×ÑÉ][ÝÈ[ ÌÍÜY×ÜXYÉÌÍÚWVÌH ÉÝÈ ][ÝÑY][Ù][ÝÈ[BBBBBBTQ[H ÌÍÚØÝWØ^WÞYÖÕPÝ[ ÌÍÜY×ÜXY H ÈWVÍ×BBBBBBBIÌÍÚØÝWØ^WÞYÖÕPÝ[ ÌÍÜY×ÜXY HHWVÌHH ÌÍØÜÙ]ÛX[BBBBBBIÌÍÚØÝWØ^WÞYÖÕPÝ[ ÌÍÜY×ÜXY HHWVÌWHH ÌÍØÜÙ]BBBBBBIÌÍÚØÝWØ^WÞYÖÕPÝ[ ÌÍÜY×ÜXY HHWVÌHH ÌÍÜY×ÜXYÉÌÍÚWVÌBBBBBBBIÌÍÚØÝWØ^WÞYÖÕPÝ[ ÌÍÜY×ÜXY HHWVÌ×HH ÌÍÜYÜÖÉÌÍÜVÌBBBBBBBIÌÍÚØÝWØ^WÞYÖÕPÝ[ ÌÍÜY×ÜXY HHWVÍHH ][ÝÖQTÉ][ÝÂBBBBBBIÌÍÚØÝWØ^WÞYÖÕPÝ[ ÌÍÜY×ÜXY HHWVÍWHH ][ÝÉ][ÝÂBBBBBBIÌÍÚØÝWØ^WÞYÖÕPÝ[ ÌÍÜY×ÜXY HHWVÍHH ÌÍÜYÛÝBBBBBBQ[YBBBBBIÌÍÜY×ÙÝ[HYBBBBBBPÛÛ[YSÛÜBBBBQ[YBBBS^ Edited April 14, 2009 by gcue Link to comment Share on other sites More sharing options...
KaFu Posted April 14, 2009 Share Posted April 14, 2009 Dim $hkcu_array_yes[1][1] $hkcu_array_yes[0][0] = 0 $reg_read = _HKCU_Read("\\\" & $asset & $dir, $fn) $reg_found = False For $i = 1 To $reg_read[0][0] If $reg_read[$i][1] = $regs[$r][1] Then If $reg_read[$i][0] <> "svcAltiris_DS" And $reg_read[$i][0] <> "Default User" Then ReDim $hkcu_array_yes[UBound($hkcu_array_yes) + 1][7] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][0] = $asset_label $hkcu_array_yes[UBound($hkcu_array_yes) - 1][1] = $asset $hkcu_array_yes[UBound($hkcu_array_yes) - 1][2] = $reg_read[$i][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][3] = $regs[$r][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][4] = "YES" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][5] = "" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][6] = $regnote $hkcu_array_yes[0][0] = UBound($hkcu_array_yes) - 1 EndIf EndIf Next if $hkcu_array_yes[0][0] > 0 then $reg_found = True OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
evilertoaster Posted April 14, 2009 Share Posted April 14, 2009 The code for _HKCU_Read() might be useful...What about your for loop, should you be doing For $i = 0 To $reg_read[0][0] ? Link to comment Share on other sites More sharing options...
gcue Posted April 14, 2009 Author Share Posted April 14, 2009 this works great!!! how about if i query several reg entries.. currently only the last reg query is in the array... Dim $hkcu_array_yes[1][1] $hkcu_array_yes[0][0] = 0 $reg_read = _HKCU_Read("\\\" & $asset & $dir, $fn) $reg_found = False For $i = 1 To $reg_read[0][0] If $reg_read[$i][1] = $regs[$r][1] Then If $reg_read[$i][0] <> "svcAltiris_DS" And $reg_read[$i][0] <> "Default User" Then ReDim $hkcu_array_yes[UBound($hkcu_array_yes) + 1][7] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][0] = $asset_label $hkcu_array_yes[UBound($hkcu_array_yes) - 1][1] = $asset $hkcu_array_yes[UBound($hkcu_array_yes) - 1][2] = $reg_read[$i][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][3] = $regs[$r][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][4] = "YES" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][5] = "" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][6] = $regnote $hkcu_array_yes[0][0] = UBound($hkcu_array_yes) - 1 EndIf EndIf Next if $hkcu_array_yes[0][0] > 0 then $reg_found = True Link to comment Share on other sites More sharing options...
gcue Posted April 14, 2009 Author Share Posted April 14, 2009 The code for _HKCU_Read() might be useful... What about your for loop, should you be doing For $i = 0 To $reg_read[0][0] ? here is a link to that HKCU (its engine's UDF) #545798 the for loop thing.. should i use ubound? Link to comment Share on other sites More sharing options...
KaFu Posted April 14, 2009 Share Posted April 14, 2009 Hmm, I still not quiet sure what $reg_read[0][0] contains. Add a msgbox(0,"",$reg_read[0][0] & @crlf & ubound($reg_read)-1) after the _HKCU_Read() to check if it's the number of returned elements. For multiple queries just add up the _HKCU_Read() calls like this: expandcollapse popupDim $hkcu_array_yes[1][1] $hkcu_array_yes[0][0] = 0 $reg_found = False $reg_read = _HKCU_Read("\\\" & $asset & $dir, $fn) For $i = 1 To $reg_read[0][0] If $reg_read[$i][1] = $regs[$r][1] Then If $reg_read[$i][0] <> "svcAltiris_DS" And $reg_read[$i][0] <> "Default User" Then ReDim $hkcu_array_yes[UBound($hkcu_array_yes) + 1][7] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][0] = $asset_label $hkcu_array_yes[UBound($hkcu_array_yes) - 1][1] = $asset $hkcu_array_yes[UBound($hkcu_array_yes) - 1][2] = $reg_read[$i][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][3] = $regs[$r][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][4] = "YES" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][5] = "" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][6] = $regnote $hkcu_array_yes[0][0] = UBound($hkcu_array_yes) - 1 EndIf EndIf Next $reg_read = _HKCU_Read("\\\" & $asset & $dir, $fn) For $i = 1 To $reg_read[0][0] If $reg_read[$i][1] = $regs[$r][1] Then If $reg_read[$i][0] <> "svcAltiris_DS" And $reg_read[$i][0] <> "Default User" Then ReDim $hkcu_array_yes[UBound($hkcu_array_yes) + 1][7] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][0] = $asset_label $hkcu_array_yes[UBound($hkcu_array_yes) - 1][1] = $asset $hkcu_array_yes[UBound($hkcu_array_yes) - 1][2] = $reg_read[$i][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][3] = $regs[$r][0] $hkcu_array_yes[UBound($hkcu_array_yes) - 1][4] = "YES" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][5] = "" $hkcu_array_yes[UBound($hkcu_array_yes) - 1][6] = $regnote $hkcu_array_yes[0][0] = UBound($hkcu_array_yes) - 1 EndIf EndIf Next if $hkcu_array_yes[0][0] > 0 then $reg_found = True OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
gcue Posted April 14, 2009 Author Share Posted April 14, 2009 (edited) actually to better illustrate.. hers the same query done with local machine... it only keeps the last query done. (ive also included where $regs comes from - sorry bout that) expandcollapse popup$regs = IniReadSection($cfg, "REGISTRY") _ArraySort($regs) If not @error Then Dim $hklm_array_yes[1][1], $hklm_array_no[1][1] $hklm_array_yes[0][0] = 0 $hklm_array_no[0][0] = 0 $reg_read = RegRead("\\" & $asset & "\" & $dir, $fn) If $regs[$r][1] = $reg_read Then ReDim $hklm_array_yes[UBound($hklm_array_yes) + 1][6] $hklm_array_yes[UBound($hklm_array_yes) - 1][0] = $asset_label $hklm_array_yes[UBound($hklm_array_yes) - 1][1] = $asset $hklm_array_yes[UBound($hklm_array_yes) - 1][2] = $regs[$r][0] $hklm_array_yes[UBound($hklm_array_yes) - 1][3] = "YES" $hklm_array_yes[UBound($hklm_array_yes) - 1][4] = "" $hklm_array_yes[UBound($hklm_array_yes) - 1][5] = $regnote $reg_found = True ContinueLoop EndIf If $reg_found = False Then If $reg_read = "" Then If $reg_read <> 0 Then $reg_read = "<EMPTY>" EndIf EndIf ReDim $hklm_array_no[UBound($hklm_array_no) + 1][6] $hklm_array_no[UBound($hklm_array_no) - 1][0] = $asset_label $hklm_array_no[UBound($hklm_array_no) - 1][1] = $asset $hklm_array_no[UBound($hklm_array_no) - 1][2] = $regs[$r][0] $hklm_array_no[UBound($hklm_array_no) - 1][3] = "YES" $hklm_array_no[UBound($hklm_array_no) - 1][4] = "" $hklm_array_no[UBound($hklm_array_no) - 1][5] = $regnote EndIf endif Edited April 14, 2009 by gcue Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 15, 2009 Share Posted April 15, 2009 i dont know how many records the array will have so how do i declare the array in the beginning? (trying to inject into the array) i DO know how many columns there will be but not how many rows... not sure if that makes a difference... Dim $hkcu_array_yes[0][0], $hkcu_array_no[0][0] $reg_read = _HKCU_Read("\\\" & $asset & $dir, $fn) For $i = 1 To $reg_read[0][0] $reg_found = False If $reg_read[$i][1] = $regs[$r][1] Then If $reg_read[$i][0] <> "svcAltiris_DS" And $reg_read[$i][0] <> "Default User" Then $hkcu_array_yes[$i][0] = $asset_label $hkcu_array_yes[$i][1] = $asset $hkcu_array_yes[$i][2] = $reg_read[$i][0] $hkcu_array_yes[$i][3] = $regs[$r][0] $hkcu_array_yes[$i][4] = "YES" $hkcu_array_yes[$i][5] = "" $hkcu_array_yes[$i][6] = $regnote EndIf $reg_found = True ContinueLoop EndIf Next Dude, haven't we been here before? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
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