A little help please....


#1

I am using this code to put the comments between the border of my nfo.

$loop(%comment%,1)|$repeat( ,2)%comment%
$loopend()

its output is something like this,

|  FULL COMMENT

If say comment on mp3 is A-Z, its writing all of it on single line.

I want it to write 75 characters of comment between '|' and '|' and then change the line with again front and end border and remaining comment between these and so on.

Any help would be much appreciated.


#2
QUOTE (vvikkass @ Nov 18 2016, 14:55) <{POST_SNAPBACK}>
I am using this code to put the comments between the border of my nfo.
$loop(%comment%,1)|$repeat( ,2)%comment%
$loopend()

its output is something like this,

|  FULL COMMENT

If say comment on mp3 is A-Z, its writing all of it on single line.

I want it to write 75 characters of comment between '|' and '|' and then change the line with again front and end border and remaining comment between these and so on.

Any help would be much appreciated.


To cut a comment at position 75, use $left(%comment%,75)
To continue with the rest: $mid(%comment%,76,$len(%comment%)

To write the | at the end, calculate the maximum length minus the length of the sub-string: $sub(75,$len($mid(%comment%,76,$len(%comment%))))


#3

Thanks for the help, but i didnt get that atall. When I am using only this:
$sub(75,$len($mid(%comment%,76,$len(%comment%))))

it gives strange output in numbers.

I want a | border in front and end. Max characters for comment I want to make it as 76 starting from 6th of any line.

best regards

EDIT: finally got it, it says -602 as its length.

Now what to do with it, also I dont want | in the end but want it after the every line ends, and making it as a border of nfo.


#4

Read there for a starting point ...
/t/15301/1

This is another example ...
$regexp($repeat('a large stream of text ',20),'(.{1,75})(?:\s+|$[\r\n]?)|(.{1,75})','$1$2\r\n')

The special task is to make each line the same width, for example by adding some space characters at end of each text line, then right cut the line to the wanted length.

If you want to put one pipe character at the beginning and at the end of each textline, ...
so you have to replace each CRLF sequence with a sequence of ...
'|'$char(13)$char(10)'|'
... to get one pipe character at end of a line and one pipe character in front of the next line.

At last add one pipe character at the very beginning of the text ...
(... and maybe one pipe character at the very end of the text).

DD.20161118.1745.CET


#5

Hi, Thanks a lot for helping me. It is exactly what I wanted.

One problem though, whats CRLF sequence and how to repalce it?

EDIT: Also need the lines to start from 7th charater point, I am already putting this code on 7th character so first line is not a problem but rest of the text starts from 1st point.


#6

The end of a text line, in Windows environment, is mostly a sequence of two characters:
$char(13) ... CR ... Carriage Return
$char(10) ... LF ... Linefeed

Try to add 7 space characters just following the LF character, e. g. ...
$replace('the given text here',$char(10),$char(10)$repeat($char(32),7))

DD.20161118.2222.CET


#7

ok found that CRLF means \r\n and replaced all with '|'$char(13)$char(10)'|' to make it look like,

$regexp($repeat('a large stream of text ',20),'(.{1,75})(?:\s+|$['|'$char(13)$char(10)'|']?)|(.{1,75})','$1$2'|'$char(13)$char(10)'|'')

but it returned error. A single lined text. Please help.


#8

here is what I had put,

and this results in single long text,


#9

Probably the given text has no CRLF sequences?
Well, it looks like as if you have opened a big problem for you, regarding text manipulation.
I tend to say, leave the given text as is, ... and do not to try to make cosmetic pastels.
You will get even more difficulties when you want to cut the line length for each line to the same length.

DD.20161118.2252.CET


#10

So what should I do here? I am trying to import a text file within nfo and create boundaries for the lines, as long as it goes down . :frowning:

lets say I want only the front pipe and not the end pipe and want the alphabets to start from 7th character.

Please help, I will forever be grateful.


#11

While in a Google search there was shown a hint to a user created Mp3tag MTE script, which creates a HTML page, which in turn may display a floating text stream within a textbox, where the text has been framed by ASCII box characters, ready made for usage as NFO text file. Search for "fastnfo".

See also ...
/t/5244/1
/t/8858/1
/t/14011/1
/t/15297/1

Try to find your way to go.

DD.20161119.0947.CET


#12

Thanks, will read them. :slight_smile:

Can you help me with this:

Want to put the text in centre of 7th and 75th character, so it looks balanced from both the sides, also will use the $regex code in your previous post to truncate the words after 70th character and do the remaining from next line. Any idea how to edit your previous $regex code to do the centre text?

Always appreciate the help from you two guys.


#13

The following steps are just a proposal to be modified by yourself.

  1. TEST <== $repeat('a large stream of text ',20)

  2. TEST <== $regexp(%TEST%,'(.{1,75})(?:\s+|$[\r\n]?)|(.{1,75})','$1$2\r\n')

  3. TEST <== $replace(%TEST%,$char(13),$repeat($char(32),75)$char(13))

  4. TEST <== $regexp(%TEST%,'(.{1,75})(\s*)(\r\n)','$1$3')

  5. TEST <== $trimRight('|'$regexp(%TEST%,'\r\n','|\r\n|'),'|')

|a large stream of text a large stream of text a large stream of text a |
|large stream of text a large stream of text a large stream of text a large |
|stream of text a large stream of text a large stream of text a large stream|
|of text a large stream of text a large stream of text a large stream of |
|text a large stream of text a large stream of text a large stream of text a|
|large stream of text a large stream of text a large stream of text a large |

DD.20161119.1603.CET


#14

Thanks a lot :slight_smile: