Popular Post LarsJ Posted May 3, 2020 Popular Post Share Posted May 3, 2020 (edited) The Running Object Table (ROT) is a system global table where objects can register themselves. This makes the objects accessible in processes other than the process where the object was created. IRunningObjectTable and related interfaces provides access to register and maintain objects in the ROT. ThreadsOther threads related to ROT objects: Non-blocking data display functions IPC Techniques through ROT Objects AutoIt and Perl integration through ROT objects Access AutoIt by trancexx is about executing AutoIt commands in other programming languages. The AutoIt command is executed by calling a Call method of the ROT object. The example is based on the AutoItObject UDF. Posts (2021-01-03)This is a list of the most interesting posts below: Usage section with typical examples of the use of ROT objects with the following subsections: Passing array between AutoIt programs Passing array between AutoIt and VBScript Passing data through ROT Objects Executing Object Methods through VBScript VBScript (2021-01-03)VBScript is used as a consistent programming language to demonstrate the ROT technique for communicating between AutoIt and other languages. This is a list of the VBScript posts: Passing array between AutoIt and VBScript (in middle of post) Executing Object Methods through VBScript BasicRegister an objectExamples\1) Basic\0) ROT_RegisterObject.au3 #include <Array.au3> #include "..\..\Includes\IRunningObjectTable.au3" Example() Func Example() Local $sNameId = "DataTransferObject" & ROT_CreateGUID() Local $iHandle = ROT_RegisterObject( Default, $sNameId ) ; Default => Object = Dictionary object If Not $iHandle Then Return ConsoleWrite( "ROT_RegisterObject ERR" & @CRLF ) ConsoleWrite( "ROT_RegisterObject OK" & @CRLF ) Local $aROT_List = ROT_Enumerate() _ArrayDisplay( $aROT_List, "ROT_RegisterObject" ) EndFunc Output in _ArrayDisplay looks like this: DataTransferObject-{05DCB964-FD4B-40EC-A95A-999491347D20} $sNameId (similar to ProgID) is the identification of the ROT object and is used in the ObjGet() function to access the object in this way: Local $oDataTransferObject = ObjGet( "DataTransferObject-{05DCB964-FD4B-40EC-A95A-999491347D20}" ) ROT_CreateGUID() is used to make $sNameId unique. See below. ROT_RegisterObject() is the function that registers the object in the ROT. The Dictionary object is the actual object that is registered in the ROT. The Add method allows you to add a new key/item pair to the object. The key is often a string. The item property can be any COM compatible data type which includes most AutoIt data types. An exception is the DllStruct type which must be converted to a compatible type. Because many different data types can be used in the item property and the item can be identified through a key, the Dictionary object is generally applicable for many different purposes. More information about registering objects in the ROT can be found in this Microsoft documentation. ROT_Enumerate() enumerate the objects, that are registered in the ROT. The program that registers an object in the ROT plays the role of server. One or more programs that access the ROT object with the ObjGet() function play the role of clients. The ROT object is only available as long as the server program is running or until the server program deletes the object with the ROT_Revoke() function. You can find examples of using the functions in Examples\1) Basic\. ROT objects (2020-07-11)The Dictionary object is the default object in the ROT_RegisterObject() function. The object that's passed to this function is the actual object that's registered in the ROT. The Dictionary object works fine when passing data between AutoIt scripts, between AutoIt and VBScript, and between AutoIt and Perl. However, situations may easily arise where it can be an advantage to pass data with a very simple object with just a single property. There are several options for creating such a simple object. This can be done through C# and VB.NET code, as demonstrated in Using C# and VB Code in AutoIt through .NET Framework. And it can be done through the AutoItObject UDF. Examples\4) ROT Objects\ contains examples for creating the ROT object in these three ways. Client.au3 is the same script in all examples: #include <Array.au3> Example() Func Example() Local $sNameId = "DataTransfer" Local $oDataTransfer = ObjGet( $sNameId ) Local $aArray = $oDataTransfer.Item _ArrayDisplay( $aArray ) EndFunc Create object with C# code CSharp\Server.au3: #include "..\..\..\Includes\IRunningObjectTable.au3" #include "..\DotNetAll.au3" Example() Func Example() Local $aArray[1000][10] For $i = 0 To 1000 - 1 For $j = 0 To 10 - 1 $aArray[$i][$j] = $i & "/" & $j Next Next Local $oNetCode = DotNet_LoadCScode( FileRead( "Object.cs" ), "System.dll" ) Local $oCSObject = DotNet_CreateObject( $oNetCode, "CSObjClass" ) $oCSObject.Item = $aArray Local $sNameId = "DataTransfer" ROT_RegisterObject( Ptr( $oCSObject ), $sNameId ) RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & "Client.au3" ) EndFunc CSharp\Object.cs: using System; public class CSObjClass { public object Item { get; set; } } Create object with VB.NET code VB.NET\Server.au3: #include "..\..\..\Includes\IRunningObjectTable.au3" #include "..\DotNetAll.au3" Example() Func Example() Local $aArray[1000][10] For $i = 0 To 1000 - 1 For $j = 0 To 10 - 1 $aArray[$i][$j] = $i & "/" & $j Next Next Local $oNetCode = DotNet_LoadVBcode( FileRead( "Object.vb" ), "System.dll" ) Local $oVBObject = DotNet_CreateObject( $oNetCode, "VBObjClass" ) $oVBObject.Item = $aArray Local $sNameId = "DataTransfer" ROT_RegisterObject( Ptr( $oVBObject ), $sNameId ) RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & "Client.au3" ) EndFunc VB.NET\Object.vb: Imports System Public Class VBObjClass Public Property Item As Object End Class In AutoIt/Perl integration, the very first attempts were performed with the VB.NET object. Check for recognition of the ROT object with this Client.pl script (copied from the AutoIt/Perl example) : use strict; use Win32::OLE; my $oObj = Win32::OLE->GetObject( "DataTransfer" ); Win32::OLE->EnumAllObjects( sub { my $Object = shift; my $Class = Win32::OLE->QueryObjectType( $Object ); printf "Object = %s, Class = %s\n", $Object, $Class; } ); Gave the following output: Object = Win32::OLE=HASH(0x72a51c), Class = _VBObjClass ; VB.NET object Object = Win32::OLE=HASH(0x71b5a8), Class = IDictionary ; Dictionary object Create object with AutoItObject AutoItObject\Server.au3: #include "..\..\..\Includes\IRunningObjectTable.au3" #include "AutoitObject.au3" Example() Func Example() Local $aArray[1000][10] For $i = 0 To 1000 - 1 For $j = 0 To 10 - 1 $aArray[$i][$j] = $i & "/" & $j Next Next _AutoItObject_StartUp() Local $oObject = NewObject(), $sNameId = "DataTransfer" ROT_RegisterObject( Ptr( $oObject ), $sNameId ) Local $oDataTransfer = ObjGet( $sNameId ) $oDataTransfer.Item = $aArray RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & "Client.au3" ) _AutoItObject_Shutdown() EndFunc Func NewObject() Local $oClassObject = _AutoItObject_Class() $oClassObject.AddProperty( "Item" ) Return $oClassObject.Object EndFunc Unique objectsWhen using ROT objects in real code, there is a particular question that needs to be addressed. The question is how to make sure that $sNameId, which clients use to access the object with the ObjGet() function, actually identifies a unique object. Running a server program twice in succession can easily create two ROT objects with the same $sNameId. But how do you actually access the ROT object that was created first and the ROT object that was created last? The answer to the question is to make sure that $sNameId also becomes unique so that you can distinguish between the two objects. To that end, the ROT_CreateGUID() function is created (copy of _WinAPI_CreateGUID()). The function can ensure a unique $sNameId as shown in the example above. The problem and solution is demonstrated in Examples\1) Basic\2) Multiple ROT objects.au3. Time stampsUsing the NoteChangeTime() and GetTimeOfLastChange() methods of the IRunningObjectTable interface, you can set and get timestamps on a ROT object. But these timestamps do not seem particularly useful. Therefore, the methods are not implemented. The UDFThe IRunningObjectTable UDF, Includes\IRunningObjectTable.au3, is a very small UDF with less than 150 lines of code: expandcollapse popup#include-once ; --- Interface definitions --- Global Const $sIID_IRunningObjectTable = "{00000010-0000-0000-C000-000000000046}" Global Const $dtag_IRunningObjectTable = _ "Register hresult(dword;ptr;ptr;dword*);" & _ "Revoke hresult(dword);" & _ "IsRunning hresult(ptr);" & _ "GetObject hresult(ptr;ptr*);" & _ "NoteChangeTime hresult(dword;struct*);" & _ "GetTimeOfLastChange hresult(ptr;ptr*);" & _ "EnumRunning hresult(ptr*);" Global Const $ROTFLAGS_REGISTRATIONKEEPSALIVE = 0x1 Global Const $ROTFLAGS_ALLOWANYCLIENT = 0x2 Global Const $sIID_IEnumMoniker = "{00000102-0000-0000-C000-000000000046}" Global Const $dtag_IEnumMoniker = _ "Next hresult(ulong;ptr*;ulong*);" & _ "Skip hresult(ulong);" & _ "Reset hresult();" & _ "Clone hresult(ptr*);" Global Const $sIID_IPersist = "{0000010C-0000-0000-C000-000000000046}" Global Const $dtag_IPersist = _ "GetClassID hresult(ptr*);" Global Const $sIID_IPersistStream = "{00000109-0000-0000-C000-000000000046}" Global Const $dtag_IPersistStream = $dtag_IPersist & _ "IsDirty hresult();" & _ "Load hresult(ptr);" & _ "Save hresult(ptr;bool);" & _ "GetSizeMax hresult(uint*);" Global Const $sIID_IMoniker = "{0000000F-0000-0000-C000-000000000046}" Global Const $dtag_IMoniker = $dtag_IPersistStream & _ "BindToObject hresult();" & _ "BindToStorage hresult();" & _ "Reduce hresult();" & _ "ComposeWith hresult();" & _ "Enum hresult();" & _ "IsEqual hresult();" & _ "Hash hresult();" & _ "IsRunning hresult(ptr;ptr;ptr);" & _ "GetTimeOfLastChange hresult(ptr;ptr;ptr);" & _ "Inverse hresult();" & _ "CommonPrefixWith hresult();" & _ "RelativePathTo hresult();" & _ "GetDisplayName hresult(ptr;ptr;wstr*);" & _ "ParseDisplayName hresult();" & _ "IsSystemMoniker hresult(ptr*);" ; --- Windows API functions --- Func ROT_GetRunningObjectTable() Return DllCall( "Ole32.dll", "long", "GetRunningObjectTable", "dword", 0, "ptr*", 0 )[2] EndFunc Func ROT_CreateFileMoniker( $sNameId ) Return DllCall( "Ole32.dll", "long", "CreateFileMoniker", "wstr", $sNameId, "ptr*", 0 )[2] EndFunc Func ROT_CreateBindCtx() Return DllCall( "Ole32.dll", "long", "CreateBindCtx", "dword", 0, "ptr*", 0 )[2] EndFunc ; --- UDF functions --- ; Failure: Returns 0 ; Success: Returns $iHandle ; Registers an object and its identifying moniker in the ROT Func ROT_RegisterObject( $pObject, $sNameId, $iFlags = $ROTFLAGS_REGISTRATIONKEEPSALIVE ) If $pObject = Default Then Local $oDict = ObjCreate( "Scripting.Dictionary" ) $pObject = Ptr( $oDict ) EndIf If Not $pObject Or Not $sNameId Then Return 0 Local $oRunningObjectTable = ObjCreateInterface( ROT_GetRunningObjectTable(), $sIID_IRunningObjectTable, $dtag_IRunningObjectTable ) If Not IsObj( $oRunningObjectTable ) Then Return 0 Local $pMoniker = ROT_CreateFileMoniker( $sNameId ) If Not $pMoniker Then Return 0 Local $iHandle $oRunningObjectTable.Register( $iFlags, $pObject, $pMoniker, $iHandle ) Return $iHandle ? $iHandle : 0 EndFunc ; Returns unique GUID as string ; Copied from _WinAPI_CreateGUID Func ROT_CreateGUID() Local Static $tGUID = DllStructCreate( "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct" ) DllCall( "Ole32.dll", "long", "CoCreateGuid", "struct*", $tGUID ) Return "-" & DllCall( "Ole32.dll", "int", "StringFromGUID2", "struct*", $tGUID, "wstr", "", "int", 65536 )[2] EndFunc ; Failure: Returns 0 ; Success: Returns $aROT_List ; Enumerates objects and identifying monikers in the ROT Func ROT_Enumerate() Local $oRunningObjectTable = ObjCreateInterface( ROT_GetRunningObjectTable(), $sIID_IRunningObjectTable, $dtag_IRunningObjectTable ) If Not IsObj( $oRunningObjectTable ) Then Return 0 Local $pEnumMoniker $oRunningObjectTable.EnumRunning( $pEnumMoniker ) Local $oEnumMoniker = ObjCreateInterface( $pEnumMoniker, $sIID_IEnumMoniker, $dtag_IEnumMoniker ) If Not IsObj( $oEnumMoniker ) Then Return 0 Local $pMoniker, $oMoniker, $pBindCtx, $sMonikerName, $i = 0 Local $oDict = ObjCreate( "Scripting.Dictionary" ) While( $oEnumMoniker.Next( 1, $pMoniker, NULL ) = 0 ) $pBindCtx = ROT_CreateBindCtx() $oMoniker = ObjCreateInterface( $pMoniker, $sIID_IMoniker, $dtag_IMoniker ) $oMoniker.GetDisplayName( $pBindCtx, NULL, $sMonikerName ) $oDict.Add( "Key" & $i, $sMonikerName ) $i += 1 WEnd Local $aROT_List = $oDict.Items() Return $aROT_List EndFunc ; Failure: Returns 0 ; Success: Returns 1 ; Removes an object and its identifying moniker from the ROT Func ROT_Revoke( $iHandle ) If Not $iHandle Then Return 0 Local $oRunningObjectTable = ObjCreateInterface( ROT_GetRunningObjectTable(), $sIID_IRunningObjectTable, $dtag_IRunningObjectTable ) If Not IsObj( $oRunningObjectTable ) Then Return 0 Return Not $oRunningObjectTable.Revoke( $iHandle ) * 1 EndFunc 7z-fileThe 7z-file contains source code for the UDF and examples. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. IRunningObjectTable.7z Edited July 11, 2021 by LarsJ Updated the Threads section SEuBo, mLipok, Skysnake and 11 others 9 5 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Gianni Posted May 3, 2020 Share Posted May 3, 2020 (edited) Hi @LarsJ, thanks for this udf, it looks very powerful ...I'm already playing it ... I'm posting this just for a small problem on the examples in the part that starts another script, namely: ; Start child ShellExecuteWait( "2) Child.au3" ) it may not work as expected if AutoIt was installed with the "edit a script" option instead of "running a script" on a double click or shellexecute() on an .au3 file (as in my case) in that case, you can use something like this instead using Run or RunWait as appropriate, i.e. depending on ShellExecute or ShellExecuteWait: ; Start child RunWait(@AutoItExe & " /AutoIt3ExecuteScript " & '"2) Child.au3"') Thanks again Edited May 3, 2020 by Chimp changed Run with RunWait LarsJ 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Popular Post LarsJ Posted June 21, 2020 Author Popular Post Share Posted June 21, 2020 (edited) UsageAn obvious use of ROT objects is in connection with tasks such as inter-process communication (IPC) and job processing. The advantage of using ROT objects for these tasks is partly that you can handle large amounts of data and partly that you can handle the vast majority of AutoIt data types. Using a ROT object it's very easy to transfer arrays between two different processes. At the same time, the internal data types of the array elements are preserved. If an array containing integers, floats, and strings is passed from a sender to a recipient, then it's still integers, floats, and strings at the recipient. This means that the recipient can sort the array with exactly the same result as a sort of the array at the sender. Not just simple data types are preserved. If an array element contains another array (embedded array) or an object (embedded object), then this embedded array or object is still valid at the recipient. ROT objects are based on COM techniques. How is it possible that proprietary AutoIt data types such as arrays, can be transferred between a sender process and a receiver process using a technique based on standard COM data types? This is possible because the AutoIt array is converted to a safearray of variants (default COM array) at the sender and converted back to an AutoIt array at the receiver. But en route between sender and recipient it's a safearray. These conversions are performed automatically by internal AutoIt code (compiled C/C++ code, very fast). If you are interested you can find more information on these topics in Accessing AutoIt Variables. Passing array between AutoIt programsExamples\2) IPC Demo\Array\ contains two files that very simply demonstrate the exchange of arrays between programs running in two different processes. The example is a copy of the example in this thread but implemented with the new IRunningObjectTable UDF. 1) Server.au3: expandcollapse popup#include <Array.au3> #include "..\..\..\Includes\IRunningObjectTable.au3" Example() Func Example() MsgBox( 0, "Server", "This is server" ) Local $sDataTransferObject = "DataTransferObject" & ROT_CreateGUID() ROT_RegisterObject( Default, $sDataTransferObject ) ; Default => Object = Dictionary object Local $oDataTransferObject = ObjGet( $sDataTransferObject ) ; Dictionary object ; Create array Local $aArray[1000][10] For $i = 0 To 1000 - 1 For $j = 0 To 9 $aArray[$i][$j] = $i & "/" & $j Next Next _ArrayDisplay( $aArray, "Array on server" ) ; Transfer data $oDataTransferObject.Add( "$aArray", $aArray ) ; Start client RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & '"2) Client.au3" ' & $sDataTransferObject ) ; ------- Server waiting while client is executing ------- MsgBox( 0, "Server", "This is server again" ) ; Receive data on server $aArray = $oDataTransferObject.Item( "$aArray" ) _ArrayDisplay( $aArray, "Modified array on server" ) EndFunc 2) Client.au3: #include <Array.au3> Example() Func Example() MsgBox( 0, "Client", "This is client" ) ; Data transfer object Local $sDataTransferObject = $CmdLine[1] Local $oDataTransferObject = ObjGet( $sDataTransferObject ) ; Receive data on client Local $aArray = $oDataTransferObject.Item( "$aArray" ) _ArrayDisplay( $aArray, "Array on client" ) ; Modify array on client For $i = 0 To 100 - 1 $aArray[$i][0] = "Modified" $aArray[$i][1] = "on" $aArray[$i][2] = "client" Next _ArrayDisplay( $aArray, "Modified array on client" ) ; Transfer data $oDataTransferObject.Item( "$aArray" ) = $aArray EndFunc Passing array between AutoIt and VBScriptBecause ROT objects are based on standard COM code, it's possible to exchange data between an AutoIt program and other COM compatible programs e.g. VBScript. The files in Examples\3) IPC Demo2\VBScript\ demonstrate this: 1) Server.au3: expandcollapse popup#include <GUIConstantsEx.au3> #include "..\..\..\Includes\IRunningObjectTable.au3" Example() Func Example() Local $sArray = "ArrayData" ROT_RegisterObject( Default, $sArray ) ; Default => Object = Dictionary object Local $oArray = ObjGet( $sArray ) ; Dictionary object Local $aArray = [ 123, 123.123, "This is data from AutoIt" ] $oArray( "Array" ) = $aArray Local $sText = "Data exchange between AutoIt and VBScript" Local $hGui = GUICreate( $sText, 400, 300 ) $sText = "Run Client.vbs:" & @CRLF & _ "Open a Command Prompt in the current folder." & @CRLF & _ "Key in ""wscript Client.vbs"" and hit the Enter key." & @CRLF & @CRLF & _ "When you have seen the information in the MsgBox, press the button below." GUICtrlCreateLabel( $sText, 20, 60, 360, 80 ) $sText = "Press Button to continue" Local $idButton = GUICtrlCreateButton( $sText, 20, 180, 360, 30 ) GUISetState( @SW_SHOW, $hGui ) While 1 Switch GUIGetMsg() Case $idButton $aArray = $oArray( "Array" ) MsgBox( 0, "AutoIt: Array from VBScript", "Int: " & $aArray[0] & " (" & VarGetType( $aArray[0] ) & ")" & @CRLF & _ "Flt: " & $aArray[1] & " (" & VarGetType( $aArray[1] ) & ")" & @CRLF & _ "Str: " & $aArray[2] & " (" & VarGetType( $aArray[2] ) & ")" ) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete( $hGui ) EndFunc Client.vbs: Dim oArray, iAnswer Set oArray = GetObject( "ArrayData" ) iAnswer = MsgBox( "Int: " & oArray( "Array" )(0) & vbCrLf & _ "Flt: " & oArray( "Array" )(1) & vbCrLf & _ "Str: " & oArray( "Array" )(2), 0, "VBScript: Array from AutoIt" ) Dim aArray aArray = Array( 234, 234.234, "This is data from VBScript" ) oArray( "Array" ) = aArray Examples with programs like C# and VB.NET are probably more interesting than VBScript. This way, you can transfer (large) arrays from AutoIt to C# and VB.NET, perform array calculations in compiled code, and return arrays or results back to AutoIt. Here, the AutoIt and C#/VB.NET code are standalone programs that run in their own processes and are connected only through the ROT object. It's a new option to execute code sections that are bottlenecks in interpreted AutoIt code as compiled and possibly multithreaded C#/VB.NET code. Note that such a technique is very different from the technique in Using C# and VB Code in AutoIt through the .NET Framework, where all code runs in the same process. Passing data through ROT Objects (2020-07-11)In IPC Techniques through ROT Objects (Data types section) the AutoIt data types have been tested based on the example for the VarGetType() function in the help file. The data types are sent from Sender to Receiver with these results: $aArray : Array variable type. $dBinary : Binary variable type. $bBoolean : Bool variable type. $pPtr : Int32 variable type. $hWnd : Int32 variable type. $iInt : Int32 variable type. $fFloat : Double variable type. $oObject : Object variable type. $sString : String variable type. $tStruct : Not recognized as a valid variable type. $vKeyword : Keyword variable type. fuMsgBox : Not recognized as a valid variable type. $fuFunc : Not recognized as a valid variable type. $fuUserFunc : Not recognized as a valid variable type. Only the $tStruct and the function data types are not received correctly. The Int32 types for $pPtr and $hWnd can easily be converted to pointer and window handles with the Ptr() and HWnd() functions. In the following section (DllStruct section) it's shown how the $tStruct can be sent by converting the DllStruct to Binary data. In the Large array section (still in the IPC Techniques example) it's shown that even very large arrays can be passed with ROT objects. AutoIt/Perl integration is an example showing how to pass data back and forth between AutoIt and Perl scripts. Also between different programming languages, the data types are preserved with this technique. Edited July 11, 2020 by LarsJ Last section Hadin, ptrex, Gianni and 5 others 7 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
moimon Posted June 22, 2020 Share Posted June 22, 2020 Great, this UDF is a great support for data transfer between processes 😍Thank you 😚 Link to comment Share on other sites More sharing options...
LarsJ Posted July 11, 2020 Author Share Posted July 11, 2020 The first post (ROT objects section) and the third post (last section) have been updated. New 7z-file at bottom of first post. argumentum, NewCommer and Gianni 3 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
NewCommer Posted November 4, 2020 Share Posted November 4, 2020 On 7/11/2020 at 11:21 PM, LarsJ said: The first post (ROT objects section) and the third post (last section) have been updated. New 7z-file at bottom of first post. Thank you for sharing a very helpful UDF. Can I ask if we can create an event handle to catch the event when we put a value into the ROT Object? The example is similar to the PropertyChange event of DWebBrowserEvents2 Sorry my English is a bit bad Link to comment Share on other sites More sharing options...
LarsJ Posted November 4, 2020 Author Share Posted November 4, 2020 No, It's not possible to directly create such an event handler. However, you can signal events between server and clients using WM_USER messages. In the same way as it's done in the example about IPC Techniques. This assumes that a window exists in both server and clients. Since the ROT object in the examples is a dictionary object, another option is to create one or more additional key/item pairs in the dictionary object to signal events. Then both server and clients must check (regularly in a kind of loop) whether an item value has changed which indicates a new event. NewCommer 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Popular Post LarsJ Posted December 21, 2020 Author Popular Post Share Posted December 21, 2020 (edited) Executing Object Methods through VBScriptIn IPC Techniques through ROT Objects (Data types section) the AutoIt data types have been tested based on the example for the VarGetType() function in the help file. The data types are sent from Sender to Receiver with these results: $aArray : Array variable type. $dBinary : Binary variable type. $bBoolean : Bool variable type. $pPtr : Int32 variable type. $hWnd : Int32 variable type. $iInt : Int32 variable type. $fFloat : Double variable type. $oObject : Object variable type. $sString : String variable type. $tStruct : Not recognized as a valid variable type. $vKeyword : Keyword variable type. fuMsgBox : Not recognized as a valid variable type. $fuFunc : Not recognized as a valid variable type. $fuUserFunc : Not recognized as a valid variable type. Note that an AutoIt object is a data type that is sent correctly from one process to another through a ROT Object. What does it mean that an object is sent correctly from one process to another? This means that the object instance (the specific representation of the object) of the receiving process is exactly the same as the object instance of the sending process. The object of receiver and sender is simply the same object. It's the implementation of the ROT Object that ensures that the object of receiver and sender is the same. If an object $oHexEdit is sent from AutoIt code to VBScript code in this way: Local $sDictionaryData = "DictionaryData" ROT_RegisterObject( Default, $sDictionaryData ) ; Default => Object = Dictionary object Local $oROTobj = ObjGet( $sDictionaryData ) ; Dictionary object $oROTobj( "oHexEdit" ) = $oHexEdit and received in the VBScript code in this way: Dim oROTobj, oHexEdit Set oROTobj = GetObject( "DictionaryData" ) Set oHexEdit = oROTobj( "oHexEdit" ) then the $oHexEdit object in the AutoIt code and oHexEdit object in the VBScript code is the same object. Type mismatch errorWhat can all this be used for? This is an example of a Hex Editor ActiveX control based on this CodeProject article. A simple AutoIt implementation can look like this (HexEdit0.au3) expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() ; Create GUI GUICreate( "Hex Editor", 420, 420 ) ; Create COM error handler Local $oMyError = ObjEvent( "AutoIt.Error", "MyErrFunc" ) ; Create Com object Local $oHexEdit = ObjCreate( "HEXEDIT.HexEditCtrl.1" ) If Not IsObj( $oHexEdit ) Then Return ConsoleWrite( "$oHexEdit ERR" & @CRLF ) ConsoleWrite( "$oHexEdit OK" & @CRLF ) ; Create ActiveX control GUICtrlCreateObj( $oHexEdit, 10, 10, 400, 400 ) ; Show GUI GUISetState() ; Load HexEditDlg.exe into ActiveX control Local $hFile = FileOpen( "HexEditDlg.exe", 16 ), $dBinary = FileRead( $hFile ), $i = FileClose( $hFile ) ; 16 = $FO_BINARY $oHexEdit.SetData( $dBinary, 0 ) ; Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd #forceref $oMyError, $i EndFunc Func MyErrFunc( $oError ) ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc The HexEdit ActiveX control must be registered in an elevated Command Prompt with HexEditorOcx\register.bat included in the 7z-file below. HexEditDlg.exe is the test file that is loaded into the ActiveX control. Also contained in the 7z-file. You can also download it all directly from the CodeProject article. HexEditDlg.exe is the demo project. When you run the script in SciTE with F5 you'll see the following COM error in the console: $oHexEdit OK HexEdit0.au3 (30) : ==> COM Error intercepted ! err.number is: 0x80020005 err.windescription: Type mismatch. err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 30 err.retcode is: 0x00000000 Line 30 is this line: $oHexEdit.SetData( $dBinary, 0 ) The error is due to the binary data in $dBinary not being transferred correctly to the SetData() method. The first lines of the implementation of the SetData() method in HexEditCtl.cpp (not included in the 7z-file but can be downloaded from the article) looks like this: SCODE CHexEditCtrl::SetData(VARIANT FAR* pData, long dwStartAddr) { if ( ( pData->vt != (VT_ARRAY | VT_UI1) && pData->vt != (VT_ARRAY | VT_I1) ) || ::SafeArrayGetDim(pData->parray) != 1) VARIANT FAR* pData and pData->vt == (VT_ARRAY | VT_UI1) means that the first parameter in Setdata() must be a pointer to a variant, where the data field in the variant can contain a pointer to a safearray of bytes. A safearray of bytes is also referred to as a bytearray. In AutoIt, a bytearray is represented by the Binary data type. Since there are no other data types in AutoIt that correspond to a bytearray, there is actually not really anything to do about the error. The internal AutoIt code is capable of transferring the vast majority of parameter data types to an object method in the correct way. However, there are still several examples of parameter data types being passed incorrectly resulting in a data type mismatch error. And here the VBScript code comes into play. The VBScript language is coded by Microsoft, and Microsoft obviously knows how to pass data to an object method. The idea is to transfer both the $oHexEdit object and the binary data in $dBinary to a VBScript through a ROT Object and then execute the SetData() method directly in the VBScript. Executing VBScript codeHexEdit1.au3: expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "IRunningObjectTable.au3" Example() Func Example() ; Create GUI GUICreate( "Hex Editor", 420, 420 ) ; Create COM error handler Local $oMyError = ObjEvent( "AutoIt.Error", "MyErrFunc" ) ; Create Com object Local $oHexEdit = ObjCreate( "HEXEDIT.HexEditCtrl.1" ) If Not IsObj( $oHexEdit ) Then Return ConsoleWrite( "$oHexEdit ERR" & @CRLF ) ConsoleWrite( "$oHexEdit OK" & @CRLF ) ; Create ActiveX control GUICtrlCreateObj( $oHexEdit, 10, 10, 400, 400 ) ; Show GUI GUISetState() ; Load HexEditDlg.exe into ActiveX control Local $hFile = FileOpen( "HexEditDlg.exe", 16 ), $dBinary = FileRead( $hFile ), $i = FileClose( $hFile ) ; 16 = $FO_BINARY Local $sDictionaryData = "DictionaryData" ROT_RegisterObject( Default, $sDictionaryData ) ; Default => Object = Dictionary object Local $oROTobj = ObjGet( $sDictionaryData ) ; Dictionary object $oROTobj( "oHexEdit" ) = $oHexEdit $oROTobj( "dBinary" ) = $dBinary RunWait( 'wscript.exe "HexEdit1.vbs"' ) ; Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd #forceref $oMyError, $i EndFunc Func MyErrFunc( $oError ) ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc HexEdit1.vbs: Dim oROTobj, oHexEdit, dBinary Set oROTobj = GetObject( "DictionaryData" ) Set oHexEdit = oROTobj( "oHexEdit" ) dBinary = oROTobj( "dBinary" ) oHexEdit.SetData dBinary, 0 The ActiveX control in the AutoIt GUI is updated directly through the code in the VBScript: Hopefully someone will take up the challenge and implement a more complete Hex Editor. This is just a Hex Viewer. 7z-fileThe 7z-file contains all the necessary code and data. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. HexEdit is a 32 bit control. The code only runs as 32 bit code. Comments are welcome. Let me know if there are any issues. ObjectMethods.7z Edited December 21, 2020 by LarsJ mLipok, ptrex, Gianni and 2 others 3 2 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
ptrex Posted December 23, 2020 Share Posted December 23, 2020 Hi Lars, great to see you got it working. And we can learn from this! I kwew you were the right man on right place 😃 Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ptrex Posted December 23, 2020 Share Posted December 23, 2020 Hi Lars, I made some slight modifications in this version you don't need the external vbscript. expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "IRunningObjectTable.au3" Example() Func Example() ; Create GUI GUICreate( "Hex Editor", 420, 420 ) ; Create COM error handler Local $oMyError = ObjEvent( "AutoIt.Error", "MyErrFunc" ) ; Create Com object Local $oHexEdit = ObjCreate( "HEXEDIT.HexEditCtrl.1" ) If Not IsObj( $oHexEdit ) Then Return ConsoleWrite( "$oHexEdit ERR" & @CRLF ) ConsoleWrite( "$oHexEdit OK" & @CRLF ) ; Create ActiveX control GUICtrlCreateObj( $oHexEdit, 10, 10, 400, 400 ) ; Show GUI GUISetState() ; Load HexEditDlg.exe into ActiveX control Local $hFile = FileOpen( "HexEditDlg.exe", 16 ), $dBinary = FileRead( $hFile ), $i = FileClose( $hFile ) ; 16 = $FO_BINARY Local $sDictionaryData = "DictionaryData" ROT_RegisterObject( Default, $sDictionaryData ) ; Default => Object = Dictionary object Local $oROTobj = ObjGet( $sDictionaryData ) ; Dictionary object $oROTobj( "oHexEdit" ) = $oHexEdit $oROTobj( "dBinary" ) = $dBinary Local $code= 'Dim oROTobj, oHexEdit, dBinary' $code=$code & @CRLF & 'Set oROTobj = GetObject( "DictionaryData" )' $code=$code & @CRLF & 'Set oHexEdit = oROTobj( "oHexEdit" )' $code=$code & @CRLF & 'dBinary = oROTobj( "dBinary" )' $code=$code & @CRLF & 'oHexEdit.SetData dBinary, 0' ;~ ConsoleWrite($code & @CRLF & @CRLF) Local $vbs = ObjCreate("ScriptControl") $vbs.language="vbscript" $vbs.addcode($code) ROT_Revoke($oROTobj) ; Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd #forceref $oMyError, $i EndFunc Func MyErrFunc( $oError ) ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc Thanks again for the bright solution ! ptrex mLipok and LarsJ 1 1 Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
mLipok Posted January 12, 2021 Share Posted January 12, 2021 (edited) @LarsJ Because I am lost in your omniscience ... ... so I ask directly. Usually folks who want to have possibility to use ActiveX object need to do something like this: Quote regsvr32 ChilkatAx-9.5.0-win32.dll Question 1: Could you provide an example how to use such object ? $CHILKATOBJ_PROGID='Chilkat_9_5_0.Task' $CHILKATOBJ_CLSID='{EFA96FEC-9371-4C3B-AB6D-DA9CDEF3CC41}' $CHILKATOBJ_IID='{F312552A-2E77-4866-95CA-A3699D7D6ED2}' Question 2: If I use your's solutions is that mean that this ChilkatAx-9.5.0-win32.dll will be registered persistently ? I mean even If stop the script and try to use the same object from from any other language* ? *( of course language which is able to access ActiveX objects ) Edited January 12, 2021 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted January 12, 2021 Share Posted January 12, 2021 (edited) 15 hours ago, mLipok said: Question 1: Could you provide an example how to use such object ? $CHILKATOBJ_PROGID='Chilkat_9_5_0.Task' $CHILKATOBJ_CLSID='{EFA96FEC-9371-4C3B-AB6D-DA9CDEF3CC41}' $CHILKATOBJ_IID='{F312552A-2E77-4866-95CA-A3699D7D6ED2}' Question 2: If I use your's solutions is that mean that this ChilkatAx-9.5.0-win32.dll will be registered persistently ? I mean even If stop the script and try to use the same object from from any other language* ? Here is example: expandcollapse popup#AutoIt3Wrapper_UseX64=N ;~ #AutoIt3Wrapper_AutoIt3Dir="z:\AutoItPortable\AutoIt_3_3_12\" ;~ #AutoIt3Wrapper_AutoIt3Dir="z:\AutoItPortable\AutoIt_3_3_14_5" #AutoIt3Wrapper_AutoIt3Dir="z:\AutoItPortable\AutoIt_3_3_15_3" #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;~ #AutoIt3Wrapper_Run_Debug_Mode=Y #Tidy_Parameters=/sort_funcs /reel #include <Array.au3> #include <Debug.au3> #include <FileConstants.au3> #include <StringConstants.au3> ;~ https://chilkatdownload.com/9.5.0.84/chilkatax-9.5.0-win32.zip Global $sDLL_FileFullPath = @ScriptDir & '\ChilkatAx-9.5.0-win32.dll' Global $__g_hDll_CHILKAT = DllOpen($sDLL_FileFullPath) Global $oErrorHandler = ObjEvent("AutoIt.Error", __Test_COM_ERROR_HANDLER__for_Chilkat) # REMARK if this following 2 variable are not set, then is used this feature: https://www.autoitscript.com/forum/topic/149405-using-a-com-property-out-of-not-registered-dll/?tab=comments#comment-1064413 Global $b_Use_Registered_AcitveX = False ; only with regsvr32 ChilkatAx-9.5.0-win32.dll Global $b_Use_IRunningObjectTable = False ; https://www.autoitscript.com/forum/topic/202618-implementing-irunningobjecttable-interface/ _Example_28_HTTP_DownloadBdAsync() Exit Func __Test_COM_ERROR_HANDLER__for_Chilkat(ByRef $oError) ; User's COM error function. Will be called if COM error occurs ; Do anything here. ConsoleWrite( _ @ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted from Chilkat object!" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & _ @CRLF) EndFunc ;==>__Test_COM_ERROR_HANDLER__for_Chilkat Func _Example_28_HTTP_DownloadBdAsync() ; https://www.example-code.com/vbscript/box_download_binary_to_memory.asp Local $sUnlockCode = FileRead(@ScriptDir & '\!!!_MY_SECRET_DATA\MyLicenseKey.txt') If @error Then $sUnlockCode = "Anything for 30-day trial" Local $oGlobal If $b_Use_Registered_AcitveX Then $oGlobal = ObjCreate("Chilkat_9_5_0.Global") Else $oGlobal = _TEST_Chilkat_GLOBAL_ObjCreate() EndIf If @error Then MsgBox($MB_OK + $MB_TOPMOST + $MB_ICONERROR, 'Global', '@error = ' & @error & @CRLF & '@extended = ' & @extended) $oGlobal.UnlockBundle($sUnlockCode) _Test_ObjName_FlagsValue($oGlobal) Local $oHttp If $b_Use_Registered_AcitveX Then $oHttp = ObjCreate("Chilkat_9_5_0.Http") Else $oHttp = _TEST_Chilkat_HTTP_ObjCreate() EndIf If @error Then MsgBox($MB_OK + $MB_TOPMOST + $MB_ICONERROR, 'Http', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ConsoleWrite(@ScriptLineNumber & @CRLF & $oHttp.LastErrorText & @CRLF) Local $oBinData If $b_Use_Registered_AcitveX Then $oBinData = ObjCreate("Chilkat_9_5_0.BinData") Else $oBinData = _TEST_Chilkat_BINDATA_ObjCreate() EndIf If @error Then MsgBox($MB_OK + $MB_TOPMOST + $MB_ICONERROR, 'BinData', '@error = ' & @error & @CRLF & '@extended = ' & @extended) Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable. Local $oTask = $oHttp.DownloadBdAsync("https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe", $oBinData) ConsoleWrite('! IsObj($oTask) = ' & IsObj($oTask) & @CRLF) ConsoleWrite('! VarGetType($oTask) = ' & VarGetType($oTask) & @CRLF) ConsoleWrite(@CRLF) ;~ _Test_ObjName_FlagsValue($oTask) ;~ ConsoleWrite(@ScriptLineNumber & @CRLF & $oHttp.LastErrorText & @CRLF) Local $iSuccess = $oTask.Run() If $iSuccess <> 1 Then ConsoleWrite(@ScriptLineNumber & @CRLF & $oTask.LastErrorText & @CRLF) Else Local $iCurPctDone = 0 While $oTask.Finished <> 1 And $oTask.StatusInt < 5 If ($oTask.PercentDone <> $iCurPctDone) Then $iCurPctDone = $oTask.PercentDone ConsoleWrite("+ Downloading progress = " & $iCurPctDone & '%' & ' Status = ' & $oTask.Status & @CRLF) EndIf $oTask.SleepMs(100) WEnd ConsoleWrite("+ Downloading progress = " & 100 & '%' & ' Status = ' & $oTask.Status & @CRLF) ConsoleWrite("Downloaded into an object holding the binary data." & @CRLF) ConsoleWrite("Number of bytes: " & $oBinData.NumBytes & @CRLF) Local $hFileOpen = FileOpen(@ScriptDir & "\autoit-v3-setup.exe", $FO_BINARY + $FO_OVERWRITE) FileWrite($hFileOpen, $oBinData.GetBinary()) FileClose($hFileOpen) Local $fDiff = TimerDiff($hTimer) ; Find the difference in time from the previous call of TimerInit. The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff. MsgBox(0, 'DowlnoadBdAsync speed', _ 'Downoladed: ' & $oBinData.NumBytes & ' bytes' & @CRLF & _ 'Time: ' & $fDiff / 1000 & ' seconds' & @CRLF & _ @CRLF & _ 'Speed: ' & ($oBinData.NumBytes / 1024) / ($fDiff / 1000) & ' KBytes/seconds' & @CRLF & _ @CRLF & _ '') $oGlobal.FinalizeThreadPool() EndIf EndFunc ;==>_Example_28_HTTP_DownloadBdAsync Func _TEST_Chilkat_BINDATA_ObjCreate() ; 'Chilkat_9_5_0.BinData' ; https://www.autoitscript.com/forum/topic/149405-using-a-com-property-out-of-not-registered-dll/?tab=comments#comment-1064413 If $b_Use_IRunningObjectTable Then # PLEASE ADD ROT EXAMPLE HERE .... example should Return desired objects Else Return _ ObjCreate( _ '{FF6CA005-E9AA-418C-9555-3842B8BD54BB}', _ '{DDD8463D-2F40-43F8-8C05-F9090816D65D}', _ $__g_hDll_CHILKAT) EndIf EndFunc ;==>_TEST_Chilkat_BINDATA_ObjCreate Func _TEST_Chilkat_GLOBAL_ObjCreate() ; 'Chilkat_9_5_0.Global' ; https://www.autoitscript.com/forum/topic/149405-using-a-com-property-out-of-not-registered-dll/?tab=comments#comment-1064413 If $b_Use_IRunningObjectTable Then # PLEASE ADD ROT EXAMPLE HERE .... example should Return desired objects Else Return _ ObjCreate( _ '{B2429147-23BE-4A55-8EAE-2AFF2635815B}', _ '{4995C839-42F3-4D4F-8A08-1BA24B5F5E8F}', _ $__g_hDll_CHILKAT) EndIf EndFunc ;==>_TEST_Chilkat_GLOBAL_ObjCreate Func _TEST_Chilkat_HTTP_ObjCreate() ; 'Chilkat_9_5_0.Http' ; https://www.autoitscript.com/forum/topic/149405-using-a-com-property-out-of-not-registered-dll/?tab=comments#comment-1064413 If $b_Use_IRunningObjectTable Then # PLEASE ADD ROT EXAMPLE HERE .... example should Return desired objects Else Return _ ObjCreate( _ '{A74C26D2-2429-4099-8672-2250B15E327F}', _ '{C754C4B4-6B0A-4664-ADDD-45467F0BCB7E}', _ $__g_hDll_CHILKAT) EndIf EndFunc ;==>_TEST_Chilkat_HTTP_ObjCreate Func _Test_ObjName_FlagsValue(ByRef $oObj, $sComment = @ScriptLineNumber) Local $sInfo = '' If Not IsObj($oObj) Then $sInfo &= 'Parameter - is not Object' & @CRLF ElseIf VarGetType($oObj) <> 'Object' Then $sInfo &= 'Parameter type - is not Object type' & @CRLF Else $sInfo &= '+>' & @TAB & 'ObjName($oObj,1) {The name of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_NAME) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF ; HELPFILE REMARKS: Not all Objects support flags 2 to 7. Always test for @error in these cases. $sInfo &= '+>' & @TAB & 'ObjName($oObj,2) {Description string of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_STRING) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,3) {The ProgID of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_PROGID) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,4) {The file that is associated with the object in the Registry} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_FILE) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,5) {Module name in which the object runs (WIN XP And above). Marshaller for non-inproc objects.} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_MODULE) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,6) {CLSID of the object''s coclass} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_CLSID) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,7) {IID of the object''s interface} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_IID) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF EndIf ConsoleWrite($sComment & ' _Test_ObjName_FlagsValue' & @CRLF & $sInfo & @CRLF) EndFunc ;==>_Test_ObjName_FlagsValue The problem is also described by me here: https://stackoverflow.com/questions/65484117/chilkat-cannot-get-activex-interface and the answer was here: Quote It's because Chilkat is returning a new instance of the Task object. To create the ActiveX object instance (from within the C++ implementation) requires that the ActiveX DLL be registered. – Chilkat Software Jan 7 at 23:58 Conclusion / Question: Is it possible to use ROT to register object that will be avalaible for Chilkat internal processing ? Edited January 12, 2021 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
ptrex Posted January 12, 2021 Share Posted January 12, 2021 (edited) I don't see any problems ? I access the REGFREE object's properties : And no problems. #AutoIt3Wrapper_UseX64=N ; Error Monitoring Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Exit EndFunc ;==>_ErrFunc Global $sDLL_FileFullPath = @ScriptDir & '\ChilkatAx-9.5.0-win32.dll' Global $__g_hDll_CHILKAT = DllOpen($sDLL_FileFullPath) $hActiveX = ObjCreate( _ '{A74C26D2-2429-4099-8672-2250B15E327F}', _ '{C754C4B4-6B0A-4664-ADDD-45467F0BCB7E}', _ $__g_hDll_CHILKAT) MsgBox(0,"RegFree COM DLL","ChilkatAx : " & $hActiveX.version & @CRLF) $oHttp = ObjCreate( _ '{A74C26D2-2429-4099-8672-2250B15E327F}', _ '{C754C4B4-6B0A-4664-ADDD-45467F0BCB7E}', _ $__g_hDll_CHILKAT) Local $Path = @ScriptDir&"\Test.exe" Local $Success = $oHttp.Download("https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe", $Path) If $Success <> 1 Then ConsoleWrite($oHttp.LastErrorText & @CRLF) EndIf DllClose($__g_hDll_CHILKAT) I expanded the test using the download method in the COM object and again no problem Except that this DLL is not free of charge apparently to get access to all functionality. It works as expected ? Can't do more at this moment ... Edited January 13, 2021 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
mLipok Posted January 13, 2021 Share Posted January 13, 2021 (edited) 13 hours ago, ptrex said: I access the REGFREE object's properties : You are using @trancexx soultions, like I have in my habbits. Generally it is ok. But with Chilkat ActiveX component the case is different. Chilkat ActiveX component it contains many different objects. When I developer use *ASyn methods like in this following example: Local $oTask = $oHttp.DownloadBdAsync(....) Then you have a situation when $oHttp (Chilkat_9_5_0.Http) is created by @trancexx But If you do not use : Quote regsvr32 ChilkatAx-9.5.0-win32.dll then Chlikat component internal processing could not create $oTask (Chilkat_9_5_0.Task). And in such case using my script you will get: Quote ! IsObj($oTask) = 0 ! VarGetType($oTask) = Object "Z:\!!!_SVN_AU3\UDF_Forum\mLipok\Test\Chilkat_Examples_Null_Test.au3" (89) : ==> The requested action with this object has failed.: Local $iSuccess = $oTask.Run() Local $iSuccess = $oTask^ ERROR or using AutoIt 3.3.12.x Quote Chilkat_Examples_Null_Test.au3 (89) : ==> COM Error intercepted from Chilkat object! err.number is: 0x00000003 err.windescription: Object Invoke failed So I askQuestion 1: If ROT can add "Chilkat_9_5_0.Task" to the system table ? ..... But in such way that Chilkat Component will see it, as a registered obejct (like after using regsvr32 ChilkatAx-9.5.0-win32.dll).Question 2: Is this added "Chilkat_9_5_0.Task" will be persistent/permament or only on AutoIt runtime ? Edited January 13, 2021 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
ptrex Posted January 13, 2021 Share Posted January 13, 2021 Hard to test it since it is not free of charge COM DLL ? I am not an ROT expert, best is that @LarsJ jumps in ... Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
mLipok Posted January 13, 2021 Share Posted January 13, 2021 45 minutes ago, ptrex said: Hard to test it since it is not free of charge COM DLL There is 30days free trial from first using. Just try. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
ptrex Posted January 13, 2021 Share Posted January 13, 2021 Sure I can try, but I will not have a solution... Most likely the reason is that some methods spawn different Async processes. And this is a problem in AutoIt. Maybe someone has a solution for this but I don't have any... Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
LarsJ Posted January 16, 2021 Author Share Posted January 16, 2021 (edited) A little late. Sorry. I've been busy. I'm also very busy all next week. These are comments to the discussion in this and the following posts. The Running Object Table (ROT) has something to do with COM clients and servers. The program that registers an object in the ROT plays the role of server. One or more programs that access the ROT object with the ObjGet() function or a similar function play the role of clients. The ROT object is only available as long as the server program is running or until the server program deletes the object with the ROT_Revoke() function. Since client and server code run in separate processes, ROT objects usually also have something to do with code running in different processes. You do not normally use ROT objects in connection with code that all runs in the same process. An obvious use of ROT objects is therefore in connection with IPC techniques. These can be IPC techniques between programs implemented in the same language, and IPC techniques between programs implemented in different languages. It'll work as long as the languages are COM compatible languages. Another possible use of ROT objects is in connection with the execution of object methods that for one reason or another do not work in AutoIt. Then one can create a ROT object to pass the problem object along with any data to another scripting language, and maybe successfully execute the object method in that language. This use of ROT objects is demonstrated here. There are plenty of other uses of ROT objects limited only by fantasy and imagination. mLipok, So in terms of making a regsvr32 free registration of the Chilkat objects I don't immediately think ROT objects are of any benefit. Maybe if it's possible to make a regsvr32 free registration of the Chilkat objects in another language, and then pass the objects to AutoIt through a ROT object. Edited January 16, 2021 by LarsJ mLipok 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
ptrex Posted January 16, 2021 Share Posted January 16, 2021 mLipok Here I just posted and example on how to invoke RegFree COM Objects using VBScript Object in AutoIt... https://www.autoitscript.com/forum/topic/204903-dllcalls-using-vbscripts-possible/?do=findComment&comment=1473051 This might be a way to solve your problem ... Either call the Chilkat from VBScript or you can call it from PowerShell and used the CLR.Net approach to do this in AutoIT ? Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
HurleyShanabarger Posted January 11, 2023 Share Posted January 11, 2023 Thank you for this UDF, it is very helpful. I managed to exchange data with python: import os import win32com.client obROT = win32com.client.GetObject(Identifier) arData = lv_obROT("Data2Python_arData") but, I did not manage to achieve the same for C#. Does someone know, if this is possible or must I use this? LarsJ 1 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