Popular Post ProgAndy Posted February 19, 2010 Popular Post Share Posted February 19, 2010 (edited) The AutoItObject team is proud to announce that the first version of our AutoItObject UDF is complete and ready to use. The project page is located at [currently missing] Please, report bugs and any other issues at our [currently missing], and not here. An overview of all the functions can be found in the online documentation [currently missing] or in the offline .chm documentation file which is included with the [currently missing]. If Origo has problems providing the download, the current version will be mirrored here The UDF requires the current AutoIt version v3.3.4.0! AutoItObject 1.2.8.2.exe AutoItObject 1.2.8.2.zip Please, leave your comments and experiences here. Regards, - trancexx - ProgAndy - monoceres - Kip Our work is published under the Artistic License 2.0 A copy of the FAQ to answer your most urgent questions right away: (can also be found at the online documentation: Q. What is Object Orientation and why do I need it? OO is a highly used programming paradigm that is widely used in many programming languages. In procedural programming (AutoIt, C, etc.) you pass around data to different functions. In OO however, you use objects that contains both the function and data. It's especially useful when dealing with larger projects and need to structure your code. OO also offers tools such as inheritance to save yourself from rewriting code. Q. How does this work? AutoIt already has support for COM objects. What this library does is it creates dynamic com objects during runtime that executes AutoIt code. Q. How does this affect my script performance wise? There is a minor speed difference between calling methods and calling functions directly. However the difference is minor and you'll probably never notice it. When execution reaches AutoIt code it continues at normal speed. Q. Does the library support inheritance? Yes. _AutoItObject_Create() has an optional $parent parameter. Q. What about multiple inheritance? No problems. Calls to _AutoItObject_Create() can be nestled. Q. Why isn't it possible to pass arguments as ByRef to methods? This is a limitation within AutoIt. It's not possible to overcome this problem by directly calling the member functions, but that goes against the OO thinking and will not be covered here (use common sense). Q. Why can't I use variables of ptr-type in arguments to methods? See previous answer. Q. Can I use arrays as properties? Yes. However, it's slower than usual. Q. Does this mean that the objects I create are available from other programs since they're actually COM-objects? No. The objects are created at runtime and for AutoIt's eyes only. Q. My GUI freezes! Why and how do I fix it? All methods are essentially dllcallbacks. Unfortunately this means that messages are not processed while your methods are being executed. As long as you keep your main loop outside any method, you'll be fine. Some helper-functions: When using the Wrapper, this are some simple methods to get a return value from the resulting array. expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOResult ; Description ...: Returns the return value of the Call to a WraperObject function ; Syntax.........: _AIOResult(Const $aResult [, $vError=0] ) ; Parameters ....: $aResult - the resulting array ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Returnvalue ($aResult[0]) ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOResult(Const $aResult, $vError=0) ; Author: Prog@ndy If IsArray($aResult) Then Return $aResult[0] Return SetError(1,0,$vError) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOParam ; Description ...: Returns the parameter value of the Call to a WraperObject function ; Syntax.........: _AIOParam(Const $aResult, $iParam, $vError=0) ; Parameters ....: $aResult - the resulting array ; $iParam - The parameterindex to return (0: result, 1: first parameter, 2: 2nd parameter, ...) ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Parameter value ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOParam(Const $aResult, $iParam, $vError=0) ; Author: Prog@ndy If UBound($aResult)-1 < $iParam Then Return SetError(1,0,$vError) Return SetExtended($aResult[0], $aResult[$iParam]) EndFunc Edited September 10, 2012 by ProgAndy Wiliat87, yahaosoft, Professor_Bernd and 9 others 12 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
JohnOne Posted February 19, 2010 Share Posted February 19, 2010 This looks really interesting, and although Its way above my head at the moment, I have been following the thread, and really looking forward to giving it a try. Thank you very much for sharing your hard work and time. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Alek Posted February 19, 2010 Share Posted February 19, 2010 I...I...I...don't know what to say... [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Kip Posted February 19, 2010 Share Posted February 19, 2010 There is an examples folder in the download package by the way. That should give you an idea how it all works. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
martin Posted February 19, 2010 Share Posted February 19, 2010 A huge thanks to the AutoItObject team. Lots of us have been waiting to play with this; at first glance you have made it simple to use. It might be worth mentioning in the first post that the latest production release is required. (To allow the long strings used for the dll.) Couldn't _AutoItObject_StartUp() be included in AutoitObject.au3 and _AutoItObject_Shutdown() be added to __Au3Obj_OleUninitialize? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 19, 2010 Moderators Share Posted February 19, 2010 Guys and Gal, Thank you for the all work this represents - although I am sure it was a lot of fun as well. Once I get my head around this I am sure I will have lots of questions - at the moment I just stand in awe of what you have done. Thanks again, 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...
AlmarM Posted February 19, 2010 Share Posted February 19, 2010 That, is so awesome! Great release! I AM going to take a closer look on this later on. Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Beege Posted February 19, 2010 Share Posted February 19, 2010 YES! Its here! Great job you guys. Can't wait to start playing around with this. VERY EXCITING!! Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
JRowe Posted February 20, 2010 Share Posted February 20, 2010 For this, English doesn't have enough expression. Magnifiqué! Meraviglioso!Congratulations and well done, this is awesome! [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
NerdFencer Posted February 20, 2010 Share Posted February 20, 2010 Awesome Finally, objects! Great work! _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
ivan Posted February 20, 2010 Share Posted February 20, 2010 I cannot believe my eyes! Amazing, outstanding, and with a help file included. I praise you guys, you excel at scripting. Finally, THANK YOU. Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3 Link to comment Share on other sites More sharing options...
NerdFencer Posted February 20, 2010 Share Posted February 20, 2010 (edited) I love objects, but having to declare them like _SomeBulkyFunctionName(...) grates on my nerves (as I am used to C++ style classes), so I wrote a small function "_ObjCreate" to create objects for AutoItObject with somewhat cleaner syntax. Here it is for anybody else interested in using it. Is something more native feeling a possibility for the future? expandcollapse popup; =============================================================================================================================== ; Creates an object using AutoItObject from a string ; Fist, define a class name by saying ":Class ClassName;" ; All commands must end with a semicolon. ; Define variables by stating "VariableName=Value;" or simply "VariableName;" to create an empty string ; Define functions by stating "FunctionName();" ; In AutoIt, this will call a function named "_ClassName_FunctionName" ; Destructors are created similarly as "~FunctionName()" ; By default, all data members are public, but you can change the current setting by using... ; ":Public;", ";Private", or ":ReadOnly;" ; Enjoy, ; -NerdFencer ; =============================================================================================================================== Func _ObjCreate($sText) Local $iScope = $ELSCOPE_PUBLIC Local $sName = "", $oObject = _AutoItObject_Class(), $sTmp $oObject.Create() $sText = StringSplit($sText,";",1) For $i=0 To $sText[0] ;Whitespace While 1 If StringLeft($sText[$i],1)==" " Or StringLeft($sText[$i],1)==@TAB Then $sText[$i] = StringTrimLeft($sText[$i],1) Else ExitLoop EndIf WEnd ;Operators If StringLeft($sText[$i],1)==":" Then Switch StringLeft($sText[$i],4) Case ":Cla" $sName = StringTrimLeft($sText[$i],7) Case ":Pub" $iScope = $ELSCOPE_PUBLIC Case ":Pri" $iScope = $ELSCOPE_PRIVATE Case ":Rea" $iScope = $ELSCOPE_READONLY EndSwitch ContinueLoop EndIf ; Functions If StringInStr($sText[$i],"(")>0 Then $sTmp = StringLeft($sText[$i],StringInStr($sText[$i],"(")-1) If StringLeft($sTmp,1)=="~" Then $oObject.AddDestructor("_"&$sName&"_"&StringTrimLeft($sTmp,1)) Else $oObject.AddMethod($sTmp, "_"&$sName&"_"&$sTmp) EndIf ContinueLoop EndIf ; Variables If StringInStr($sText[$i],"=")>0 Then $sTmp = StringReplace(StringLeft($sText[$i],StringInStr($sText[$i],"=")-1)," ","") $oObject.AddProperty($sTmp, $iScope, Execute(StringTrimLeft($sText[$i],StringInStr($sText[$i],"=")))) ContinueLoop EndIf If StringLen($sText[$i])>0 Then $sTmp = StringReplace($sText[$i]," ","") $oObject.AddProperty($sTmp, $iScope, '') ContinueLoop EndIf Next Return $oObject.Object EndFunc And a modified example of the MessageBox example using this style declaration. expandcollapse popup#include "AutoitObject.au3" #include "parse.au3" Opt("MustDeclareVars", 1) ; Declare the MessageBox class ; Could also be done like this... ; Global $Class_MsgBox = ':Class MsgBox;Title="Something";Text="Some Text";Flag=64 + 262144;MsgBox();~Destructor();' Global $Class_MsgBox = _ ':Class MsgBox;' & _ ' Title="Something";' & _ ' Text="Some Text";' & _ ' Flag=64 + 262144;' & _ ' MsgBox();' & _ ' ~Destructor();' ; Error monitoring Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") ; Initialize AutoItObject _AutoItObject_StartUp() ; Create Object Global $oObject = _ObjCreate($Class_MsgBox) ; Set some property $oObject.Title = "Hey" ;Display messagebox $oObject.MsgBox() ; Relese $oObject = 0 ; That's it! Goodby Func _MsgBox_MsgBox($oSelf) MsgBox($oSelf.Flag, $oSelf.Title, $oSelf.Text) EndFunc ;==>_Obj_MsgBox Func _MsgBox_Destructor($oSelf) ConsoleWrite("!...destructing..." & @CRLF) EndFunc Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc Great work ProgAndy! Thanks for making this possible Edited February 20, 2010 by NerdFencer _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
BillLuvsU Posted February 20, 2010 Share Posted February 20, 2010 I love you guys. [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
trancexx Posted February 20, 2010 Share Posted February 20, 2010 A huge thanks to the AutoItObject team. Lots of us have been waiting to play with this; at first glance you have made it simple to use.It might be worth mentioning in the first post that the latest production release is required. (To allow the long strings used for the dll.)Couldn't _AutoItObject_StartUp() be included in AutoitObject.au3 and _AutoItObject_Shutdown() be added to __Au3Obj_OleUninitialize?Optional parameters for _AutoItObject_StartUp() wouldn't make sense then. This way full control of type of initialization is given to the user.Shutting it down is something that you don't have to do at all.You will see that it's simple at any glance. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Beege Posted February 20, 2010 Share Posted February 20, 2010 I'm getting confused with inheritance. Going off of the ITaskbarList example that was given, If I wanted to get the ITaskbarList2 interface that inherits from ITaskbarList, am I suppost to use the _AutoItObject_Create() function? Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
trancexx Posted February 20, 2010 Share Posted February 20, 2010 (edited) I'm getting confused with inheritance. Going off of the ITaskbarList example that was given, If I wanted to get the ITaskbarList2 interface that inherits from ITaskbarList, am I suppost to use the _AutoItObject_Create() function?If some interface inherits from some other that means that its vtable is richer for the new members. In your case you just append that new method that ITaskbarList2 Interface introduces to tagITaskbarList.edit: see DirectShow example where all wrapped interfaces inherits from IDispatch (that inherits from IUnknown). Edited February 20, 2010 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Beege Posted February 20, 2010 Share Posted February 20, 2010 If some interface inherits from some other that means that its vtable is richer for the new members. In your case you just append that new method that ITaskbarList2 Interface introduces to tagITaskbarList.edit: see DirectShow example where all wrapped interfaces inherits from IDispatch (that inherits from IUnknown).Ok thanks for the response. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
ProgAndy Posted February 20, 2010 Author Share Posted February 20, 2010 The problem is, you rarely find the vTables with the correct order. Here are those for all ITaskbarlist-interfaces (but without parameter-types) Global Const $ITaskbarList = "ptr lpVtbl" Global Const $ITaskbarListVtbl = "ptr QueryInterface; ptr AddRef; ptr Release; ptr HrInit; ptr AddTab; ptr DeleteTab; ptr ActivateTab; ptr SetActiveAlt;" Global Const $ITaskbarList2Vtbl = $ITaskbarListVtbl & 'ptr MarkFullscreenWindow;' Global Const $ITaskbarList3Vtbl = $ITaskbarList2Vtbl & 'ptr SetProgressValue; ptr SetProgressState; ptr RegisterTab; ptr UnregisterTab; ptr SetTabOrder; ptr SetTabActive; ' & _ 'ptr ThumbBarAddButtons; ptr ThumbBarUpdateButtons; ptr ThumbBarSetImageList; ptr SetOverlayIcon; ptr SetThumbnailTooltip; ptr SetThumbnailClip;' Global Const $ITaskbarList4Vtbl = $ITaskbarList3Vtbl & 'ptr SetTabProperties;' Global Enum _ ;STPFLAG $STPF_NONE = 0x00000000, _ $STPF_USEAPPTHUMBNAILALWAYS = 0x00000001, _ $STPF_USEAPPTHUMBNAILWHENACTIVE = 0x00000002, _ $STPF_USEAPPPEEKALWAYS = 0x00000004, _ $STPF_USEAPPPEEKWHENACTIVE = 0x00000008 Global Enum _ ; TBPFLAG $TBPF_NOPROGRESS = 0, $TBPF_INDETERMINATE = 0x1, $TBPF_NORMAL = 0x2, $TBPF_ERROR = 0x4, $TBPF_PAUSED = 0x8 Global $CLSID_TaskBarlist = _AutoItObject_CLSIDFromString("{56FDF344-FD6D-11D0-958A-006097C9A090}") Global $IID_ITaskbarList = _AutoItObject_CLSIDFromString("{56FDF342-FD6D-11d0-958A-006097C9A090}") Global $IID_ITaskBarlist2 = _AutoItObject_CLSIDFromString("{602D4995-B13A-429b-A66E-1935E44F4317}") Global $IID_ITaskBarlist3 = _AutoItObject_CLSIDFromString("{ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf}") Global $IID_ITaskBarlist4 = _AutoItObject_CLSIDFromString("{c43dc798-95d1-4bea-9030-bb99e2983a1a}") *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
James Posted February 20, 2010 Share Posted February 20, 2010 I just jizzed in my pants mLipok 1 Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Beege Posted February 20, 2010 Share Posted February 20, 2010 Oh this is great! Thanks so much ProgAndy! Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator 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