$Buffer = Clipget()
;кусок кода из UDF File.au3 для разделения образца построчно в массив
If StringInStr($Buffer, @LF) Then
$aBuffer = StringSplit(StringStripCR($Buffer), @LF)
ElseIf StringInStr($Buffer, @CR) Then ;; @LF does not exist so split on the @CR
$aBuffer = StringSplit($Buffer, @CR)
Else ;; unable to split the file
If StringLen($Buffer) Then
Dim $aBuffer[2] = [1, $Buffer]
Else
MsgBox(0, "Сообщение", "нет данных")
Exit
EndIf
EndIf
$AllText=''
For $i = 1 to UBound($aBuffer) - 1
$AllText&= _Alignment($aBuffer[$i], 76, 5)&@CRLF
Next
$AllText = StringRegExpReplace($AllText, '\n\s+\r\n',@CRLF)
ClipPut( $AllText)
MsgBox(0, "Текст весь",$AllText)
Func _Alignment($sStr, $Width=90, $redstring=5)
Local $StrTmp='', $String='', $TextOut='', $redstring0='', $aWord, $i, $x
If $redstring>0 Then
For $i = 1 to $redstring
$redstring0&=' '
Next
EndIf
$aWord = StringSplit($sStr, " ", 1)
For $i = 1 to $aWord[0]
if StringLen($String)<=$Width-$redstring+1 Then
$StrTmp=$String
$String &= $aWord[$i]&' '
If $aWord[0]=$i And StringLen($String)<=$Width-$redstring+1 Then $TextOut &= $StrTmp&' '&$aWord[$i]
If $aWord[0]=$i And StringLen($String)>$Width-$redstring+1 Then $TextOut &= $StrTmp&@CRLF&$aWord[$i]
Else
$StrTmp = StringTrimRight($StrTmp,1)
For $x = 1 to 10
If StringLen($StrTmp)<$Width-$redstring Then
$StrTmp = StringRegExpReplace($StrTmp, '\s+', '$0 ', $Width-$redstring-StringLen($StrTmp))
Else
ExitLoop
EndIf
Next
$TextOut &= $StrTmp&@CRLF
$String=$aWord[$i-1]&' '&$aWord[$i]&' '
If $aWord[0]=$i Then $TextOut &= $aWord[$i-1]&' '&$aWord[$i]
$redstring=0
EndIf
Next
Return $redstring0&$TextOut
EndFunc