Jump to content

Implementing IRunningObjectTable Interface


LarsJ
 Share

Recommended Posts

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 by Chimp
changed Run with RunWait

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

The first post (ROT objects section) and the third post (last section) have been updated. New 7z-file at bottom of first post.

Link to comment
Share on other sites

  • 3 months later...
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

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.

Link to comment
Share on other sites

  • 1 month later...

Hi Lars,

I made some slight modifications in this version you don't need the external vbscript.

#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

Link to comment
Share on other sites

  • 2 weeks later...

@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 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 Codefor 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 APIErrorLog.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 TaskSchedulerIE 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 stuffOnHungApp handlerAvoid "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"
:naughty:  :ranting:, 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

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:

#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 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 Codefor 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 APIErrorLog.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 TaskSchedulerIE 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 stuffOnHungApp handlerAvoid "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"
:naughty:  :ranting:, 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

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 by ptrex
Link to comment
Share on other sites

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 ask
Question 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 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 Codefor 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 APIErrorLog.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 TaskSchedulerIE 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 stuffOnHungApp handlerAvoid "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"
:naughty:  :ranting:, 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

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 Codefor 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 APIErrorLog.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 TaskSchedulerIE 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 stuffOnHungApp handlerAvoid "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"
:naughty:  :ranting:, 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

Link to comment
Share on other sites

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 by LarsJ
Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

  • 1 year later...

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