#include <GUIConstants.au3>
#Include <String.au3>
Opt("GUIOnEventMode", 1)

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 ###

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

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


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

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