TextEffects-UDF - Mach mehr aus langweiligem Text (inkl. About-Box)

    • Offizieller Beitrag

    Hallo! Poste mal noch ein uraltes Projekt von mir. Mitte 2005 endstand diese UDF und läuft auch heute noch ;) . Habe sie glaube ich praktisch (in Galenda?) nie gebraucht, aber bin mit der Optik sehr zufrieden. Bei Benutzung bitte darauf hinweisen, auf wessen Code die Effekte basieren. Funktionsliste:

    Spoiler anzeigen
    Code
    _txt_eff__enlarge_from_left($winhandle, $control_id, $text = "", $delay = 100, $over_old = 0) Enlarge the given text in the given control from left to right. Requires 
     included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__enlarge_from_right($winhandle, $control_id, $text = "", $delay = 100, $over_old = 0) Enlarge the given text in the given control from right to left. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__move_in_from_left($winhandle, $control_id, $text = "", $delay = 100) Move a given text in the given control in from left side. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__move_out_to_left($winhandle, $control_id, $text = "", $delay = 100) Move a given text in the given control out to left side. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__move_in_from_right($winhandle, $control_id, $text = "", $delay = 100, $text_min_width = 75) Move a given text in the given control in from right side. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__move_out_to_right($winhandle, $control_id, $text = "", $delay = 100, $text_min_width = 75) Move a given text in the given control out to right side. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__show_text_behind_char($winhandle, $control_id, $text = "", $delay = 100, $char = "*") Uncover a given text in the given control behind a given password char. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__move_string_through_text($winhandle, $control_id, $text = "", $delay = 100, $string = "->", $show_complete_text = 0) Move a string through the given text in the given control. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__airport($winhandle, $control_id, $text = "", $delay = 100, $start_char = "A", $skip_chars = 1) Shows a airport-like effect in the given control. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__spin($winhandle, $control_id, $text = "", $delay = 100, $num_spins = "1", $spin_delay = 0) Spins a given text around in the given control. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__broad($winhandle, $control_id, $text = "", $delay = 100, $char = " ", $go_back = "0", $delay_before_go_back = 500) Widens a given text in the given control. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__small($winhandle, $control_id, $delay = 100, $char = " ") Smallens a given text in the given control. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__raining($winhandle, $control_id, $text = "", $delay = 50, $duration = 3000, $over_old = 0) Shows a rain like effect, all letters are falling doiwn. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__move_cap_char_through_text($winhandle, $control_id, $text = "", $delay = 50, $effect_width_chars = 1, $direction = "to_right", $convert_to_small = 0) Moves a capital letter trough the text. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__move_small_char_through_text($winhandle, $control_id, $text = "", $delay = 50, $effect_width_chars = 1, $direction = "to_right", $convert_to_caps = 0) Moves a small letter trough the text. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__scroll_through_options($winhandle, $control_id, $options, $target_text = "", $delay = 50) Scrolls through several options until the target text is found. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__uncover_from_wall_to_wall($winhandle, $control_id, $text = "", $delay = 50, $turn_arounds = 1) Uncovers the text going from left to right and ack until everything is uncovered. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__wave($winhandle, $control_id, $text = "", $delay = 50, $effect_width = 3, $uncover_after_effect = 1, $direction = "to_right") Simulates a wave through the text. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__blink($winhandle, $control_id, $text = "", $show_delay = 50, $hide_delay = 50, $blink_type = "all", $advanced = "", $repetitions = 1) Shows a customizable blink effect. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__mix_up_chars($winhandle, $control_id, $text = "", $delay = 50, $effect_width = 1, $direction = "to_right") Mixes up two chars and goes through the text. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__spotlight($winhandle, $control_id, $text = "", $delay = 50, $effect_width = 1, $highlighting_start_char = "(", $highlighting_end_char = ")", $display_type = 2, $direction = "to_right") Highlights some chars and goes through the text. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__about_messages($winhandle, $control_id, $texts, $delay = 50, $showtime = 2000, $pause = 750, $type = "right_to_left") Shows a about box with many different effects. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__zoom($winhandle, $control_id, $text = "", $delay = 50, $start_size = 9, $end_size = 2, $step = 1, $font = "Courier New", $remove = 0) Zooms the text in the control in or out. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__style($winhandle, $control_id, $text = "", $type = "bold", $font = "Courier New", $remove = 1, $show_time = 1500) Sets the text italic, underlined or bold. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__color_sequence($winhandle, $control_id, $text = "", $delay = 50, $colors = "black.green.blue. 0xffffff") Changes the text color in the given order and time. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__rainbow($winhandle, $control_id, $text = "", $duration_per_change = 2000, $precision = 50, $direction = 0) Changes the text color in the order of the rainbow. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__color_to_color($winhandle, $control_id, $text = "", $duration_per_change = 2000, $colors = "black. white", $precision = 100) Permorms a fade from one color to another. Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__fade_out($winhandle, $control_id, $text = "", $duration = 2500, $precision = 100, $color = "white") Fades a text out (black to $color). Requires  included and AutoIt v3.1.1.65 (Beta) or later!_txt_eff__fade_in($winhandle, $control_id, $text = "", $duration = 2500, $precision = 100, $color = "white") Fades a text out ($color to black). Requires  included and AutoIt v3.1.1.65 (Beta) or later!_IsStatic($winhandle, $control_id) Checks wether a control id represents a static control or not. Requires  included._IsCap($char) Checks if a character is a capital character. Requires  included._Swap(ByRef $a, ByRef $b) Swaps two arrays. Source: Help file. Requires  included.
    Vorschau:


    Viel Spaß damit, peethebee
    • Offizieller Beitrag

    Ich hab mal einen weiteren Texteffekt erstellt:
    _txt_eff__move_in_from_right_char_by_char($hWnd, $Ctrl_ID, $sText='', $iEffLength=-1, $iCharDelay=-1, $iSlideDelay=-1)
    Hiermit wird der Text von rechts zeichenweise eingefügt, d.h. ein Zeichen bis zum Endpunkt, dann das nächste usw.

    Hier im Vergleich mit der enblock-Einfügefunktion:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #Include <String.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $txt = 'Computer ersparen die Zeit, die wir ohne sie nicht bräuchten ;-)'
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 633, 198, 193, 115)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    $label = GUICtrlCreateLabel('Text von rechts, Zeichen für Zeichen (BugFix)', 72, 50, 481, 17)
    $Input1 = GUICtrlCreateInput("", 72, 72, 481, 21)
    GUICtrlSetFont(-1, 9, 400, Default, "Courier New")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100)
    _txt_eff__move_in_from_right_char_by_char($Form1, $Input1, $txt)
    Sleep(2000)
    GUICtrlSetData($Input1, '')
    GUICtrlSetData($label, 'Text von rechts, am Stück (PeeTheBee)')
    _txt_eff__move_in_from_right($Form1, $Input1, $txt)
    Sleep(2000)
    Exit
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Form1Close()
    Exit
    EndFunc
    ;==================================================================================================
    ; $hWnd Fensterhandle
    ; $Ctrl_ID Control-ID
    ; $sText einzufügender Text, wird nichts übergeben bricht die Funktion ab
    ; $iEffLength Startpunkt (Zeichenlänge), von dem die Zeichen eingefügt werden,
    ; wenn nichts angegeben: Länge Zeichenkette
    ; $iCharDelay Verzögerung bis zum Beginn Einfügen nächstes Zeichen
    ; $iSlideDelay Verzögerung während des Eingleitens zwischen den Positionen, außer bei Leerzeichen
    ; erfordert <String.au3>
    ;==================================================================================================
    Func _txt_eff__move_in_from_right_char_by_char($hWnd, $Ctrl_ID, $sText='', $iEffLength=-1, $iCharDelay=-1, $iSlideDelay=-1)
    If $sText = '' Then Return
    If $iCharDelay < 0 Then $iCharDelay = 100
    If $iSlideDelay < 0 Then $iSlideDelay = 10
    Local $static = _IsStatic($hWnd, $Ctrl_ID)
    Local $aTxt = StringSplit($sText, ''), $tmpTxt = ''
    If $iEffLength < 0 Or $iEffLength < $aTxt[0] Then $iEffLength = $aTxt[0]
    For $i = 1 To $aTxt[0]
    For $k = 1 + $i -1 To $iEffLength
    If $static = 1 Then GUISetState(@SW_LOCK, $hWnd)
    ControlSetText($hWnd, '', $Ctrl_ID, $tmpTxt & _StringRepeat(' ', $iEffLength-$k) & $aTxt[$i])
    If $static = 1 Then GUISetState(@SW_UNLOCK, $hWnd)
    If $aTxt[$i] <> ' ' Then Sleep($iSlideDelay)
    Next
    $tmpTxt &= $aTxt[$i]
    Sleep($iCharDelay)
    Next
    EndFunc ;==>_txt_eff__move_in_from_right_char_by_char

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit]
  • kann man die UDF's auch so umschreiben, das sie nicht am anfang des steuerelements beginnen? also das sie nach einem bestimmten text (anzahl von buchstaben) anfangen... habs selber versucht aba anscheinend bin ich zu dumm dafür :P

    • Offizieller Beitrag

    @DailyAgony:
    Das geht schon. Du mußt dir den Text des Controls zurückgeben lassen (ControlGetText), den Teil, den du fix haben möchtest abschneiden und vor jedem Schreiben des Effektes mit Anfügen. Allerdings mußt du teilweise Leerzeichen einfügen.
    Für alle Effekte sicher nicht sinnvoll.

    So, hab gleich noch einen Effekt erstellt: _txt_eff__fountain($hWnd, $Ctrl_ID, $sText='', $iDelay=-1)
    Hier sprudelt der Text völlig ungeordnet (wie eine Fontäne ;) )von der Mitte nach beiden Seiten in das Control. Dann wird er wieder 'eingesogen' und anschließend in ordentlicher Reihenfolge abwechselnd nach links und rechts ausgegeben.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #Include <String.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $txt = 'Computer ersparen die Zeit, die wir ohne sie nicht bräuchten ;-)'
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 633, 198, 193, 115)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    $label = GUICtrlCreateLabel('Text von Mitte, fontänenartig nach beiden Seiten (BugFix)', 72, 50, 481, 17)
    $Input1 = GUICtrlCreateInput("", 72, 72, 481, 21)
    GUICtrlSetFont(-1, 9, 400, Default, "Courier New")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100)
    _txt_eff__fountain($Form1, $Input1, $txt)
    Sleep(2000)
    Exit
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Form1Close()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;==================================================================================================
    ; $hWnd Fensterhandle
    ; $Ctrl_ID Control-ID
    ; $sText einzufügender Text, wird nichts übergeben bricht die Funktion ab
    ; $iDelay Verzögerung bis zum Beginn Einfügen nächstes Zeichen
    ; Erfordert <String.au3>
    ;==================================================================================================
    Func _txt_eff__fountain($hWnd, $Ctrl_ID, $sText='', $iDelay=-1)
    If $sText = '' Then Return
    If $iDelay < 0 Then $iDelay = 20
    Local $static = _IsStatic($hWnd, $Ctrl_ID)
    Local $aTxt = StringSplit($sText, ''), $aPop[$aTxt[0]], $leftChars = '', $rightChars = '', $tmpLeft = ''
    Local $tmpVal, $i, $k, $start = Round($aTxt[0]/2), $spaceCnt = $start-1, $random, $char, $side = False
    For $i = 0 To UBound($aPop) -1
    $aPop[$i] = $aTxt[$i+1]
    Next
    For $i = 1 To UBound($aTxt) -1
    $random = Random(0, UBound($aPop))
    $char = $aPop[$random]
    $aPop[$random] = $aPop[UBound($aPop)-1]
    If UBound($aPop)-1 > 2 Then ReDim $aPop[UBound($aPop)-1]
    If $static = 1 Then GUISetState(@SW_LOCK, $hWnd)
    If $side Then
    $rightChars = $char & $rightChars
    Else
    $tmpLeft &= $char
    $leftChars = _StringRepeat(' ', $spaceCnt) & $tmpLeft
    $spaceCnt -= 1
    EndIf
    ControlSetText($hWnd, '', $Ctrl_ID, $leftChars & $rightChars)
    $side = Not $side
    If $static = 1 Then GUISetState(@SW_UNLOCK, $hWnd)
    Sleep($iDelay)
    Next
    Local $str = ControlGetText($hWnd, '', $Ctrl_ID), $strLen = StringLen($str)
    $spaceCnt = 0
    $leftChars = StringLeft($str, $start)
    $rightChars = StringRight($str, $strLen-$start)
    $side = False
    $i = 0
    Do
    If $side Then
    $rightChars = StringTrimLeft($rightChars, 1)
    Else
    $leftChars = StringTrimRight($leftChars, 1)
    $spaceCnt += 1
    EndIf
    $side = Not $side
    If $static = 1 Then GUISetState(@SW_LOCK, $hWnd)
    ControlSetText($hWnd, '', $Ctrl_ID, _StringRepeat(' ', $spaceCnt) & $leftChars & $rightChars)
    If $static = 1 Then GUISetState(@SW_UNLOCK, $hWnd)
    Sleep($iDelay)
    $i += 1
    Until $i = $strLen
    $tmpLeft = ''
    $leftChars = ''
    $rightChars = ''
    $spaceCnt = $start-1
    $side = False
    Local $leftIndx = 1, $rightIndx = UBound($aTxt)-1
    For $i = 1 To UBound($aTxt) -1
    If $static = 1 Then GUISetState(@SW_LOCK, $hWnd)
    If $side Then
    $rightChars = $aTxt[$rightIndx] & $rightChars
    $rightIndx -= 1
    Else
    $tmpLeft &= $aTxt[$leftIndx]
    $leftChars = _StringRepeat(' ', $spaceCnt) & $tmpLeft
    $spaceCnt -= 1
    $leftIndx += 1
    EndIf
    ControlSetText($hWnd, '', $Ctrl_ID, $leftChars & $rightChars)
    $side = Not $side
    If $static = 1 Then GUISetState(@SW_UNLOCK, $hWnd)
    Sleep($iDelay)
    Next
    EndFunc ;==>_txt_eff__fountain

    [/autoit]
  • hehe bugfix :D *hust* blick da nich ganz durch, könntest du für mich nen beispiel für _txt_eff__move_string_through_text machen?

    • Offizieller Beitrag

    Gerade in dem Bsp. ist es doch easy :whistling:
    Einfach eine Variable $start einfügen:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $txt = 'Ein Lagerregal steht im Lager.'
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 633, 198, 193, 115)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    $label = GUICtrlCreateLabel('Texteffekt beginnend bei Position $start', 72, 50, 481, 17)
    $Input1 = GUICtrlCreateInput("", 72, 72, 481, 21)
    GUICtrlSetFont(-1, 9, 400, Default, "Courier New")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    _txt_eff__move_string_through_text($Form1, $Input1, $txt, 9, 300)
    Sleep(2000)
    GUIDelete($Form1)
    Exit
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Form1Close()
    Exit
    EndFunc
    ;===============================================================================
    ;
    ; Description: Move a string through the given text in the given control.
    ; Syntax: _txt_eff__move_string_through_text($winhandle, $control_id, [$text, [$start=1, [$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 <[email='peter_opali@gmx.de'][/email]>
    ; Note(s): None
    ;
    ;===============================================================================
    Func _txt_eff__move_string_through_text($winhandle, $control_id, $text = "", $start=1, $delay = 100, $string = "->", $show_complete_text = 0)
    If $text = "" Then $text = ControlGetText($winhandle, "", $control_id)
    Local $static = _IsStatic($winhandle, $control_id)
    For $i = $start 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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit]
  • omg sowas tut weh ;( ich hab meinen fehler gefunden... ich hatte das genauso gemacht wie du, nur dummerweise habsch bei $show_complete_text ne 1 gesetzt...aaaargh

    vielen dank bugfix, wie immer n lebensretter =)

    edit: und pee natürlich auch weil er überhaupt die geile text UDF geschriben hat :D

    You 2 rock :rock: