LeTran Posted February 22 Posted February 22 (edited) I tried to follow the instruction found here. I am able to get python to print "Hello World". How do I pass data back to Autoit? Do I need to add another string object to DataTransferObject from python? #include <IRunningObjectTable.au3> Global $sShared = "Hello World" HotKeySet("{ESC}", "Terminate") Local $sDataTransferObject = "DataTransferObject" ROT_RegisterObject( Default, $sDataTransferObject ) ; Default => Object = Dictionary object Local $oDataTransferObject = ObjGet( $sDataTransferObject ) ; Dictionary object $oDataTransferObject.Add( "$sShared", $sShared ) while 1 if $sShared <> "Hello World" Then MsgBox(0,"",$sShared) EndIf WEnd Func Terminate() TrayTip("", "Exiting " & @CRLF, 5) Sleep(2000) Exit EndFunc ;==>Terminate import pythoncom import win32com.client context = pythoncom.CreateBindCtx(0) running_coms = pythoncom.GetRunningObjectTable() monikiers = running_coms.EnumRunning() for monikier in monikiers: print('-'*100) print(monikier.GetDisplayName(context,monikier)) if monikier.GetDisplayName(context,monikier) == 'DataTransferObject': oDict = win32com.client.GetObject(monikier.GetDisplayName(context,monikier)) sShared=oDict("$sShared") print(sShared) Edited February 22 by LeTran
LeTran Posted February 22 Author Posted February 22 Figured it out. Need to add $sShared = $oDataTransferObject.Item("$sShared") in while loop to receive from python. argumentum 1
LeTran Posted February 24 Author Posted February 24 I now have a problem updating the variable $sShared. I assumed you only need to add it once, and as the variable changes it automatically updates. However this is not the case. If I change the variable $sShared and tries to update with the code below. It spits out an error. So how do I update it so python can read the changes? $oDataTransferObject.Add( "$sShared", $sShared )
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