#210847 - 2015-10-18 04:56 AM
Echo(), EchoL(), EchoC()
|
AndreLuiz
Getting the hang of it
Registered: 2015-10-07
Posts: 89
Loc: Brasil, João pessoa
|
Hello people I'm posting another Udf. Good it does the following it displays text in the normal screen and if the text is larger than the screen size so he skips one line and continues the text, I got the idea why I saw the kix not do that in the "Batch Script "does, then that's it, but it has a problem, if you have used an AT() so I have a good sure will not work as it should. The addition of this tool I put the possibility to align text on the screen that looks cool with a dir.
Code: http://phpaste.sourceforge.net/demo/?paste=41 Password: kix
;Function Echo(), EchoL(), EchoC() ; ;Author: André Luiz ; ;Version: 1.0 (Day 17 of October 2015) ; ;Description: Print text on the screen and then display centralized and line breaks when needed. ; ;Syntax: Echo<L/C>(STRING, NUMBER1, NUMBER2) ; ;Parameters: ; STRING - Text to be displayed. ; NUMBER1 - So as to be aligned. (It only makes sense to EchoC()) ; NUMBER1 - It indicates whether or not to skip the line. (It only makes sense to EchoC()) ; ;Mode: ; 0 - Align the left. ; 1 - Align the center. ; 2 - Align the right. ; ;Returns: Nothing. ;Ps: But if you for a larger text on your screen echoC () then it displays the text without alignment. ; ;Dependencies: ; ? It was only tested at 4.66 ; ;Example: ; Echo("Hello, Brasil!") ; +-------------------+ ; |Hello, Google trans| ; |lator | ; +-------------------+ ; EchoL("Hello, Google Tradutor") ; +-------------------+ ; |Hello, Google trans| ; |lator @Crlf | ; +-------------------+ ; EchoC("Hello, Brasil!",1) ; +-------------------+ ; | Hello, Brasil! | ; | | ; +-------------------+ ; EchoC("Hello, Brasil!",1,1) ; +-------------------+ ; | Hello, Brasil! | ; |@Crlf | ; +-------------------+ ; $FileName = Dir("C:\TEMP") ; While $FileName <> "" and @ERROR = 0 ; EchoC($FileName,0,1) ; ;EchoC($FileName,1,1) ; ;EchoC($FileName,2,1) ; $FileName = Dir() ; Loop ; ;Source:
;; EchoL >> Function EchoL($Texto) $Mode=Mode_CMD() $Loop=Len($Texto)/$Mode For $i=1 To Len($Texto) $i_1=$i_1+1 If $i_1 > $Mode If $n < $Loop ? Endif $n=$n+1 $i_1=1 Endif Right(Left($Texto,$i),1) Next ? EndFunction ;; EchoL <<
;; Echo >> Function Echo($Texto) $Mode=Mode_CMD() $Loop=Len($Texto)/$Mode For $i=1 To Len($Texto) $i_1=$i_1+1 If $i_1 > $Mode If $n < $Loop ? Endif $n=$n+1 $i_1=1 Endif Right(Left($Texto,$i),1) Next EndFunction ;; Echo <<
;; Echo Center >> Function EchoC($Texto,Optional $Modo,Optional $Lines) $Mode=Mode_CMD() If Len($Texto) > $Mode If $Lines = 1 Echo($Texto) Else EchoL($Texto) Endif Exit Endif If Len($Texto) & 1 = 0 $Impa=7 Else $Impa=4 Endif Select Case $Modo = 0 For $i=1 To $Mode/2-Len($Texto) " " Next $Texto If $Lines = 1 ? Endif Case $Modo = 1 For $i=1 To $Mode/2-Len($Texto)/2 " " Next $Texto If $Lines = 1 ? Endif Case $Modo = 2 For $i=1 To $Mode/2-$Impa " " Next $Texto If $Lines = 1 ? Endif EndSelect EndFunction ;; Echo Center <<
Function Mode_CMD() Shell '%Comspec% /c For /f "Tokens=2 Delims=: " %%i in ('+"'Mode^|Find "+'"Colu"'+"') do @@Set/p=%%i<Nul >"+"%Tmp%\Tmp.txt" $Er=Open(1,"%Tmp%\Tmp.txt") $Mode_CMD=CInt(ReadLine(1)) $Er=Close(1) Del "%Tmp%\Tmp.txt" EndFunction
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
2 registered
(morganw, mole)
and 414 anonymous users online.
|
|
|