#Region Header #CS Name: Container UDF Author: Copyright © 2011 CreatoR's Lab (G.Sandler), www.creator-lab.ucoz.ru, www.autoit-script.ru. All rights reserved. AutoIt version: 3.3.6.1 UDF version: 1.0 History: #CE #include-once #EndRegion Header #Region Global Variables Global $oContainer_COMErr #EndRegion Global Variables #Region Public Functions ; #FUNCTION# ==================================================================================================== ; Name...........: _Container_Open ; Description....: Creates global object for interaction between processes. ; Syntax.........: _Container_Open($sName, $iMode) ; Parameters.....: $sName - Container name to use for data transfer. ; $iMode - Defines container mode: ; 0 - open to recieve data. ; 1 - open for sending data. ; ; Return values..: Container object to use later with PutProperty/GetProperty. ; ; Author.........: G.Sandler (CreatoR) ; Modified.......: ; Remarks........: ; Related........: _Container_PutProperty, _Container_GetProperty ; Link...........: ; Example........: Yes. ; =============================================================================================================== Func _Container_Open($sName, $iMode) Local $oShell, $oShellWindow, $oShellWindows $oContainer_COMErr = ObjEvent("AutoIt.Error", "__Container_COMErrHandler") $oShell = ObjCreate("Shell.Application") $oShellWindows = $oShell.Windows For $oShellWindow In $oShellWindows If $oShellWindow.StatusText = $sName Then Return $oShellWindow EndIf Next If $iMode = 0 Then Return SetError(1, 0, 0) EndIf $oContainer = ObjGet("new:{C08AFD90-F2A1-11D1-8455-00A0C91F3880}") $oContainer.StatusText = $sName Return $oContainer EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _Container_Close ; Description....: Closes the container object. ; Syntax.........: _Container_Close($oContainer) ; Parameters.....: $oContainer - Container object as returned by _Container_Open. ; ; Return values..: Always 1. ; ; Author.........: G.Sandler (CreatoR) ; Modified.......: ; Remarks........: ; Related........: _Container_Open. ; Link...........: ; Example........: ; =============================================================================================================== Func _Container_Close($oContainer) $oContainer_COMErr = 0 $oContainer.StatusText = '' Return 1 EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _Container_PutProperty ; Description....: Puts data into the Container. ; Syntax.........: _Container_PutProperty($oContainer, $sName, $vValue) ; Parameters.....: $oContainer - Container object as returned by _Container_Open. ; $sVarName - Variable name to set. ; $vValue - Value for $sVarName. ; ; Return values..: None. ; ; Author.........: G.Sandler (CreatoR) ; Modified.......: ; Remarks........: $sVarName is case sensitive, e.g. "var" is not the same as "Var"! ; Related........: _Container_Open, _Container_GetProperty ; Link...........: ; Example........: ; =============================================================================================================== Func _Container_PutProperty($oContainer, $sVarName, $vValue) $oContainer.PutProperty($sVarName, $vValue) EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _Container_GetProperty ; Description....: Get data from the Container. ; Syntax.........: _Container_GetProperty($oContainer, $sVarName) ; Parameters.....: $oContainer - Container object as returned by _Container_Open. ; $sVarName - Variable name to get the data from. ; ; Return values..: The value from $sVarName variable. ; ; Author.........: G.Sandler (CreatoR) ; Modified.......: ; Remarks........: $sVarName is case sensitive, e.g. "var" is not the same as "Var"! ; Related........: _Container_Open, _Container_PutProperty ; Link...........: ; Example........: ; =============================================================================================================== Func _Container_GetProperty($oContainer, $sVarName) Return $oContainer.GetProperty($sVarName) EndFunc #EndRegion Public Functions #Region Internal Functions ;Helper function to handle COM Errors Func __Container_COMErrHandler() SetError(1) Endfunc #EndRegion Internal Functions