sandman Posted August 23, 2007 Posted August 23, 2007 NOTE: Thanks to PsaltyDS for the original idea in this post.This is a very simple library, doing simple things, but hopefully increasing the usability of inter-script communication. This uses GUI labels (visible or invisible) as its main structure. Anyway, I'll just show the code.expandcollapse popup#cs _MessageTerminal Function Library Function List: _MessageTerminalCreate() _MessageTerminalDelete() _MessageTerminalSend() _MessageTerminalGet() #ce #include <GUIConstants.au3> #region _MessageTerminalCreate() #cs =============================================================================== Description: Creates a message terminal. Parameter(s): $vControl: The variable (which a control will be created with). $iVisible: 0 = Not visible. (Recommended) 1 = Visible. If for some reason, you want to show the user the message, choose this. It will be positioned at 0,0. You're better off just linking it with another label so you can position it, though. $sText: Initial text. Requirement(s): None Return Value(s): On Success: Returns the handle to the message terminal. On Failure: Returns 0. Author(s): sandman Note(s): =============================================================================== #ce Func _MessageTerminalCreate(ByRef $vControl, $iVisible = 0, $sText = "") If $iVisible = 1 Then $vControl = GUICtrlCreateLabel($sText, 0, 0) GUICtrlSetState($vControl, $GUI_SHOW) ElseIf $iVisible = 0 Then $vControl = GUICtrlCreateLabel($sText, 0, 0) GUICtrlSetState($vControl, $GUI_HIDE) EndIf Return $vControl EndFunc #endregion #region _MessageTerminalDelete() #cs =============================================================================== Description: Deletes a message terminal. Parameter(s): $hControl: The handle to the control. Requirement(s): None Return Value(s): On Success: Returns 1. On Failure: Returns 0. Author(s): sandman Note(s): =============================================================================== #ce Func _MessageTerminalDelete(ByRef $hControl) GUICtrlDelete($hControl) If @error Then Return 0 Return 1 EndFunc #endregion #region _MessageTerminalSend() #cs =============================================================================== Description: Send a message to a message terminal. Parameter(s): $hControl: The handle to the control. $sMessage: The message to send. Requirement(s): None Return Value(s): On Success: On Failure: Author(s): sandman Note(s): =============================================================================== #ce Func _MessageTerminalSend(ByRef $hControl, $sMessage) GUICtrlSetData($hControl, $sMessage) EndFunc #endregion #region _MessageTerminalGet() #cs =============================================================================== Description: Receive data from a message terminal. Parameter(s): $sWinTitle: The title of the window containing the message terminal. $sControlID: The ID of the control (you can get this by MsgBox'ing the handle, it should return a number.) Requirement(s): None Return Value(s): On Success: Returns the data of the message terminal. On Failure: Returns -1. Author(s): sandman Note(s): =============================================================================== #ce Func _MessageTerminalGet($sWinTitle, $sControlID) Local $text = ControlGetText($sWinTitle, "", "[ID:" & $sControlID & "]") If @error Then Return -1 Return $text EndFunc #endregionI have also created an example archive if you would like to see this for yourself. Download the file below, and run Example.au3 and Example2.au3 simultaneously. IT NEEDS TO BE EXTRACTED!! _MessageTerminal.zip (2K) Number of downloads: And finally, the UDF alone: _MessageTerminal.au3 (3.2K) Number of downloads: [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
WolfWorld Posted August 23, 2007 Posted August 23, 2007 Easy And Nice Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets!
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