Shy Posted February 27, 2010 Share Posted February 27, 2010 1. I would like to define customized structs (like in C) so I can refer to various info regarding an object. For example, struct for Car could have Model, Color, Weight. Is there anyway to do it in Autoit? 2. Also, I saw that commands after . appear in blue (for example someCommand.otherCommand), I was wondering what are they used for. Thank you in advance Link to comment Share on other sites More sharing options...
dani Posted February 27, 2010 Share Posted February 27, 2010 (edited) 1. Take a look at the AutoItObject UDF. 2. SciTE just highlights everything after the . in blue for .au3 files But usually that's used for interactions with a COM object -- or an AutoIt Object using the UDF mentioned in 1. Edited February 27, 2010 by d4ni Link to comment Share on other sites More sharing options...
Shy Posted February 27, 2010 Author Share Posted February 27, 2010 It looks like a bit of an overkill to my current needs, but OO was definitely on my AutoIt wishlist so I'm more then glad. Thanks a lot! Link to comment Share on other sites More sharing options...
dani Posted February 27, 2010 Share Posted February 27, 2010 I know it might be a little overkill, but it's the only way -- as far as I know -- to add properties to something. The something would be the object ofcourse Link to comment Share on other sites More sharing options...
BugFix Posted February 28, 2010 Share Posted February 28, 2010 (edited) You can create your own structures, see the example. But i think it's more easy to use an 2D-array. ; === hold structure in an array ; === 1.st value holds structure definition Local $aCarStruct[1] = ["char model[128];char color[128];int weight"] ; === create new car ReDim $aCarStruct[UBound($aCarStruct)+1] $aCarStruct[UBound($aCarStruct)-1] = DllStructCreate($aCarStruct[0]) ; === create structure DllStructSetData($aCarStruct[UBound($aCarStruct)-1], 'model', 'Jaguar') ; === set values DllStructSetData($aCarStruct[UBound($aCarStruct)-1], 'color', 'silver') DllStructSetData($aCarStruct[UBound($aCarStruct)-1], 'weight', 1511) ReDim $aCarStruct[UBound($aCarStruct)+1] $aCarStruct[UBound($aCarStruct)-1] = DllStructCreate($aCarStruct[0]) DllStructSetData($aCarStruct[UBound($aCarStruct)-1], 'model', 'Carerra GT') DllStructSetData($aCarStruct[UBound($aCarStruct)-1], 'color', 'red') DllStructSetData($aCarStruct[UBound($aCarStruct)-1], 'weight', 1380) ; === get value ; === searching for weight of Carerra GT For $i = 1 To UBound($aCarStruct) -1 If DllStructGetData($aCarStruct[$i], 'model') = 'Carerra GT' Then MsgBox(0, 'weight', DllStructGetData($aCarStruct[$i], 'weight')) ExitLoop EndIf Next Edited February 28, 2010 by BugFix Best Regards BugFix 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