Jump to content

AutoItObject UDF


ProgAndy
 Share

Recommended Posts

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

A huge thanks to the AutoItObject team. :mellow:

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

  • Moderators

Guys and Gal,

Thank you for the all work this represents - although I am sure it was a lot of fun as well. :mellow:

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

YES! Its here! Great job you guys. Can't wait to start playing around with this. VERY EXCITING!! :mellow:

Link to comment
Share on other sites

For this, English doesn't have enough expression. Magnifiqué! Meraviglioso!

Congratulations and well done, this is awesome!

Link to comment
Share on other sites

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?

; ===============================================================================================================================
; 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.

#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 :mellow:

Edited by NerdFencer

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Link to comment
Share on other sites

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. :mellow:

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

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. :mellow:

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...