Jump to content

Search the Community

Showing results for tags 'irunningobjecttable'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. Hi there, while I created an example script to generate and execute a function during runtime, I stumbled across a neat way to share data between running autoit scripts. This is done using the amazing magic of AutoItObject_Internal . (You'll need at least Version 3.0.0 of AutoItObject_Internal) Using this UDF, you can create a shared data storage, basically an empty "AutoitObject_Internal-"Object which you can then use to write / read data Inline. no set/get methods, just #include "AutoItSharedData.au3" $oShare = _AutoIt_SharedData_CreateOrAttach("MyCustomID") $oShare.some_data = 'foo' and you're done. any other script accessing this data will have to do: #include "AutoItSharedData.au3" $oShare = _AutoIt_SharedData_CreateOrAttach("MyCustomID") ConsoleWrite($oShare.some_data & @LF) Basically it's Larsj's Implementing IRunningObjectTable Interface, but you dont have a Dictionary, but an IDIspatch Object instead. There are already a bunch of IPC options available - and this is another one. AutoItSharedData.au3 Example Script 1 Example Script 2 Output: To test: run Example Script 1, Then run example Script 2.. or the other way around. Example Script 3 Example_sharedata3.au3 Example_sharedata3_Controlsend.au3 Example_sharedata3_Tooltip.au3 To test: run Example_sharedata3.au3. Output: Example SharedData4: Output: /Edit: Please note that there's a limitation with the Running object table : The Script accessing a variable first, will be the "server" for this variable. This means, access to that variable from other scripts should only be possible, as long the "server" script is running! Use appropriate Object Error handlers in case you don't want the surviving "clients" to crash. Feedback and/or improvements appreciated changelog version 2.0 Removed need for AutoItObject, as AutoItObject_Internal now comes with ROT support Added UDF Header Fixed typo on "#include AutoItObjectInternal.au3" -> "#include AutoItObject_Internal.au3" Added ObjGet() after registering the object fails (in case 2 programs tried to register the same ID simultaneously) Updated Examples & zip archive. Cheers, AutoItSharedData.zip
  2. So I'm trying to register a object to the running object table (ROT). I am doing something wrong, i just can't see what. any help would be appreciated AutoItObject_Internal.au3 IRunningObjectTable::Register method #include "AutoItObject_Internal.au3" $IID_IRunningObjectTable = "{00000010-0000-0000-C000-000000000046}" $IID_IMoniker = "{0000000f-0000-0000-C000-000000000046}" $AutoItError = ObjEvent("AutoIt.Error", "ErrFunc") ; Install a custom error handler Func ErrFunc($oError) ConsoleWrite("!>COM Error !"&@CRLF&"!>"&@TAB&"Number: "&Hex($oError.Number,8)&@CRLF&"!>"&@TAB&"Windescription: "&StringRegExpReplace($oError.windescription,"\R$","")&@CRLF&"!>"&@TAB&"Source: "&$oError.source&@CRLF&"!>"&@TAB&"Description: "&$oError.description&@CRLF&"!>"&@TAB&"Helpfile: "&$oError.helpfile&@CRLF&"!>"&@TAB&"Helpcontext: "&$oError.helpcontext&@CRLF&"!>"&@TAB&"Lastdllerror: "&$oError.lastdllerror&@CRLF&"!>"&@TAB&"Scriptline: "&$oError.scriptline&@CRLF) EndFunc ;==>ErrFunc $IDispatch = IDispatch() $IDispatch.name = "my name is Danny" $IRunningObjectTable = DllCall("Ole32.dll","LONG","GetRunningObjectTable","DWORD",0,"PTR*",0) If @error<>0 Then Exit MsgBox(0, @ScriptLineNumber, @error) $IRunningObjectTable = ObjCreateInterface($IRunningObjectTable[2],$IID_IRunningObjectTable,"Register HRESULT(DWORD,PTR*,PTR*,DWORD*);Revoke HRESULT(DWORD);IsRunning HRESULT(PTR*);GetObject HRESULT(PTR*,PTR**);NoteChangeTime HRESULT(DWORD,PTR*);GetTimeOfLastChange HRESULT(PTR*,PTR*);EnumRunning HRESULT(PTR*);",True) If @error<>0 Then Exit MsgBox(0, @ScriptLineNumber, @error) $sCLSID="AutoIt.COMDemo" $IMoniker=DllCall("Ole32.dll", "LONG", "CreateFileMoniker", "WSTR", $sCLSID, "PTR*", 0) If @error<>0 Then Exit MsgBox(0, @ScriptLineNumber, @error) $dwRegister=0 $IRunningObjectTable.Register( 0, Ptr($IDispatch), $IMoniker[2], $dwRegister ) If @error<>0 Then Exit 1 If $dwRegister=0 Then Exit 2 $IRunningObjectTable.Revoke($dwRegister) Opt("GuiOnEventMode", 1) $hWnd=GUICreate("Title",700,320) GUISetState(@SW_SHOW,$hWnd) GUISetOnEvent(-3, "_MyExit", $hWnd) While 1 Sleep(10) WEnd Func _MyExit() $IDispatch=0 Exit EndFunc Thanks in advance
×
×
  • Create New...