hispeed_mike Posted February 5, 2009 Share Posted February 5, 2009 (edited) Hi all, Below is my script. What I am basically doing is want to create a GUI that has a List of Registry settings from a specific Key. Dump that into a list view column and then Dump the values of the registry keys into the second column. I want to eventually make the value editable and then submit any changes back to the registry. The problem I am having is on the _GUICtrlListView_AddArray control. The array exists and can be displayed but when I get down to the Loop for the UBound I get this error: Line 390 (File "C:\Program Files\Autoit3\Include\GuiListView.au3"): DllStructSetData($tBuffer, "Text", #aItems[$iI][0]) DllStructSetData($tBuffer, "Text", ^ERROR Error:Array Variables has incorrect number of subscripts or subscript dimensions range exceeded. I thought this was to do with the naming convention change from the example in Help to the array names I had set up or that the number of rows were not being read from the array. Heads up appreciated. Excuse the layout of the code. expandcollapse popup#include "CompInfo.au3" #include "Array.au3" #include <GUIConstantsEx.au3> #Include <GuiListView.au3> ;Opt('MustDeclareVars', 1) Global $aReg[1] [1] [1] Global $aReg2 [1] [1] Global $aReg3 [1] [1] $RegKey = "HKEY_LOCAL_MACHINE\Software\Hispeed" $num = 0 For $i = 1 to 100 $var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Hispeed", $i) if @error <> 0 Then ExitLoop ;MsgBox(4096, "Value Name #" & $i & " under in AutoIt3 key", $var) _ArrayAdd ($aReg, $var) $add = $num + 1 $num = $add next $x = $num For $x = $num to 1 Step -1 $key = $aReg[$x] $val = RegRead ($RegKey, $key) ;MsgBox (4096, "Result", $RegKey & "\" & $key & "\" & $val) _ArrayAdd ($aReg2, $RegKey & "\" & $key) _ArrayAdd ($aReg3, $val) Next ; -------------------------------------------------------------------------------------- Example() Func Example() Local $add, $clear, $reglist, $close, $msg, $regtitle ; Create GUI GUICreate("ListView Add Array", 400, 300) $hListView = GUICtrlCreateListView("", 2, 2, 394, 268) ;_GUICtrlListView_SetUnicodeFormat($hListView, False) GUISetState() _GUICtrlListView_AddColumn($hListView, "Key Name", 100) _GUICtrlListView_AddColumn($hListView, "Value", 100) _GUICtrlListView_SetItemCount($hListView, $num) For $iI = 0 To UBound($aReg2) - 1 $aReg2[$num] = "Key Name" & $iI Next _GUICtrlListView_AddArray($hListView, $aReg2) $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) $close = GUICtrlCreateButton("Exit", 64, 350, 175, 25) $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $close Exit EndSelect WEnd EndFunc ;==>Example Edited February 5, 2009 by hispeed_mike Link to comment Share on other sites More sharing options...
avery Posted February 5, 2009 Share Posted February 5, 2009 Please edit your post and place [ autoit ] .... [ / autoit ] tags around your code so we can read it. Leave out the spaces in my example pretty please. Hard to read but I'd love to try and help you. www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
hispeed_mike Posted February 5, 2009 Author Share Posted February 5, 2009 Hi all, Below is my script. What I am basically doing is want to create a GUI that has a List of Registry settings from a specific Key. Dump that into a list view column and then Dump the values of the registry keys into the second column. I want to eventually make the value editable and then submit any changes back to the registry. The problem I am having is on the _GUICtrlListView_AddArray control. The array exists and can be displayed but when I get down to the Loop for the UBound I get this error: Line 390 (File "C:\Program Files\Autoit3\Include\GuiListView.au3"): DllStructSetData($tBuffer, "Text", #aItems[$iI][0]) DllStructSetData($tBuffer, "Text", ^ERROR Error:Array Variables has incorrect number of subscripts or subscript dimensions range exceeded. I thought this was to do with the naming convention change from the example in Help to the array names I had set up or that the number of rows were not being read from the array. Heads up appreciated. Excuse the layout of the code. expandcollapse popup#include "CompInfo.au3" #include "Array.au3" #include <GUIConstantsEx.au3> #Include <GuiListView.au3> ;Opt('MustDeclareVars', 1) Global $aReg[1] [1] [1] Global $aReg2 [1] [1] Global $aReg3 [1] [1] $RegKey = "HKEY_LOCAL_MACHINE\Software\Hispeed" $num = 0 For $i = 1 to 100 $var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Hispeed", $i) if @error <> 0 Then ExitLoop ;MsgBox(4096, "Value Name #" & $i & " under in AutoIt3 key", $var) _ArrayAdd ($aReg, $var) $add = $num + 1 $num = $add next $x = $num For $x = $num to 1 Step -1 $key = $aReg[$x] $val = RegRead ($RegKey, $key) ;MsgBox (4096, "Result", $RegKey & "\" & $key & "\" & $val) _ArrayAdd ($aReg2, $RegKey & "\" & $key) _ArrayAdd ($aReg3, $val) Next ; -------------------------------------------------------------------------------------- Example() Func Example() Local $add, $clear, $reglist, $close, $msg, $regtitle ; Create GUI GUICreate("ListView Add Array", 400, 300) $hListView = GUICtrlCreateListView("", 2, 2, 394, 268) ;_GUICtrlListView_SetUnicodeFormat($hListView, False) GUISetState() _GUICtrlListView_AddColumn($hListView, "Key Name", 100) _GUICtrlListView_AddColumn($hListView, "Value", 100) _GUICtrlListView_SetItemCount($hListView, $num) For $iI = 0 To UBound($aReg2) - 1 $aReg2[$num] = "Key Name" & $iI Next _GUICtrlListView_AddArray($hListView, $aReg2) $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) $close = GUICtrlCreateButton("Exit", 64, 350, 175, 25) $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $close Exit EndSelect WEnd EndFunc ;==>Example Done thanks for the Tip. Much easier to read. 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