Powerful MultiColumns Left Right Aligner!

12 views
Skip to first unread message

zhong zhao

unread,
Aug 9, 2022, 10:35:38 PMAug 9
to SemWare TSE Pro text editor

l_r_align.png
l_r_align.s

knud van eeden

unread,
Aug 12, 2022, 7:48:22 PMAug 12
to SemWare TSE Pro text editor
Added a documented version of the program
which includes the shown image example.

Note: sending (only) an image with example(s), especially  when it is rather complicated 
like in this example will force 
in general each TSE user to manually type 
those entries and text themselves. 

Of course there is 
optical character recognition (OCR), but that is 
not always 100% procent reliable so introducing
sometimes difficult to find bugs.

So it would be highly recommended to send such
information (also) as text, typically inside 
the program and also document it similarly.

Thanks in advance
with friendly greetings
Knud van Eeden


On Wednesday, August 10, 2022 at 04:35:44 AM GMT+2, zhong zhao <zhao4...@gmail.com> wrote:



l_r_align.png

--


l_r_align.s

knud van eeden

unread,
Aug 19, 2022, 12:51:54 PMAug 19
to SemWare TSE Pro text editor
Yes, very useful.

I used it e.g. with this (simplified) example, to quickly align it more in table like format:

Example:

--- cut here: begin --------------------------------------------------
Option 123: Do something1
Option 4578: Do something2
Option 3: Do something3
Option 1234: Do something4
--- cut here: end ----------------------------------------------------

Then supply first which character to select:

:

Then supply if it is right or left aligned

:l

That gives as output

--- cut here: begin --------------------------------------------------
Option 123 : Do something1
Option 4578: Do something2
Option 3   : Do something3
Option 1234: Do something4
--- cut here: end ----------------------------------------------------

So yes keep your TSE macros coming and yes keep on publishing to the TSE list.

--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/semware/1906715604.1186432.1660348096258%40mail.yahoo.com
.

knud van eeden

unread,
Aug 19, 2022, 5:27:40 PMAug 19
to SemWare TSE Pro text editor
Here a much shorter and simpler programs with similar functionality, 
by using regular expressions.

(note: A little bit of editing could be necessary afterwards)

Example: highlight the 4 lines in this below block, then run the TSE macro

--- cut here: begin --------------------------------------------------

f=0.0f;sscanf(s,"%f",&f);printf("%f\n",f);//1.234568
lf=0.0;sscanf(s,"%lf",&lf);printf("%.15lf\n",lf);//1.234567890123456
lf=0.0f;sscanf(s,"%f",&lf);printf("%.15lf\n",lf);//0.000000000000000
f=0.0;sscanf(s,"%lf",&f);printf("%f\n",f);//70.175720

--- cut here: end ----------------------------------------------------


---

INTEGER PROC FNAlignTabB( STRING inS )
 STRING s1[255] = ""
 STRING s2[255] = ""
 INTEGER I = 0
 INTEGER B = FALSE
 FOR I = 1 TO Length( inS )
  s1 = Format( s1, "{.*}", "\", inS[ I ] )
 ENDFOR
 FOR I = 1 TO Length( inS )
  s2 = Format( s2, "\t", "\", I, "\t", "\", inS[ I ] )
 ENDFOR
 B = LReplace( s1, s2, "nglx" )
 RETURN( B )
END
//
PROC Main()
 STRING s[255] = "=.;,,)%,//."
 IF ( NOT ( IsBlockInCurrFile() ) ) Warn( "Please mark a block" ) RETURN() ENDIF
 Ask( "separators = ", s )
 Message( FNAlignTabB( s ) )
END

knud van eeden

unread,
Aug 19, 2022, 6:49:59 PMAug 19
to SemWare TSE Pro text editor
Note: To e.g. remove the tabs, highlight the result, then choose from 'utils' > 'tabutil' > 'Entab'
(or run ExecMacro( "tabutil" ), then 'Entab').


Reply all
Reply to author
Forward
0 new messages