minxomat Posted May 15, 2015 Share Posted May 15, 2015 (edited) The error (?)I was writing a pretty large script the other day when I came across unexpected errors while accessing structs via the period operator.1. Create an array containing structs (can be different structs, simplified here):Local $T = DllStructCreate Local $aStr[] = [$T("int x;int y"), $T("int x;int y")] $aStr[0].x = 1 $aStr[0].y = 2 $aStr[1].x = 3 $aStr[1].y = 42. Working: Simple access via With:With $aStr[0] .y += .x - $aStr[1].x / .y ^ 2 ; $aStr[1] is a valid reference EndWith3. ERROR: Use struct element as Array index, simplified:With $aStr[0] .y += .x - $aStr[.x].x / .y ^ 2 EndWithproduces:==> Variable subscript badly formatted.: .y += .x - $aStr[.x].x / .y ^ 2 .y += .x - $aStr[.x].x / .y ^ ^ ERROR4. ERROR: Struct element as Array index, complex:With $aStr[0] .y += .x + ((Sqrt(Abs($aStr[1].x^2+$aStr[.x].y^2))-$aStr[1].x)/.y)*.y EndWithproduces:==> Unbalanced brackets in expression.: .y += .x + ((Sqrt(Abs($aStr[1].x^2+$aStr[.x].y^2))-$aStr[1].x)/.y)*.y .y += .x + ((Sqrt(Abs($aStr[1].x^2+$aStr[^ ERROR5. ERROR: Struct element as Array index, outside of any With:Function($aStr[$aStr[0].x].y) Func Function($nP) Return Default EndFuncproduces:==> Unbalanced brackets in expression.: Function($aStr[$aStr[0].x].y) Function($aStr[^ ERROR Crashing SciTeNow, this is a abstract example of this error. But in my script, AutoIt executed the script, then aborted with an error (not warning). I tried to jump to the error within SciTe using F4. That is when SciTe itself crashed with a memory exception ("SciTe.exe does not respond blah blah..."). This happend every time and I was able to reproduce this on different PCs. I lost the script however. I will try to recreate it ;-) ExampleYou can download a script for testing. Remove the "#" to test each line. Download: refer.au3. Edited May 15, 2015 by minx I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
minxomat Posted May 15, 2015 Author Share Posted May 15, 2015 Also strange: The error pointer "^" is always on the wrong character. I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 15, 2015 Developers Share Posted May 15, 2015 Which version of SciTE are you using?Jos 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...
minxomat Posted May 15, 2015 Author Share Posted May 15, 2015 (edited) SciTE Lite 3.4.1 (the one included in the latest stable)Edit: This also happened with SciTE4Au3 Edited May 15, 2015 by minx I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 15, 2015 Developers Share Posted May 15, 2015 Let me know when you have a way to replicate it so I can have a look.Jos 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...
minxomat Posted May 15, 2015 Author Share Posted May 15, 2015 Let me know when you have a way to replicate it so I can have a look.JosI guess it is not a SciTE problem. I assume AutoIt runs in the memory of SciTE when executed via F5? Then it should be an error in the AutoIt Interpreter (caused by the bug above). I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
bernd670 Posted May 16, 2015 Share Posted May 16, 2015 Hello,try it this way.With $aStr[0] .y += .x - ($aStr[.x]).x / .y ^ 2 EndWithWith $aStr[0] .y += .x + ((Sqrt(Abs($aStr[1].x^2+($aStr[.x]).y^2))-$aStr[1].x)/.y)*.y EndWithFunction($aStr[($aStr[0].x)].y) greetingsbernd I hacked 127.0.0.1 -> Link to comment Share on other sites More sharing options...
minxomat Posted May 16, 2015 Author Share Posted May 16, 2015 Hello,try it this way.With $aStr[0] .y += .x - ($aStr[.x]).x / .y ^ 2 EndWithWith $aStr[0] .y += .x + ((Sqrt(Abs($aStr[1].x^2+($aStr[.x]).y^2))-$aStr[1].x)/.y)*.y EndWithFunction($aStr[($aStr[0].x)].y) This is merely a workaround, not clean code. I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
bernd670 Posted May 16, 2015 Share Posted May 16, 2015 (edited) What's not a clean code here? With the brackets but only the priority of the operator is changed. This is done in many languages so! Edited May 16, 2015 by bernd670 greetingsbernd I hacked 127.0.0.1 -> Link to comment Share on other sites More sharing options...
guinness Posted May 16, 2015 Share Posted May 16, 2015 Maybe I missing something, but when did dot notation work on DllStructCreate in the stable version? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
minxomat Posted May 16, 2015 Author Share Posted May 16, 2015 (edited) Maybe I missing something, but when did dot notation work on DllStructCreate in the stable version? v3.3.12.0 aka the latest. Quite some time.https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe Edited May 16, 2015 by minx I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
minxomat Posted May 16, 2015 Author Share Posted May 16, 2015 What's not a clean code here? With the brackets but only the priority of the operator is changed. This is done in many languages so!No it isn't. () in AutoIt is "convert to expression". The value of .x should be directly accessible, the priority is completely irrelevant here I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
guinness Posted May 16, 2015 Share Posted May 16, 2015 v3.3.12.0 aka the latest. Quite some time.https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exeWhen using With...EndWith, but again I ask, where in the changelog does it say you can do ... $aStr[0].x = 1? Honestly, I believe this to still be an experimental feature, from my limited understanding of course. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
minxomat Posted May 16, 2015 Author Share Posted May 16, 2015 When using With...EndWith, but again I ask, where in the changelog does it say you can do ... $aStr[0].x = 1? Honestly, I believe this to still be an experimental feature, from my limited understanding of course.Hm. It's enabled in the stable, so it should not produce unrelated errors (IMHO). It isn't mentioned in the Help file, but it is there. I will answer every single PM, and you are free to ask anything anytime. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 16, 2015 Moderators Share Posted May 16, 2015 minx,It's enabled in the stable, so it should not produce unrelated errors (IMHO). It isn't mentioned in the Help file, but it is there.That is a complete non sequitur. If something is not mentioned in the Help file then it is not even "Experimental" and should not be used under any circumstances - even if it apparently "works" in some cases. So complaining that there are problems when using it is unlikely to get any response other than the one I have just given.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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