Jump to content
Sign in to follow this  
PhoenixXL

Just The Text

Recommended Posts

PhoenixXL

TRANSPARENT TEXT UDF.

FLOATING TEXT UDF.

Hey Here is a UDF that Lets You Draw a Text with much of the Parameters.

I know there is already Such Things Present

Then also I just wanted to share This

The Code

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1
Author:      Phoenix XL

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------
;============================GLOBAL DECLARATIONS===================================================
Global Const $WS_POPUP = 0x80000000
Global Const $WS_EX_TOOLWINDOW = 0x00000080
Global Const $WS_EX_TOPMOST = 0x00000008
Global Const $WS_EX_LAYERED = 0x00080000
Global Const $GUI_WS_EX_PARENTDRAG = 0x00100000
Global Const $GUI_BKCOLOR_TRANSPARENT = -2
Global Const $GUI_DOCKALL = 0x0322
;============================GLOBAL DECLARATIONS===================================================

#Region -Example-
;Example just Remove THe Semi Colons...... :)
;$1=_JustTheText('H',@DesktopWidth/2+10,@DesktopHeight/2,0,1) ;U can Drag The H character.....
;$2=_JustTheText('E',@DesktopWidth/2+20,@DesktopHeight/2,0)
;$3=_JustTheText('Y',@DesktopWidth/2+30,@DesktopHeight/2,0)
;$4=_JustTheText('A',@DesktopWidth/2+40,@DesktopHeight/2,0)
;Local $x=0

;While $x<10
; Sleep(1000)
; $x+=1
;WEnd

;_EraseText($4[0])
;_EraseText($3[0])
;_EraseText($2[0])
;_EraseText($1[0])
#EndRegion -Example-


#Region -Public Functions-
;===============================================================================
;
; Function Name:    _JustTheText($iText,$iLeft=0,$iTop=0,$iReturn=1,$iTimeOut=3000,$iFade=1,$iFadeTimeout=2000,$iTextColor=255,$font='Arial',$iFontSize=14,$iWeight=400, $iAttribute=0)
; Description:   Types Text on the Present Gui
;
; Parameter(s):  $iText  - The Text U want To Display
;                $iLeft  - The Left Coordinate Where U want Ur Text To Be
;                $iTop -The Top Coordinate Where U want Ur Text to be
;                $iReturn
;                   | 1      - Will Type The Text and Erase It Upon TimeOut
;                   | 0      - Use to make the Text Permanent and erase it upon calling _EraseText()
; Returns an Array with $Array[0]= Handle to the Gui (Required By _EraseText() )
; $Array[1] = Handle To The Label
; $sMovable
; | 0 (Will Not Move){Default}
; | 1 (Is Movable)

; $iTimeOut - The Time(in Milliseconds) The Text Will Remain in its Normal Form
; $iFade
; |1(if u want the Text to Appear And Dissapear with Fade) ;
; |0(If u dont want the Text to Fade)

; $iFadeTimeout - The Time The Text Will Take For Fading

; $iTextColor - The Color Of the Text

; $font - The Font Of the Text {See GUISetFont() for more Help}

; $iFontSize -The Size of the Font {See GUISetFont() for more Help}

; $iWeight -The Weight of the Font {See GUISetFont() for more Help}

; $iAttribute - THe Attribute of the Font {See GUISetFont() for more Help}

; Requirement(s): AutoIt3 Beta

; Return Value(s): On Success - Returns 1 if $iReturn=1
;                On Failure - Returns 0 if $iReturn=1
; if $Return=0
; Returns an Array with
; $Array[0]= Handle to the Gui (Required By _EraseText() )
; $Array[1] = Handle To The Label
;
; Author(s):        Phoenix XL
;
;===============================================================================
Func _JustTheText($iText,$iLeft=0,$iTop=0,$iReturn=1,$sMovable=0,$iTimeOut=3000,$iFade=1,$iFadeTimeout=2000,$iTextColor=255,$font='Arial',$iFontSize=14,$iWeight=400, $iAttribute=0,$iBk_Color=0xABCDEF)
Local $iLabel,$pos

;================Default and -1 Detector......
_DefaultAnalyser($iLeft,0)
_DefaultAnalyser($iTop,0)
_DefaultAnalyser($iReturn,1)
_DefaultAnalyser($sMovable,0)
_DefaultAnalyser($iTimeOut,3000)
_DefaultAnalyser($iFade,1)
_DefaultAnalyser($iFadeTimeout,2000)
_DefaultAnalyser($iTextColor,255)
_DefaultAnalyser($font,'Arial')
_DefaultAnalyser($iFontSize,14)
_DefaultAnalyser($iWeight,400)
_DefaultAnalyser($iAttribute,0)
_DefaultAnalyser($iBk_Color,0xABCDEF)
;================Default and -1 Detector......

Local $iGui=GUICreate('',-1,-1,$iLeft,$iTop,$WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_LAYERED))
GUISetBkColor($iBk_Color)
GUISetFont($iFontSize, $iWeight, $iAttribute, $font,$iGui)
WinSetTrans($iGui,'',0)
GUISetState(@SW_SHOW,$iGui)
Switch $sMovable
Case 1
$iLabel=GUICtrlCreateLabel($iText,0,0,-1,-1,-1,$GUI_WS_EX_PARENTDRAG)
Case Else
$iLabel=GUICtrlCreateLabel($iText,0,0)
EndSwitch
GUICtrlSetColor(-1, $iTextColor)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
_fade($iGui,0,255,256/($iFadeTimeout/10))
$pos=ControlGetPos($iGui,'',$iLabel)
WinMove($iGui,'',Default,Default,$pos[2],$pos[3],100)
Switch $iReturn
Case 0
Local $Return[2]
$Return[0]=$iGui
$Return[1]=$iLabel
Return $Return
Case 1
Sleep($iTimeOut)
_fade($iGui,255,0,-1*(256/($iFadeTimeout/10)))
Return GUIDelete($iGui)
EndSwitch
EndFunc


;===============================================================================
;
; Function Name:    _EraseText($hWnd,$iFade=1,$iFadeTimeout=2000)
; Description:   Erases The Typed Text
;
; Parameter(s):  $hWnd   - The Handle of the GUI returned by JustTheText() function
;                $iFade
; |1(if u want the Text to Appear And Dissapear with Fade) ;
; |0(If u dont want the Text to Fade)
;                $iTop -The Top Coordinate Where U want Ur Text to be
;                $iReturn
;                | 1         - ToolbarWindow32, Win2000+
;                | 0         - Use to make the Text Permanent and erase it upon calling _EraseText()
; Returns an Array with $Array[0]= Handle to the Gui (Required By _EraseText() )
; $Array[1] = Handle To The Label
; $iFadeTimeout - The Time The Text Will Take For Fading

; Requirement(s): AutoIt3 Beta
; Return Value(s): On Success - Returns 1 if operation was successfull
;                On Failure - If invalid parameters, returns -1
;
; Author(s):        PhoenixXL
;
;===============================================================================
Func _EraseText($hWnd,$iFade=1,$iFadeTimeout=2000)
;================Default and -1 Detector......
_DefaultAnalyser($iFade,1)
_DefaultAnalyser($iFadeTimeout,2000)
;================Default and -1 Detector......
If $iFade Then _fade($hWnd,255,0,-1*(256/($iFadeTimeout/10)))
Return GUIDelete($hWnd)
EndFunc

#Endregion -Public Functions-





;==========#INTERNAL FUNCTIONS=====================================================================
;Fades in and Out as per Required............
;Author: Phoenix XL
Func _fade($hWnd,$from=0,$to=255,$step=0.025,$Alpha= 0xABCDEF)
For $l=$from To $to Step $step
_WinAPI_SetLayeredWindowAttributes($hWnd,$Alpha,$l)
Sleep(10)
Next
If @error Then Return 1
Return 0
EndFunc

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_SetLayeredWindowAttributes
; Description ...: Sets Layered Window Attributes
; Syntax.........: _WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor[, $Transparency = 255[, $dwFlags = 0x03[, $isColorRef = False]]])
; Parameters ....: $hwnd - Handle of GUI to work on
;                $i_transcolor - Transparent color
;                $Transparency - Set Transparancy of GUI
;   $dwFlags - Flags.
;                $isColorRef - If True, $i_transcolor is a COLORREF( 0x00bbggrr ), else an RGB-Color
; Return values .: Success - 1
;                @Error - 0
;                |@error: 1 to 3 - Error from DllCall
;                |@error: 4 - Function did not succeed - use _WinAPI_GetLastErrorMessage to get more information
; Author ........: Prog@ndy
; Modified.......:
; Remarks .......:
; Related .......: _WinAPI_GetLayeredWindowAttributes, _WinAPI_GetLastError
; Link ..........: @@MsdnLink@@ SetLayeredWindowAttributes
; Example .......: Yes
; ===============================================================================================================================
Func _WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $dwFlags = 0x03, $isColorRef = False)
If $dwFlags = Default Or $dwFlags = "" Or $dwFlags < 0 Then $dwFlags = 0x03
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $aResult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hWnd, "dword", $i_transcolor, "byte", $Transparency, "dword", $dwFlags)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0]
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

#cs
Name _DefaultAnalyser()

Syntax: _DefaultAnalyser($sDefault,ByRef $sParameter)

Parameters:
$sVariable(ByRef) :The Variable to Check/Compare
$sDefault :Pass the Default Value of the Varialble which has to be set When Default Keyword or -1 is used

Return Values:
This Function Doesn't Return Anything

Remarks: This Function Checks the Value of a Variable and Sets it to the Optional Value Whenever Default(keyword) or -1 is Detected.......

Example: Check The Bottom Of The The Script

Author: Phoenix XL
#ce
Func _DefaultAnalyser(ByRef $sVariable,$sDefault)
;ConsoleWrite('Variable Value:'&$sVariable&@TAB&'Default Value:'&$sDefault&@CRLF)
Switch $sVariable
Case Default,-1
$sVariable=$sDefault
EndSwitch
EndFunc
;==========#INTERNAL FUNCTIONS=====================================================================

Regards

Edited by PhoenixXL
  • Like 1

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
knightz93

nice.. ;)


[font=verdana,geneva,sans-serif]I will do my best in this forum [/font][font=verdana,geneva,sans-serif]my code :[/font] WindowsSwitcher3d()

Share this post


Link to post
Share on other sites
PhoenixXL

Thanks knightz93


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
PhoenixXL

Added The 4th Parameter to Move the Character(s) in the Type Text Modified Script.

Also Added the Support of 'Default' Keyword and '-1'

Check The First Post for Download or Copy the Source Code. ;)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
PhoenixXL

Thnx .

I already had a look in your _FloatText UDF..

Its Seems Pretty Good..

I have replied U there for Modification.

Regards

Phoenix XL

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×