jugador Posted October 24, 2023 Share Posted October 24, 2023 (edited) reference post https://www.autoitscript.com/forum/topic/202618-implementing-irunningobjecttable-interface/?do=findComment&comment=1525707 Main.au3 #include "RegisterActiveObject UDF3.au3" __ExampleA() Func __ExampleA() Local $s_Clsid Local $o_object = __RegisterActiveObject(Default, $s_Clsid) If @error Or Not IsObj($o_object) Then Return Local $aArray[2] = ["Item A0", "item A1"] $o_object.add("String", 'Apple') $o_object.add("Number", 12345) $o_object.add("Array", $aArray) ConsoleWrite('$o_object -> Count item: ' & $o_object.Count & @CRLF) RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & '"Client.au3" ' & $s_Clsid) ConsoleWrite('$o_object -> Count item: ' & $o_object.Count & @CRLF) __RevokeActiveObject() EndFunc Client.au3 MsgBox( 0, "Client", "Client Started" ) __Client($CmdLine[1]) Func __Client($o_Clsid) Local $m_object = ObjGet("", $o_Clsid) If Not IsObj($m_object) Then Return MsgBox(0, "Client", '$m_object -> Count item: ' & $m_object.Count) $m_object.add("Double", 567.55) MsgBox( 0, "Client", "client End" ) EndFunc for connect to vbscipt change this line of Main.au3 RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & '"Client.au3" ' & $s_Clsid) to RunWait( 'wscript.exe "Client.vbs" ' & ObjName($o_object, 3)) Client.vbs Dim Arg Arg = WScript.Arguments(0) Set M_object = GetObject(, Arg) msgbox VarType(M_object) & " " & TypeName(M_object) msgbox M_object.Count M_object.Add "Double", 567.55 Set M_object = Nothing RegisterActiveObject UDF2.au3 RegisterActiveObject UDF3.au3 Edited October 26, 2023 by jugador mLipok, Danyfirex, junkew and 1 other 4 Link to comment Share on other sites More sharing options...
jugador Posted November 28, 2023 Author Share Posted November 28, 2023 Beside RegisterActiveObject other method to send objects from one script to another ShellBrowserWindow https://www.autohotkey.com/boards/viewtopic.php?p=183046#p183046 LresultFromObject https://www.autohotkey.com/boards/viewtopic.php?f=6&p=439611 Link to comment Share on other sites More sharing options...
argumentum Posted November 29, 2023 Share Posted November 29, 2023 I always get "{EE09B103-97E0-11CF-978F-00A02463E06F}". How can I run 2 different scripts if they all use the same $s_Clsid ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
ioa747 Posted November 29, 2023 Share Posted November 29, 2023 in the effort to understand and take advantage of what @jugador simply shares with us. I try to combine two @jugador works (Thanks for sharing) 47048-scripting-dictionary/#comment-1516044 211008-registeractiveobject/#comment-1525860 the idea is to make CrossDictionaryUDF as a communication channel, to share information between multiple scripts a first approach CrossDictionaryUDF.zip many things I used them as is. I hope in time to understand them better and reformulate them argumentum 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Andreik Posted November 29, 2023 Share Posted November 29, 2023 I am not necessarily a COM fan but if I remember right RegisterActiveObject causes an object to be listed in ROT. I am not sure what this script does more or better than existing code on the forum. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
argumentum Posted November 29, 2023 Share Posted November 29, 2023 That example was nice @ioa747. {EE09B103-97E0-11CF-978F-00A02463E06F} still the same and my question is: what if I have more than one script with this IPC ?. Can there be a way to "salt it" so to say. Make it unique ? 39 minutes ago, Andreik said: I am not necessarily a COM fan but if I remember right RegisterActiveObject causes an object to be listed in ROT. I am not sure what this script does more or better than existing code on the forum. 1) Why not a COM fan ( necessarily ) 2) What's the good/bad/ugly of ROT ? TIA Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Andreik Posted November 29, 2023 Share Posted November 29, 2023 (edited) 1 hour ago, argumentum said: 1) Why not a COM fan ( necessarily ) 2) What's the good/bad/ugly of ROT ? I am not a fan of COM programming not because I want to avoid an ugly side or something like that but because I don't usually have to work with COM to achieve my goals. Sometimes I use UDFs that use COM programming, dictionaries or other stuffs like that but in most cases I don't need anything more than native AutoIt. So I am not against COM programming, I just don't have many projects in this area. Edited November 29, 2023 by Andreik argumentum 1 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
jugador Posted November 30, 2023 Author Share Posted November 30, 2023 @argumentum Why {EE09B103-97E0-11CF-978F-00A02463E06F}? As I make Scripting.Dictionary default object due to it's flexibility to support different type of variable. You will get different Clsid if you have tried registering different object other than Scripting.Dictionary __RegisterActiveObject('object of your choice', $s_Clsid) can I run 2 different scripts if they all use the same $s_Clsid ? if you are asking something like this then yes it work Func __Example_A() Local $oObj[5] For $i = 0 To UBound($oObj) - 1 $oObj[$i] = ObjCreate( "Scripting.Dictionary" ) Next ;..... Local $s_Clsid ;~ other object remain immune as it register only $oObj[3] instance even though there Clsid is same. Local $o_object = __RegisterActiveObject($oObj[3], $s_Clsid) EndFunc This will not work. Need to tweak this UDF to use dummy Clsid but then ObjGet will not work you have to use __GetActiveObject to get the Register Object. Func __Example_B() Local $oObj[5] For $i = 0 To UBound($oObj) - 1 $oObj[$i] = ObjCreate( "Scripting.Dictionary" ) Next Local $s_ClsidA, $s_ClsidB Local $o_objectA = __RegisterActiveObject($oObj[1], $s_ClsidA) Local $o_objectB = __RegisterActiveObject($oObj[3], $s_ClsidB) ;..... EndFunc @ioa747 Thanks for posting scripting-dictionary code. that time was experimenting with scripting-dictionary to avoid using Global while coding argumentum and ioa747 2 Link to comment Share on other sites More sharing options...
jugador Posted December 1, 2023 Author Share Posted December 1, 2023 Not able to understand AutoHotkey class Object concept but assumption is it's IDispatch Object and can be created using @trancexx __ObjectFromTag . I will open new thread about AutoHotkey class Object concept for help. So not able convert the AutoHotkey LresultFromObject code due to this class Object logic. But succeed using LresultFromObject and ObjectFromLresult on Scripting.Dictionary Object argumentum 1 Link to comment Share on other sites More sharing options...
jugador Posted December 4, 2023 Author Share Posted December 4, 2023 (edited) https://www.autoitscript.com/forum/topic/38671-creating-com-objects-without-a-need-of-dlls/ https://admhelp.microfocus.com/uft/en/all/VBScript/Content/html/c52b52d3-e11d-49f1-96c8-69b3c9ce8ade.htm just thinking comparison to AutoHotkey class Object we can use Windows Script Components(wsc) file to create this class property & method. and get the object using ObjGet Local $o_wscObj = ObjGet("script:" & 'wsc file path') Edited December 4, 2023 by jugador Link to comment Share on other sites More sharing options...
argumentum Posted December 4, 2023 Share Posted December 4, 2023 1 hour ago, jugador said: we can use Windows Script Components(wsc) file to create this class property & method. "Creating a COM object using WSC is long time end of life unfurtunatly. " Mailsolts is also depreciated and I use it everywhere It may disappear tomorrow, or never. Nonetheless when something is depreciated, might as well not exist, as it will brake code in due time and worst of all, we were told. jugador 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. 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