PaulBaumann Posted August 30, 2007 Share Posted August 30, 2007 Hi, I got a strange problem: Since 3.2.6.0 the script (part of it) below works well if it's interpreted. It also works well if it's "compiled". But after commenting the line "msgbox(0,"","comment me!")" the compiled script will give an Error: Line:-1 $error Arry variable subscript badly fromatted. AutoIt3Wrapper GUI v.1.9.2 AutoIt 3.2.6.0 Can anyone help me? Best wishes Paul expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=x.exe #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Comment=Löschen von schädlichen Registy Einträgen aus der SVS Schichten #AutoIt3Wrapper_Res_Fileversion=1.0.0.19 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=RAL #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** Dim $i Const $start = "HKLM\SOFTWARE\fslrdr" Dim $SuchString Dim $pattern Dim $KeyList[10000] Dim $KeyListIdx = 0 FillList($start) ReDim $KeyList[$KeyListIdx] Func FillList($startpoint) Local $i = 0 Local $var Local $KeyPath While True $i = $i + 1 $var = RegEnumKey($startpoint, $i) msgbox(0,"","Comment me!") If @error <> 0 Then ExitLoop $KeyPath = $startpoint & "\" & $var $KeyList[$KeyListIdx] = $KeyPath $KeyListIdx += 1 If $KeyListIdx = UBound($KeyList) Then ReDim $KeyList[UBound($KeyList) + 5000] FillList($KeyPath) WEnd EndFunc ;==>FillList Link to comment Share on other sites More sharing options...
weaponx Posted August 30, 2007 Share Posted August 30, 2007 $var = RegEnumKey($startpoint, $i) msgbox(0,"","Comment me!") If @error <> 0 Then ExitLoop 3rd line here is never going to get an @error because msgbox is always successful Whatever @error is returned from RegEnumKey is being reset by msgbox Link to comment Share on other sites More sharing options...
PaulBaumann Posted August 30, 2007 Author Share Posted August 30, 2007 $var = RegEnumKey($startpoint, $i) msgbox(0,"","Comment me!") If @error <> 0 Then ExitLoop3rd line here is never going to get an @error because msgbox is always successfulWhatever @error is returned from RegEnumKey is being reset by msgbox That's not the point! Compile this script using V3260 and run it. The script will run without an error. Now commentout or delete the line msgbox... and compile again. Try to run it and you will get an Line:-1$error Arry variable subscript badly fromatted.error. NB. running this script using the interpreter, will give no error! Link to comment Share on other sites More sharing options...
MrCreatoR Posted August 30, 2007 Share Posted August 30, 2007 (edited) You get the error because that line with If @error <> 0 Then ExitLoop is activated (there is error from RegEnumKey), and the function is ended, then when you do Redim $KeyList[$KeyListIdx] (outside the function), you get the error message, because you can not redim on zero (0), witch is the value of $KeyListIdx (it's not changed since the function ended without any additions to variable $KeyListIdx).And Btw: you will get the same error even if you not compile your script, just run it not from scite editor - you even see the line number where the error is accourd. Edited August 30, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Developers Jos Posted August 30, 2007 Developers Share Posted August 30, 2007 That's not the point! Compile this script using V3260 and run it. The script will run without an error. Now commentout or delete the line msgbox... and compile again. Try to run it and you will get an Line:-1$error Arry variable subscript badly fromatted.error. NB. running this script using the interpreter, will give no error!Yes that is a valid point.The "If @error" test will test the @error generated by MsgBox() when the line isn;t commented ! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
PaulBaumann Posted August 30, 2007 Author Share Posted August 30, 2007 You get the error because that line with If @error <> 0 Then ExitLoop is activated (there is error from RegEnumKey), and the function is ended, then when you do Redim $KeyList[$KeyListIdx] (outside the function), you get the error message, because you can not redim on zero (0), witch is the value of $KeyListIdx (it's not changed since the function ended without any additions to variable $KeyListIdx). And Btw: you will get the same error even if you not compile your script, just run it not from scite editor - you even see the line number where the error is accourd. Ah, you're right in case the key to enum is not found at all. Change Const $start = "HKLM\SOFTWARE\fslrdr" to a key that exists on your machine e.g. "HKLM\SOFTWARE" an try again. I checked out this script with v3249 and it runs without any error, even if it's compiled. Compiling with V3260 gives the error mentioned above! Link to comment Share on other sites More sharing options...
MrCreatoR Posted August 31, 2007 Share Posted August 31, 2007 Change Const $start = "HKLM\SOFTWARE\fslrdr" to a key that exists on your machine e.g. "HKLM\SOFTWARE" an try again.I don't need to, i think that error that you talking about is causing by wrong ReDim usage... Just do some Error checking and you will see: FillList($start) If $KeyListIdx = 0 Then MsgBox(0, "", "Error! - $KeyListIdx = 0") Else ReDim $KeyList[$KeyListIdx] EndIf If the problem is not in the redim func, then check all possible errors that might causing this crash... when (and if) you find it, maybe you should report in Bug Report Forum. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted August 31, 2007 Share Posted August 31, 2007 And BTW: what you trying to do is much easyer to do it like this (and i doubt that this will cause any errors):#include <Array.au3> Global $RegRoot = "HKLM\SOFTWARE\fslrdr" $RegListArr = ReadRegistry($RegRoot) _ArrayDisplay($RegListArr) Func ReadRegistry($sPath) Local $KeysListArr[1], $SubKeysListArr, $Instance = 0, $Enum, $CurrentKeyPath While 1 $Instance += 1 $Enum = RegEnumKey($sPath, $Instance) If @error Then ExitLoop $CurrentKeyPath = $sPath & "\" & $Enum ReDim $KeysListArr[UBound($KeysListArr)+1] $KeysListArr[UBound($KeysListArr)-1] = $CurrentKeyPath $SubKeysListArr = ReadRegistry($CurrentKeyPath) If IsArray($SubKeysListArr) Then For $j = 1 To UBound($SubKeysListArr)-1 ReDim $KeysListArr[UBound($KeysListArr)+1] $KeysListArr[UBound($KeysListArr)-1] = $SubKeysListArr[$j] Next EndIf WEnd $KeysListArr[0] = UBound($KeysListArr)-1 Return $KeysListArr EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team 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