#cs ----------------------------------------------------------------------------
	
	AutoIt Version: 3.3.4.0
	Author:         Aquaplant
	
	Script Function:
	s. Post
	
#ce ----------------------------------------------------------------------------

$search = FileFindFirstFile("*.txt")
If @error Then
	MsgBox(16, "Fehler", "Keine txt-Dokumente gefunden")
EndIf
While 1
	$file = FileFindNextFile($search)
	If @error Then
		FileClose($search)
		MsgBox(64, "Fertig", "Fertig")
		ExitLoop
	EndIf
	$size = FileGetSize($file)
	If $size > 4000 Then
		$text = FileRead($file)
		$lengh = StringLen($text)
		$newlengh = ($lengh / 4000) + 0.5
		$times = Round($newlengh, 0)
		For $i = 1 To $times
			$count = 4000 * $i
			$newtext = StringLeft($text, $count)
			If $i <> $times Then
				$finaltext = StringRight($newtext, 4000)
			Else
				$1 = ($lengh / 4000) - 0.5
				$1 = Round($1, 0)
				$2 = $lengh / 4000
				$3 = $2 - $1
				$4 = 4000 * $3 + 1
				$finaltext = StringRight($newtext, $4)
			EndIf
			$lenghname = StringLen($file)
			$newlenghname = $lenghname - 4
			$newname = StringLeft($file, $newlenghname)
			FileWrite(@ScriptDir & "\" & $newname & " " & $i & ".txt", $finaltext)
		Next
	EndIf
WEnd