Jump to content
Sign in to follow this  
Vindicator209

Ticker Tape

Recommended Posts

Vindicator209

Hey, is there a way to simulate a tickertape (marquee) without haveing to move a label pixel by pixel?

im sure some one had asked this before but I couldn't find their post...

thanks


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites
magician13134

Yeah, I did this in one of my programs. I found the easiest way was to create a Child GUI on top of another GUI so it didn't have to take up the entire GUI... hmm... that didn't sound too helpful...

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 0)
$AboutGUI = GUICreate("About iDFree", 436, 251, -1, -1, $WS_BORDER)
WinSetOnTop("About iDFree", "", 1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic(@TempDir & "\about.gif", 0, 0, 436, 251)
GUICtrlSetState(-1, $GUI_DISABLE)

$close = GUICtrlCreateButton(" Ok! ", 380, 75, 35, 22)
$win = WinGetPos("About iDFree")
$child = GUICreate("About scroller", 175, 115, $win[0]+260, $win[1]+125, $WS_POPUP, $WS_EX_TRANSPARENT, $AboutGUI)
GUISetBkColor(0xFFFFFF)
$AboutLabel = GUICtrlCreateLabel("Coded by Ben Perkins" & @CR & "Magic Soft Inc." & @CR & "Inspired by:" & @CR & "Alex Bagby and Ichaelmay58" & _
                    @CR & "BG image thanks to Reel Big Fish" & @CR & @CR & "-The Magician", 1, -80, 170, 105, BitOr($SS_NOTIFY, $SS_RIGHT))
GUISetState(@SW_SHOW, $AboutGUI)
GUISetState(@SW_SHOW, $child)

While 1
    For $i = -105 to 130
        $msg = GUIGetMsg()
        ControlMove("About scroller", "", $AboutLabel, 1, 30-$i)
        If $msg = $close Then
            Opt("GUIOnEventMode", 1)
            GUIDelete($AboutGUI)
            Return
        EndIf
        sleep(50)
    Next
WEnd

I don't think the bg image is really necessary to this...

Hope this helps...

Share this post


Link to post
Share on other sites
Obi-w00t

Could you not just set the text in an edit box to simulate a marquee? Use a loop to set the text of the edit box to look as if text is scrolling across, people do a similar thing in Javascript for manipulating the status bar and title of a web page.

Share this post


Link to post
Share on other sites
magician13134

But the edit box always has that outline... if he really wants it to look like a marquee... I dunno... I could try to write a UDF for you... I don't really know how well it'd turn out though...

Share this post


Link to post
Share on other sites
GrungeRocker

A Script by peethebee:

; ================================================
;           V E R S I O N    1 . 9 . 3
; ================================================
;
; This is as far as I know the frist AutoIt UDF
; dealing with text animations. I myself believe
; that such an easy but impressing effect can be
; very uesfull.
; I hope you like it. Feel free to post comments
; in the AutoIt forums or email me at
; peter_opali@gmx.de!
;
; peethebee, Germany
;
;
; Special Thanks to:
;       - "gafrost" for his solution of the
;             WinXPSP2/W2k problem
;
;
; Short summary of all effect functions:
;
; _txt_eff__about_messages
; _txt_eff__airport
; _txt_eff__blink
; _txt_eff__broad
; _txt_eff__color_sequence
; _txt_eff__color_to_color
; _txt_eff__enlarge_from_left
; _txt_eff__enlarge_from_right
; _txt_eff__mix_up_chars
; _txt_eff__move_cap_char_through_text
; _txt_eff__move_in_from_left
; _txt_eff__move_in_from_right
; _txt_eff__move_out_to_left
; _txt_eff__move_out_to_right
; _txt_eff__move_small_char_through_text
; _txt_eff__move_string_through_text
; _txt_eff__raining
; _txt_eff__rainbow
; _txt_eff__scroll_through_options
; _txt_eff__show_text_behind_char
; _txt_eff__small
; _txt_eff__spin
; _txt_eff__spotlight
; _txt_eff__style
; _txt_eff__uncover_from_wall_to_wall
; _txt_eff__wave
; _txt_eff__zoom
;
; =================================================

#include-once

#include <String.au3>
#include <math.au3>
#include <Array.au3>
#include <Color.au3>


; ---------------------------------
; ---------------------------------
; ----  1. pure text animation ----
; ---------------------------------
; ---------------------------------


;===============================================================================
;
; Description:      Enlarge the given text in the given control from left to right.
; Syntax:           _txt_eff__enlarge_from_left($winhandle, $control_id, [$text, [$delay, [$over_old]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $over_old - 0: delete old text before starting / 1: do not delete it
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__enlarge_from_left($winhandle, $control_id, $text = "", $delay = 100, $over_old = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    If $over_old = 1 Then
        $orig_text = ControlGetText($winhandle, "", $control_id)
        If StringLen($orig_text) < StringLen($text) Then
            For $i = StringLen($orig_text) To StringLen($text)
                $orig_text = $orig_text & " "
            Next
        ElseIf StringLen($orig_text) > StringLen($text) Then
            For $i = StringLen($text) To StringLen($orig_text)
                $text = $text & " "
            Next
        EndIf
    EndIf
    For $i = 1 To StringLen($text)
        $out_string = StringLeft($text, $i)
        If $over_old = 1 Then $out_string = $out_string & "  " & StringTrimLeft($orig_text, $i + 2)
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
    Return 1
EndFunc   ;==>_txt_eff__enlarge_from_left


;===============================================================================
;
; Description:      Enlarge the given text in the given control from right to left.
; Syntax:           _txt_eff__enlarge_from_right($winhandle, $control_id, [$text, [$delay , [$over_old]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), , $over_old - 0: delete old text before starting / 1: do not delete it
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          Only looks good when using a monospace font like Courier New
;
;===============================================================================
Func _txt_eff__enlarge_from_right($winhandle, $control_id, $text = "", $delay = 100, $over_old = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    If $over_old = 1 Then
        $orig_text = ControlGetText($winhandle, "", $control_id)
        If StringLen($orig_text) < StringLen($text) Then
            For $i = StringLen($orig_text) To StringLen($text)
                $orig_text = $orig_text & " "
            Next
        ElseIf StringLen($orig_text) > StringLen($text) Then
            For $i = StringLen($text) To StringLen($orig_text)
                $text = $text & " "
            Next
        EndIf
    EndIf
    For $i = 1 To StringLen($text)
        $out_string = StringRight($text, $i)
        If $over_old = 1 Then
            $out_string = StringTrimRight($orig_text, $i + 2) & "  " & $out_string
            If $i = StringLen($text) - 1 Then ExitLoop
        Else
            For $j = $i To StringLen($text) - 1
                $out_string = " " & $out_string
            Next
        EndIf
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
    If $over_old = 1 Then
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, " " & StringRight($text, StringLen($text) - 1))
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $text)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    EndIf
    Return 1
EndFunc   ;==>_txt_eff__enlarge_from_right


;===============================================================================
;
; Description:      Move a given text in the given control in from left side.
; Syntax:           _txt_eff__move_in_from_left($winhandle, $control_id, [$text, [$delay]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow)
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__move_in_from_left($winhandle, $control_id, $text = "", $delay = 100)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    For $i = 1 To StringLen($text)
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, StringRight($text, $i))
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
EndFunc   ;==>_txt_eff__move_in_from_left


;===============================================================================
;
; Description:      Move a given text in the given control out to left side.
; Syntax:           _txt_eff__move_out_to_left($winhandle, $control_id, [$text, [$delay]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow)
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__move_out_to_left($winhandle, $control_id, $text = "", $delay = 100)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    For $i = StringLen($text) To 0 Step - 1
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, StringRight($text, $i))
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, "")
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Return 1
EndFunc   ;==>_txt_eff__move_out_to_left


;===============================================================================
;
; Description:      Move a given text in the given control in from right side.
; Syntax:           _txt_eff__move_in_from_right($winhandle, $control_id, [$text, [$delay , [$text_min_width]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $text_min_width - enlarge the text to this min length if it shorter
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          Only looks good when using a monospace font like Courier New
;
;===============================================================================
Func _txt_eff__move_in_from_right($winhandle, $control_id, $text = "", $delay = 100, $text_min_width = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    If $text_min_width <> 0 Then
        For $i = StringLen($text) To $text_min_width
            $text = $text & " "
        Next
    EndIf
    For $i = 1 To StringLen($text)
        $out_string = StringLeft($text, $i)
        For $j = $i To StringLen($text) - 1
            $out_string = " " & $out_string
        Next
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
    Return 1
EndFunc   ;==>_txt_eff__move_in_from_right


;===============================================================================
;
; Description:      Move a given text in the given control out to right side.
; Syntax:           _txt_eff__move_out_to_right($winhandle, $control_id, [$text, [$delay, [$text_min_width]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $text_min_width - enlarge the text to this min length if it shorter
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          Only looks good when using a monospace font like Courier New
;
;===============================================================================
Func _txt_eff__move_out_to_right($winhandle, $control_id, $text = "", $delay = 100, $text_min_width = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    If $text_min_width <> 0 Then
        For $i = StringLen($text) To $text_min_width
            $text = $text & " "
        Next
    EndIf
    For $i = StringLen($text) To 0 Step - 1
        $out_string = StringLeft($text, $i)
        For $j = $i To StringLen($text) - 1
            $out_string = " " & $out_string
        Next
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, "")
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Return 1
EndFunc   ;==>_txt_eff__move_out_to_right


;===============================================================================
;
; Description:      Uncover a given text in the given control behind a given password char.
; Syntax:           _txt_eff__show_text_behind_char($winhandle, $control_id, [$text, [$delay, [$char]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $char - the foregroud char
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__show_text_behind_char($winhandle, $control_id, $text = "", $delay = 100, $char = "*")
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    For $i = 0 To StringLen($text)
        $out_string = StringLeft($text, $i)
        ; Add specified char for every char that's still "covered"
        For $j = 1 To StringLen($text) - $i
            $out_string = $out_string & $char
        Next
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
    Return 1
EndFunc   ;==>_txt_eff__show_text_behind_char


;===============================================================================
;
; Description:      Move a string through the given text in the given control.
; Syntax:           _txt_eff__move_string_through_text($winhandle, $control_id, [$text, [$delay, [$string, [$show_complete_text]]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $string - string to move through, $show_complete_text - 0: uncover text while animatione / 1: show it from start on
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__move_string_through_text($winhandle, $control_id, $text = "", $delay = 100, $string = "->", $show_complete_text = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    For $i = 1 To StringLen($text) + 1
        $out_string = StringLeft($text, $i - 1) & $string
        If $show_complete_text = 1 Then $out_string = $out_string & StringRight($text, StringLen($text) - $i - StringLen($string))
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Return 1
EndFunc   ;==>_txt_eff__move_string_through_text


;===============================================================================
;
; Description:      Shows a airport-like effect in the given control.
; Syntax:           _txt_eff__airport($winhandle, $control_id, [$text, [$delay, [$start_char, [$skip_chars]]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $start_char - char to start the scrolling with (ASCII-Order), $skip_chars - number of chars to skip in every step
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__airport($winhandle, $control_id, $text = "", $delay = 100, $start_char = "A", $skip_chars = 1)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    For $i = 1 To StringLen($text)
        $act_char = StringMid($text, $i, 1)
        For $j = Asc($start_char) To Asc($act_char) Step $skip_chars
            $out_string = StringLeft($text, $i - 1) & Chr($j)
            For $k = 1 To StringLen($text) - $i
                $out_string = $out_string & Chr($j)
            Next
            If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, $out_string)
            If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
            Sleep($delay)
        Next
    Next
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Return 1
EndFunc   ;==>_txt_eff__airport


;===============================================================================
;
; Description:      Spins a given text around in the given control.
; Syntax:           _txt_eff__spin($winhandle, $control_id, [$text, [$delay, [$num_spins, [$spin_delay]]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $num_spins - number of spins, $spin_delay - delay between 2 spin-arounds
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__spin($winhandle, $control_id, $text = "", $delay = 100, $num_spins = "1", $spin_delay = 0)
    If $spin_delay = "" Then $spin_delay = $delay
    
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    For $i = 1 To $num_spins
        Sleep($spin_delay)
        
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $text)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        For $j = 1 To Round(StringLen($text) / 2) - 1
            Sleep($delay)
            $out_string = StringTrimRight(StringTrimLeft($text, $j), $j)
            For $k = 1 To $j
                $out_string = " " & $out_string & " "
            Next
            If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, $out_string)
            If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Next
        
        For $j = Round(StringLen($text) / 2) - 1 To 1 Step - 1
            Sleep($delay)
            $out_string = StringTrimRight(StringTrimLeft(_StringReverse($text), $j), $j)
            For $k = 1 To $j
                $out_string = " " & $out_string & " "
            Next
            If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, $out_string)
            If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Next
        
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, _StringReverse($text))
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        For $j = 1 To Round(StringLen($text) / 2) - 1
            Sleep($delay)
            $out_string = StringTrimRight(StringTrimLeft(_StringReverse($text), $j), $j)
            For $k = 1 To $j
                $out_string = " " & $out_string & " "
            Next
            If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, $out_string)
            If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Next
        For $j = Round(StringLen($text) / 2) - 1 To 1 Step - 1
            Sleep($delay)
            $out_string = StringTrimRight(StringTrimLeft($text, $j), $j)
            For $k = 1 To $j
                $out_string = " " & $out_string & " "
            Next
            If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, $out_string)
            If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Next
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $text)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Next
    Return 1
EndFunc   ;==>_txt_eff__spin


;===============================================================================
;
; Description:      Widens a given text in the given control.
; Syntax:           _txt_eff__broad($winhandle, $control_id, [$text, [$delay, [$char, [$go_back, [$delay_before_go_back]]]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $char - char to insert into original text, $go_back - 1: call the ...small effect after widening it / 0: do not call it, $delay_before_go_back - time to wait before going back
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__broad($winhandle, $control_id, $text = "", $delay = 100, $char = " ", $go_back = "0", $delay_before_go_back = 500)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    $rounds = StringLen($text) - 1
    For $i = 1 To $rounds
        $num_left = $i + ($i - 1) * StringLen($char)
        $left = StringLeft($text, $i + ($i - 1) * StringLen($char))
        $right = StringRight($text, StringLen($text) - $num_left)
        $text = $left & $char & $right
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $text)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Sleep($delay)
    Next
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    If $go_back = "1" Then
        Sleep($delay_before_go_back)
        _txt_eff__small($winhandle, $control_id, $delay * 0.55, $char) ; _txt_eff__broad is about 45 % faster than _txt_eff__small
    EndIf
    Return 1
EndFunc   ;==>_txt_eff__broad


;===============================================================================
;
; Description:      Smallens a given text in the given control.
; Syntax:           _txt_eff__small($winhandle, $control_id, [$delay, [$char]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $delay - Animation speed (1 = fast, 1000 = slow), $char - char to remove
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
;
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None; fixed in v1.9.1
;
;===============================================================================
Func _txt_eff__small($winhandle, $control_id, $delay = 100, $char = " ")
    $del_counter = 0
    $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    $out_string = $text
    For $i = StringLen($text) To 1 Step - 1
        Sleep($delay)
        If (StringMid($out_string, $i, 1) = $char) and ($del_counter < 1) Then
            $out_string = StringLeft($out_string, $i - 1) & StringTrimLeft($out_string, $i)
            $del_counter = $del_counter + 1
        Else
            $del_counter = 0
        EndIf
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Next
    Return 1
EndFunc   ;==>_txt_eff__small


;===============================================================================
;
; Description:      Shows a rain like effect, all letters are falling doiwn.
; Syntax:           _txt_eff__raining($winhandle, $control_id, [$text, [$delay, [$duration, [$over_old]]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow), $duration = maximum effect time (ms), $over_old - 0: Remove old text before startin effect / 1: Do not remove it
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__raining($winhandle, $control_id, $text = "", $delay = 50, $duration = 3000, $over_old = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    If $over_old = 1 Then
        $orig_text = ControlGetText($winhandle, "", $control_id)
        $out_string = $orig_text
        If StringLen($orig_text) < StringLen($text) Then
            For $i = StringLen($orig_text) To StringLen($text)
                $out_string = $out_string & " "
            Next
        ElseIf StringLen($orig_text) > StringLen($text) Then
            For $i = StringLen($text) To StringLen($orig_text)
                $text = $text & " "
            Next
        EndIf
    Else
        $out_string = ""
        For $i = 1 To StringLen($text)
            $out_string = $out_string & " "
        Next
    EndIf
    
    $time = 0
    While $time <= $duration - $delay
        Sleep($delay)
        $pos = Random(1, StringLen($text), 1)
        $out_string = StringLeft($out_string, $pos - 1) & StringMid($text, $pos, 1) & StringTrimLeft($out_string, $pos)
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        $time = $time + $delay
    WEnd
    
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Return 1
EndFunc   ;==>_txt_eff__raining


;===============================================================================
;
; Description:      Moves a capital letter trough the text.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow),
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          New in v1.6
;
;===============================================================================
Func _txt_eff__move_cap_char_through_text($winhandle, $control_id, $text = "", $delay = 50, $effect_width_chars = 1, $direction = "to_right", $convert_to_small = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    If $direction = "to_left" Then
        $start = StringLen($text) - StringLen($effect_width_chars)
        $end = 0
        $step = -1
    Else
        $start = 0
        $end = StringLen($text) - StringLen($effect_width_chars)
        $step = 1
    EndIf
    
    $res_text = $text
    If $convert_to_small = 1 Then $res_text = StringLower($text)
    
    For $i = $start To $end Step $step
        Sleep($delay)
        $left = StringLeft($res_text, $i)
        $middle = StringUpper(StringMid($res_text, $i + 1, $effect_width_chars))
        $right = StringTrimLeft($res_text, $i + $effect_width_chars)
        $out_string = $left & $middle & $right
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Next
    Sleep($delay)
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Return 1
EndFunc   ;==>_txt_eff__move_cap_char_through_text


;===============================================================================
;
; Description:      Moves a small letter trough the text.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow),
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          New in v1.6
;
;===============================================================================
Func _txt_eff__move_small_char_through_text($winhandle, $control_id, $text = "", $delay = 50, $effect_width_chars = 1, $direction = "to_right", $convert_to_caps = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    If $direction = "to_left" Then
        $start = StringLen($text) - StringLen($effect_width_chars)
        $end = 0
        $step = -1
    Else
        $start = 0
        $end = StringLen($text) - StringLen($effect_width_chars)
        $step = 1
    EndIf
    
    $res_text = $text
    If $convert_to_caps = 1 Then $res_text = StringUpper($text)
    
    For $i = $start To $end Step $step
        Sleep($delay)
        $left = StringLeft($res_text, $i)
        $middle = StringLower(StringMid($res_text, $i + 1, $effect_width_chars))
        $right = StringTrimLeft($res_text, $i + $effect_width_chars)
        $out_string = $left & $middle & $right
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Next
    
    Sleep($delay)
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Return 1
EndFunc   ;==>_txt_eff__move_small_char_through_text


;===============================================================================
;
; Description:      Scrolls through several options until the target text is found.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow),
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          New in v1.6
;
;===============================================================================
Func _txt_eff__scroll_through_options($winhandle, $control_id, $options, $target_text = "", $delay = 50)
    If $target_text = "" Then $target_text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    For $i = 0 To UBound($options) - 1
        Sleep($delay)
        
        $out_string = $options[$i]
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        If $out_string = $target_text Then ExitLoop
    Next
    Return 1
EndFunc   ;==>_txt_eff__scroll_through_options


;===============================================================================
;
; Description:      Uncovers the text going from left to right and ack until everything is uncovered.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow),
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          New in v1.6
;
;===============================================================================
Func _txt_eff__uncover_from_wall_to_wall($winhandle, $control_id, $text = "", $delay = 50, $turn_arounds = 1)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    $turn_arounds = $turn_arounds + 1 ; better for internal use
    
    $out_string = ""
    For $i = 1 To StringLen($text)
        $out_string = $out_string & " "
    Next
    
    For $i = 1 To $turn_arounds
        $start = $i
        $end = _Floor (StringLen($text) / $turn_arounds) * $turn_arounds
        If Mod(StringLen($text), $turn_arounds) >= $i Then
            $end = $end + $i
        Else
            $end = $end - $turn_arounds + $i
        EndIf
        
        If Mod($i, 2) = 1 Then ; ungerade
            $step = $turn_arounds
        Else
            _Swap($start, $end)
            $step = -$turn_arounds
        EndIf
        
        For $j = $start To $end Step $step
            Sleep($delay)
            $out_string = _StringInsertAtPos($out_string, $j, StringMid($text, $j, 1))
            If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, $out_string)
            If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Next
    Next
    Return 1
EndFunc   ;==>_txt_eff__uncover_from_wall_to_wall


;===============================================================================
;
; Description:      Simulates a wave through the text.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow),
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          New in v1.6
;
;===============================================================================
Func _txt_eff__wave($winhandle, $control_id, $text = "", $delay = 50, $effect_width = 3, $uncover_after_effect = 1, $direction = "to_right")
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    $orig_text = $text
    
    $empty_string = ""
    For $i = 1 To StringLen($text) + $effect_width * 2
        $empty_string = $empty_string & " "
    Next
    
    For $i = 1 To $effect_width
        $text = " " & $text & " "
    Next
    
    If $direction = "to_right" Then
        $start = 1
        $end = StringLen($text) + $effect_width * 2
        $step = 1
    Else
        $start = StringLen($text) + $effect_width * 2
        $end = 1
        $step = -1
    EndIf
    
    For $i = $start To $end Step $step
        Sleep($delay)
        $out_string = _StringInsertAtPos($empty_string, $i, StringMid($text, $i, $effect_width))
        $out_string = StringTrimLeft(StringTrimRight($out_string, $effect_width), $effect_width)
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Next
    
    If $uncover_after_effect = 1 Then
        Sleep($delay)
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $orig_text)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    EndIf
    
    Return 1
EndFunc   ;==>_txt_eff__wave


;===============================================================================
;
; Description:      Shows a customizable blink effect.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow),
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any other case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          New in v1.6, possible types: "all", "periodic", "parts", advanced: "all": none, "periodic": step, "parts": array containing cutting positions
;
;===============================================================================
Func _txt_eff__blink($winhandle, $control_id, $text = "", $show_delay = 50, $hide_delay = 50, $blink_type = "all", $advanced = "", $repetitions = 1)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    If $blink_type = "all" Then
        For $i = 1 To $repetitions
            Sleep($hide_delay)
            If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, $text)
            If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
            Sleep($show_delay)
            If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, "")
            If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        Next
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $text)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        
    ElseIf $blink_type = "periodic" Then
        For $j = 1 To $repetitions
            For $i = 1 To $advanced
                $start = $i
                $end = _Floor (StringLen($text) / $advanced) * $advanced
                If Mod(StringLen($text), $advanced) >= $i Then
                    $end = $end + $i
                Else
                    $end = $end - $advanced + $i
                EndIf
                
                If Mod($i, 2) = 1 Then ; ungerade
                    $step = $advanced
                Else
                    _Swap($start, $end)
                    $step = -$advanced
                EndIf
                
                $out_string = ""
                For $m = 1 To StringLen($text)
                    $out_string = $out_string & " "
                Next
                For $k = $start To $end Step $step
                    $out_string = _StringInsertAtPos($out_string, $k, StringMid($text, $k, 1))
                Next
                Sleep($hide_delay)
                If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
                ControlSetText($winhandle, "", $control_id, $out_string)
                If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
                Sleep($show_delay)
                If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
                ControlSetText($winhandle, "", $control_id, "")
                If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
            Next
        Next
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $text)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        
    ElseIf $blink_type = "parts" Then
        For $j = 1 To $repetitions
            If IsArray($advanced) <> 1 Then
                $advanced = StringSplit($advanced, ".")
                _ArrayReverse($advanced)
                _ArrayPop($advanced)
                _ArrayReverse($advanced)
            EndIf
            For $i = -1 To UBound($advanced) - 1
                $out_string = ""
                For $m = 1 To StringLen($text) - 1
                    $out_string = $out_string & " "
                Next
                If $i = -1 Then
                    $out_string = _StringInsertAtPos($out_string, 0, StringMid($text, 1, $advanced[0]))
                ElseIf $i = UBound($advanced) - 1 Then
                    $out_string = _StringInsertAtPos($out_string, $advanced[$i] + 1, StringMid($text, $advanced[$i] + 1, StringLen($text) - $advanced[$i]))
                Else
                    $out_string = _StringInsertAtPos($out_string, $advanced[$i] + 1, StringMid($text, $advanced[$i] + 1, $advanced[$i + 1] - $advanced[$i]))
                EndIf
                Sleep($hide_delay)
                If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
                ControlSetText($winhandle, "", $control_id, $out_string)
                If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
                Sleep($show_delay)
                If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
                ControlSetText($winhandle, "", $control_id, "")
                If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
            Next
        Next
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $text)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    EndIf
    
    Return 1
EndFunc   ;==>_txt_eff__blink


;===============================================================================
;
; Description:      Mixes up two chars and goes through the text.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow),
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          New in v1.6
;
;===============================================================================
Func _txt_eff__mix_up_chars($winhandle, $control_id, $text = "", $delay = 50, $effect_width = 1, $direction = "to_right")
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    $orig_text = $text
    
    For $i = 1 To $effect_width
        $text = " " & $text & " "
    Next
    
    If $direction = "to_right" Then
        $start = 1
        $end = StringLen($text) + $effect_width ; *2
        $step = 1
    Else
        $start = StringLen($text) + $effect_width
        $end = 1
        $step = -1
    EndIf
    
    For $i = $start To $end Step $step
        Sleep($delay)
        $first_char = StringMid($text, $i, 1)
        $second_char = StringMid($text, $i + $effect_width, 1)
        
        If _IsCap($second_char) = 1 Then
            $first_char_res = StringUpper($first_char)
        ElseIf _IsCap($second_char) = 2 Then
            $first_char_res = StringLower($first_char)
        Else
            $first_char_res = $first_char
        EndIf
        
        If _IsCap($first_char) = 1 Then
            $second_char_res = StringUpper($second_char)
        ElseIf _IsCap($first_char) = 2 Then
            $second_char_res = StringLower($second_char)
        Else
            $second_char_res = $second_char
        EndIf
        
        $out_string = _StringInsertAtPos($text, $i, $second_char_res)
        $out_string = _StringInsertAtPos($out_string, $i + $effect_width, $first_char_res)
        $out_string = StringTrimLeft(StringTrimRight($out_string, $effect_width), $effect_width)
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Next
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $orig_text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    
    Return 1
EndFunc   ;==>_txt_eff__mix_up_chars


;===============================================================================
;
; Description:      Highlights some chars and goes through the text.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - The text to animate, $delay - Animation speed (1 = fast, 1000 = slow),
; Requirement(s):   v3.1.1.66 (beta) or later
;
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          New in v1.6, $display_type: 0 - show only effect, 1 - show text with effect, 2 - show whole text
;
;===============================================================================
Func _txt_eff__spotlight($winhandle, $control_id, $text = "", $delay = 50, $effect_width = 1, $highlighting_start_char = "(", $highlighting_end_char = ")", $display_type = 2, $direction = "to_right")
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    $orig_text = $text
    
    If $direction = "to_right" Then
        $start = 1
        $end = StringLen($text)
        $step = 1
    Else
        $start = StringLen($text)
        $end = 1
        $step = -1
    EndIf
    
    For $i = $start To $end Step $step
        Sleep($delay)
        
        If $display_type = 0 Then
            $empty_string = ""
            For $j = 1 To StringLen($text)
                $empty_string = $empty_string & " "
            Next
            $char = StringMid($text, $i, $effect_width)
            $out_string = _StringInsertAtPos($empty_string, $i + $effect_width, $highlighting_end_char, 0)
            $out_string = _StringInsertAtPos($out_string, $i, $char)
            $out_string = _StringInsertAtPos($out_string, $i, $highlighting_start_char, 0)
            
        ElseIf $display_type = 1 Then
            $out_string = StringLeft($text, $i)
            $out_string = _StringInsertAtPos($out_string, $i + $effect_width, $highlighting_end_char, 0)
            $out_string = _StringInsertAtPos($out_string, $i, $highlighting_start_char, 0)
            
        Else
            $out_string = _StringInsertAtPos($text, $i + $effect_width, $highlighting_end_char, 0)
            $out_string = _StringInsertAtPos($out_string, $i, $highlighting_start_char, 0)
            
        EndIf
        
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, $out_string)
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    Next
    
    Sleep($delay)
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $orig_text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    
    Return 1
EndFunc   ;==>_txt_eff__spotlight


;===============================================================================
;
; Description:      Shows a about box with many different effects.
; Syntax:           _txt_eff__about_messages($winhandle, $control_id, $texts, [$delay, [$showtime, [$pause, [$type]]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $texts - Array containing all messages to show, $delay - Animation speed (1 = fast, 1000 = slow), $showtime - time the single message is shown (also possible: array with values correspondenting to $texts), $pause - time to wait until the next message is displayed, $type - type of the animation: "raining, "right_to_left", "left_to_right", "right_to_right", "left_to_left", "enlarge_from_left", "enlarge_from_right", "zoom_big_to_small", "zoom_small_to_big", "move_cap_char", "move_small_char", "wall_to_wall", "blink", "wave", "mix_up", "spotlight", "fade", "rainbow", "modern"
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - if $texts is an array
;                   0 - if $texts is no array
;                   2 - if $type is no valid type
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          None
;
;===============================================================================
Func _txt_eff__about_messages($winhandle, $control_id, $texts, $delay = 50, $showtime = 2000, $pause = 750, $type = "right_to_left")
    If IsArray($texts) <> 0 Then
        Local $static = _IsStatic($winhandle, $control_id)
        
        If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, "")
        If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
        If ($type = "right_to_left") or ($type = "left_to_right") or ($type = "left_to_left") or ($type = "right_to_right") Then
            $text_min_width = 14
            For $i = 0 To UBound($texts) - 1
                If StringLen($texts[$i]) > $text_min_width Then $text_min_width = StringLen($texts[$i])
            Next
            $text_min_width = $text_min_width + 5
            
        ElseIf $type = "modern" Then
            
            ; ------- parameters -------
            Local $_l_height = 20 ; height of a single line (label)
            Local $_no_color = 0xECE9D8
            Local $_black = 0x000000
            Local $_messages = 5
            Dim $_labels[$_messages]
            
            ; enlarge Arrray
            For $k = 1 To $_messages
                _ArrayInsert($texts, 0, "")
                _ArrayInsert($texts, UBound($texts), "")
            Next
            
            $_txt_eff_about_gui = GUICreate("About", 250, $_l_height + 20 + $_l_height * $_messages + 60) ; the about win's title, width and height here
            $_txt_eff_gui_ok_button = GUICtrlCreateButton("&Ok", 10, $_l_height + 20 + $_l_height * $_messages + 25, 230, 25, $BS_DEFPUSHBUTTON)
                
            
            For $k = 1 To $_messages
                $_style = $SS_CENTER ; styles are located here!
                $_labels[$k - 1] = GUICtrlCreateLabel("[Error]", 10, 50 + 25 * $k, 210, $_l_height, $_style)
            Next
            
            GUISetState(@SW_SHOW)
                        
            
            For $k = 0 To UBound($texts) - $_messages
                
                GUICtrlSetColor($_labels[$_messages - 1], 0xECE9D8)
                For $p = 0 To $_messages - 1
                    GUICtrlSetPos($_labels[$p], 19, $_l_height + 20 + $_l_height * $p, 210, $_l_height)
                    GUICtrlSetData($_labels[$p], $texts[$k + $p])
                Next
                
                For $c = 0 To - $_l_height Step - 1   ; control's height is here again
                    Sleep($delay)
                    
                    GUISetState(@SW_LOCK)
                    ; move
                    For $z = 0 To $_messages - 1
                        GUICtrlSetPos($_labels[$z], 19, $_l_height + 20 + $_l_height * $z + $c, 210, $_l_height)
                    Next
                    
                    ; fade
                    $red_diff = _ColorGetRed($_black) - _ColorGetRed($_no_color)
                    $green_diff = _ColorGetGreen($_black) - _ColorGetGreen($_no_color)
                    $blue_diff = _ColorGetBlue($_black) - _ColorGetBlue($_no_color)
                    $red_res = Hex(_ColorGetRed($_black) + Round($red_diff / $_l_height * ($c + $_l_height + 1)), 2)
                    $green_res = Hex(_ColorGetGreen($_black) + Round($green_diff / $_l_height * ($c + $_l_height + 1)), 2)
                    $blue_res = Hex(_ColorGetBlue($_black) + Round($blue_diff / $_l_height * ($c + $_l_height + 1)), 2)
                    GUICtrlSetColor($_labels[0], "0x" & $red_res & $green_res & $blue_res)
                    
                    $red_diff = _ColorGetRed($_no_color) - _ColorGetRed($_black)
                    $green_diff = _ColorGetGreen($_no_color) - _ColorGetGreen($_black)
                    $blue_diff = _ColorGetBlue($_no_color) - _ColorGetBlue($_black)
                    $red_res = Hex(_ColorGetRed($_black) + Round($red_diff / $_l_height * ($c + $_l_height + 1)), 2)
                    $green_res = Hex(_ColorGetGreen($_black) + Round($green_diff / $_l_height * ($c + $_l_height + 1)), 2)
                    $blue_res = Hex(_ColorGetBlue($_black) + Round($blue_diff / $_l_height * ($c + $_l_height + 1)), 2)
                    GUICtrlSetColor($_labels[$_messages - 1], "0x" & $red_res & $green_res & $blue_res)
                    
                    GUISetState(@SW_UNLOCK)
                    
                    ; check if close event is there
                    $_about_msg = GUIGetMsg()
                    If $_about_msg = $GUI_EVENT_CLOSE Or $_about_msg = $_txt_eff_gui_ok_button Then ExitLoop 2
                Next
            Next
            GUIDelete($_txt_eff_about_gui)
        Else
            
            For $i = 0 To UBound($texts) - 1
                If IsArray($showtime) = 1 Then
                    $real_showtime = $showtime[$i]
                Else
                    $real_showtime = $showtime
                EndIf
                Sleep($pause)
                Select
                    Case $type = "right_to_left"
                        _txt_eff__move_in_from_right($winhandle, $control_id, $texts[$i], $delay, $text_min_width)
                        Sleep($real_showtime)
                        _txt_eff__move_out_to_left($winhandle, $control_id, $texts[$i], $delay)
                    Case $type = "left_to_right"
                        _txt_eff__move_in_from_left($winhandle, $control_id, $texts[$i], $delay)
                        Sleep($real_showtime)
                        _txt_eff__move_out_to_right($winhandle, $control_id, $texts[$i], $delay, $text_min_width)
                    Case $type = "raining"
                        _txt_eff__raining($winhandle, $control_id, $texts[$i], $delay, Round($real_showtime / 3), 1)
                        Sleep($real_showtime)
                    Case $type = "right_to_right"
                        _txt_eff__move_in_from_right($winhandle, $control_id, $texts[$i], $delay, $text_min_width)
                        Sleep($real_showtime)
                        _txt_eff__move_out_to_right($winhandle, $control_id, $texts[$i], $delay, $text_min_width)
                    Case $type = "left_to_left"
                        _txt_eff__move_in_from_left($winhandle, $control_id, $texts[$i], $delay)
                        Sleep($real_showtime)
                        _txt_eff__move_out_to_left($winhandle, $control_id, $texts[$i], $delay)
                    Case $type = "enlarge_from_left"
                        _txt_eff__enlarge_from_left($winhandle, $control_id, $texts[$i], $delay, 1)
                        Sleep($real_showtime)
                    Case $type = "enlarge_from_right"
                        _txt_eff__enlarge_from_right($winhandle, $control_id, $texts[$i], $delay, 1)
                        Sleep($real_showtime)
                    Case $type = "zoom_big_to_small"
                        _txt_eff__zoom($winhandle, $control_id, $texts[$i], $delay, 20, 14, 1, "Times New Roman", 0)
                        Sleep($real_showtime)
                        _txt_eff__zoom($winhandle, $control_id, $texts[$i], $delay, 14, 2, 2, "Times New Roman", 1)
                    Case $type = "zoom_small_to_big"
                        _txt_eff__zoom($winhandle, $control_id, $texts[$i], $delay, 2, 14, 2, "Times New Roman", 0)
                        Sleep($real_showtime)
                        _txt_eff__zoom($winhandle, $control_id, $texts[$i], $delay, 14, 20, 1, "Times New Roman", 1)
                    Case $type = "move_cap_char"
                        _txt_eff__move_cap_char_through_text($winhandle, $control_id, $texts[$i], $delay, 1, "to_right", 0)
                        Sleep($real_showtime)
                    Case $type = "move_small_char"
                        _txt_eff__move_small_char_through_text($winhandle, $control_id, $texts[$i], $delay, 1, "to_right", 1)
                        Sleep($real_showtime)
                    Case $type = "wall_to_wall"
                        _txt_eff__uncover_from_wall_to_wall($winhandle, $control_id, $texts[$i], $delay, 1)
                        Sleep($real_showtime)
                    Case $type = "blink"
                        _txt_eff__blink($winhandle, $control_id, $texts[$i], $delay, 500, "all", "", 2)
                        Sleep($real_showtime)
                    Case $type = "wave"
                        _txt_eff__wave($winhandle, $control_id, $texts[$i], $delay, 3, 1, "to_right")
                        Sleep($real_showtime)
                    Case $type = "mix_up"
                        _txt_eff__mix_up_chars($winhandle, $control_id, $texts[$i], $delay, 1, "to_right")
                        Sleep($real_showtime)
                    Case $type = "spotlight"
                        _txt_eff__spotlight($winhandle, $control_id, $texts[$i], $delay, 1, "<", ">", 2, "to_right")
                        Sleep($real_showtime)
                    Case $type = "fade"
                        _txt_eff__fade_in($winhandle, $control_id, $texts[$i], 1000, 100, "win_xp_bg")
                        Sleep($real_showtime)
                        _txt_eff__fade_out($winhandle, $control_id, $texts[$i], 1000, 100, "win_xp_bg")
                    Case $type = "rainbow"
                        _txt_eff__rainbow($winhandle, $control_id, $texts[$i], $delay, Round($delay / 10), 0)
                        Sleep($real_showtime)
                        
                    Case Else
                        Return 2
                EndSelect
            Next
        EndIf
        Return 1
    Else
        Return 0
    EndIf
EndFunc   ;==>_txt_eff__about_messages



; ---------------------------------
; ---------------------------------
; -----  2. control animation -----
; ---------------------------------
; ---------------------------------


;===============================================================================
;
; Description:      Zooms the text in the control in or out.
; Syntax:           _txt_eff__zoom($winhandle, $control_id, [$text, [$delay, [$start_size, [$end_size, [$step, [$font, [$remove]]]]]]])
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $text - the text for the animation, $delay - Animation speed (1 = fast, 1000 = slow), $start_size - font size at the begining of the effect, $end_size - font size at the end of the effect, $step - step on de-/increasing the font size, $font - font name, $remove 0: Don't remove text after effect / 1: remove text after effect
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          Minimum size should be 2. If $text is left empty, cthe current control's text will be used. Step has to be positiv in any case.
; Questions to solve:
;                   How to read the current font size and name of the control??
;                   How to make the control resize itself to the text's width and height??
;===============================================================================
Func _txt_eff__zoom($winhandle, $control_id, $text = "", $delay = 50, $start_size = 9, $end_size = 2, $step = 1, $font = "Courier New", $remove = 0)
    
    $start_ctrl_pos = ControlGetPos($winhandle, "", $control_id)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    
    If $start_size > $end_size Then $step = - ($step)
    
    For $i = $start_size To $end_size Step $step
        Sleep($delay)
        GUICtrlSetFont($control_id, $i, -1, -1, $font)
        If $i = $start_size Then
            GUISetState(@SW_LOCK, $winhandle)
            ControlSetText($winhandle, "", $control_id, $text)
            GUISetState(@SW_UNLOCK, $winhandle)
        EndIf
    Next
    
    If $remove = 1 Then
        GUISetState(@SW_LOCK, $winhandle)
        ControlSetText($winhandle, "", $control_id, "")
        GUISetState(@SW_UNLOCK, $winhandle)
        ControlMove($winhandle, "", $control_id, $start_ctrl_pos[0], $start_ctrl_pos[1], $start_ctrl_pos[2], $start_ctrl_pos[3])
    EndIf
    Return 1
EndFunc   ;==>_txt_eff__zoom


;===============================================================================
;
; Description:      Sets the text italic, underlined or bold.
; Syntax:
; Parameter(s):
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          types: italic, underline, bold
; Questions to solve:
;                   How to read out text size and so on on the func's startup?
;===============================================================================
Func _txt_eff__style($winhandle, $control_id, $text = "", $type = "bold", $font = "Courier New", $remove = 1, $show_time = 1500)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    GUISetState(@SW_LOCK, $winhandle)
    If $type = "bold" Then
        GUICtrlSetFont($control_id, -1, 800, -1, $font)
    ElseIf $type = "underline" Then
        GUICtrlSetFont($control_id, -1, -1, 4, $font)
    ElseIf $type = "italic" Then
        GUICtrlSetFont($control_id, -1, -1, 2, $font)
    EndIf
    GUISetState(@SW_UNLOCK, $winhandle)
    
    If $remove = 1 Then
        Sleep($show_time)
        GUISetState(@SW_LOCK, $winhandle)
        GUICtrlSetFont($control_id, -1, 400, 0, $font)
        GUISetState(@SW_UNLOCK, $winhandle)
    EndIf
    Return 1
EndFunc   ;==>_txt_eff__style




; ---------------------------------
; ---------------------------------
; -----  3. colourful effects -----
; ---------------------------------
; ---------------------------------


;===============================================================================
;
; Description:      Changes the text color in the given order and time.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $texts - Array containing all messages to show, $delay - Animation speed (1 = fast, 1000 = slow)
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          $colors can be either an array or a string
;                   Question: Can this be used in "foreign" windows too?
;                   Look into the current help file to see, which controls are supported
;===============================================================================
Func _txt_eff__color_sequence($winhandle, $control_id, $text = "", $delay = 50, $colors = "black.green.blue. 0xffffff")
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, $text)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
    
    If IsArray($colors) <> 1 Then
        $colors = StringStripWS($colors, 8) ; delete all spaces
        $colors = StringSplit($colors, ".")
        ; kill first element
        _ArrayReverse($colors)
        _ArrayPop($colors)
        _ArrayReverse($colors)
    EndIf
    
    For $i = 0 To UBound($colors) - 1
        Sleep($delay)
        $color = $colors[$i]
        If StringIsXDigit($color) = 0 Then $color = _GetColorByName($color)
        GUICtrlSetColor($control_id, $color)
    Next
    
    Return 1
EndFunc   ;==>_txt_eff__color_sequence


;===============================================================================
;
; Description:      Changes the text color in the order of the rainbow.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $texts - Array containing all messages to show, $delay - Animation speed (1 = fast, 1000 = slow)
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          $colors can be either an array or a string
;                   Look into the current help file to see, which controls are supported
;===============================================================================
Func _txt_eff__rainbow($winhandle, $control_id, $text = "", $duration_per_change = 2000, $precision = 50, $direction = 0)
    If $direction = 0 Then
        _txt_eff__color_to_color($winhandle, $control_id, $text, $duration_per_change, "black.red.orange.yellow.green.blue.violet.black", $precision)
    Else
        _txt_eff__color_to_color($winhandle, $control_id, $text, $duration_per_change, "black.violet.blue.green.yellow.orange.red.black", $precision)
    EndIf
EndFunc   ;==>_txt_eff__rainbow


;===============================================================================
;
; Description:      Permorms a fade from one color to another.
; Syntax:
; Parameter(s):     $winhandle - Handle of the target window, $control_id - ID of the target control, $texts - Array containing all messages to show, $delay - Animation speed (1 = fast, 1000 = slow)
; Requirement(s):   v3.1.1.66 (beta) or later
; Return Value(s):  1 - in any case
; Author(s):        peethebee <peter_opali@gmx.de>
; Note(s):          Look into the current help file to see, which controls are supported
;===============================================================================
Func _txt_eff__color_to_color($winhandle, $control_id, $text = "", $duration_per_change = 2000, $colors = "black. white", $precision = 100)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    
    If IsArray($colors) <> 1 Then
        $colors = StringStripWS($colors, 8) ; delete all spaces
        $colors = StringSplit($colors, ".")
        ; kill first element
        _ArrayReverse($colors)
        _ArrayPop($colors)
        _ArrayReverse($colors)
    EndIf
    
    
    For $i = 0 To UBound($colors) - 2
        If StringIsXDigit($colors[$i]) = 0 Then
            $start_color = _GetColorByName($colors[$i])
        Else
            $start_color = $colors[$i]
        EndIf
        
        If StringIsXDigit($colors[$i + 1]) = 0 Then
            $end_color = _GetColorByName($colors[$i + 1])
        Else
            $end_color = $colors[$i + 1]
        EndIf
        
        For $j = 1 To $precision
            Sleep(Round($duration_per_change / $precision))
            $red_diff = _ColorGetRed($end_color) - _ColorGetRed($start_color)
            $green_diff = _ColorGetGreen($end_color) - _ColorGetGreen($start_color)
            $blue_diff = _ColorGetBlue($end_color) - _ColorGetBlue($start_color)
            $red_res = Hex(_ColorGetRed($start_color) + Round($red_diff / $precision * $j), 2)
            $green_res = Hex(_ColorGetGreen($start_color) + Round($green_diff / $precision * $j), 2)
            $blue_res = Hex(_ColorGetBlue($start_color) + Round($blue_diff / $precision * $j), 2)
            GUICtrlSetColor($control_id, "0x" & $red_res & $green_res & $blue_res)
            
            If $j = 1 And $i = 0 Then
                If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
                ControlSetText($winhandle, "", $control_id, $text)
                If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
            EndIf
        Next
    Next
    
    Return 1
EndFunc   ;==>_txt_eff__color_to_color

; Fades a text out (black to $color)
Func _txt_eff__fade_out($winhandle, $control_id, $text = "", $duration = 2500, $precision = 100, $color = "white")
    _txt_eff__color_to_color($winhandle, $control_id, $text, $duration, "black. " & $color, $precision)
    Local $static = _IsStatic($winhandle, $control_id)
    If $static = 1 Then GUISetState(@SW_LOCK, $winhandle)
    ControlSetText($winhandle, "", $control_id, "")
    If $static = 1 Then GUISetState(@SW_UNLOCK, $winhandle)
EndFunc   ;==>_txt_eff__fade_out


; Fades a text out ($color to black)
;
; How to get the background color of an control?
; How to calculate a harmonious color (for background)?
;
Func _txt_eff__fade_in($winhandle, $control_id, $text = "", $duration = 2500, $precision = 100, $color = "white")
    _txt_eff__color_to_color($winhandle, $control_id, $text, $duration, $color & ". black", $precision)
EndFunc   ;==>_txt_eff__fade_in




; ---------------------------------
; ---------------------------------
; -----  4. helping functions -----
; ---------------------------------
; ---------------------------------


Func _StringInsertAtPos($string, $pos, $insert, $overwrite = 1)
    If $overwrite = 0 Then
        Return StringLeft($string, $pos - 1) & $insert & StringTrimLeft($string, $pos - 1)
    Else
        Return StringLeft($string, $pos - 1) & $insert & StringTrimLeft($string, $pos - 1 + StringLen($insert))
    EndIf
EndFunc   ;==>_StringInsertAtPos

; Source: Help file
Func _Swap(ByRef $a, ByRef $b)  ;swaps two vars
    Local $t
    $t = $a
    $a = $b
    $b = $t
EndFunc   ;==>_Swap

Func _IsCap($char)
    If Asc($char) < 90 And Asc($char) > 65 Then
        Return 1
    ElseIf Asc($char) < 122 And Asc($char) > 97 Then
        Return 2
    Else
        Return 0
    EndIf
EndFunc   ;==>_IsCap

; Created with help of XDrop 0.17
Func _GetColorByName($name)
    Select
        Case $name = "black"
            Return "0x000000"
        Case $name = "white"
            Return "0xffffff"
        Case $name = "red"
            Return "0xff0000"
        Case $name = "blue"
            Return "0x0000ff"
        Case $name = "green"
            Return "0x00ff00"
        Case $name = "yellow"
            Return "0xffff00"
        Case $name = "violet"
            Return "0xAE7BE1"
        Case $name = "win_xp_bg"
            Return "0xECE9D8"
    EndSelect
EndFunc   ;==>_GetColorByName

Func _IsStatic($winhandle, $control_id)
    Local $ret = DllCall("user32.dll", "int", "GetClassName", "hwnd", ControlGetHandle($winhandle, "", $control_id), "str", "", "int", 128)
    If StringInStr($ret[2], "Static") <> 0 Then Return 1
    Return 0
EndFunc   ;==>_IsStatic

[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

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  

×