Page 1 of 2 1 2 >
Topic Options
#58179 - 10/27/21 03:16 AM PressTalk Carriage Return or Feed Line not working
phinix_mike Offline
OL Newbie

Registered: 02/11/21
Posts: 7
I'm trying to make CR and LF work in PressTalk - how can I do that?
I tried to switch those to different character, but there must be a proper way to do that, right?

Please help!

Top
#58180 - 10/27/21 09:10 AM Re: PressTalk Carriage Return or Feed Line not working [Re: phinix_mike]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 674
Loc: Québec, Canada
Use the PressTalk procedure CRLF()
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#58182 - 10/28/21 03:51 AM Re: PressTalk Carriage Return or Feed Line not working [Re: Jean-Cédric]
phinix_mike Offline
OL Newbie

Registered: 02/11/21
Posts: 7
Originally Posted By: Jean-Cédric
Use the PressTalk procedure CRLF()


Yes, but how can I define where to use CRLF?
I have a txt file which has CR or LF in it, but how can I make it work, so PlanetPress would see them and process?

Top
#58184 - 10/28/21 08:43 AM Re: PressTalk Carriage Return or Feed Line not working [Re: phinix_mike]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 674
Loc: Québec, Canada
You need to more specific about how the text is and what is your intended result.

If your texthas CR and LF in it, then simply read it line by line and display those lines as they are in your text object.

Can you provide an example of what the data looks like and the expected result (as an example too)?
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#58185 - 10/28/21 08:55 AM Re: PressTalk Carriage Return or Feed Line not working [Re: Jean-Cédric]
phinix_mike Offline
OL Newbie

Registered: 02/11/21
Posts: 7
Originally Posted By: Jean-Cédric
You need to more specific about how the text is and what is your intended result.

If your text has CR and LF in it, then simply read it line by line and display those lines as they are in your text object.

Can you provide an example of what the data looks like and the expected result (as an example too)?


So txt file has message field which I want to display on A4 pdf.

For example :

"Card ID", "From","Message"
"012839","Jessica","All the best{LF}{LF}I hope you'll have great day out{LF}{LF}from{LF}John"

I would like to display it as:

FROM: Jessica

All the best

I hope you'll have great day out

from
John



So each LF or CR would be treated as supposed to be.
Of course LF or CR are not normally seen, so I cannot just do "if you find LF or CR, do CRLF()"

Something like this would be best, but I know its not working:

Code:
define(&str, string, '')
&str := @(13,1,500)
search(&str, Chr(10) or Chr(13))
show(&str)
crlf()
endsearch()
show(&str)



I hope that makes sense.


Edited by phinix_mike (10/28/21 09:41 AM)

Top
#58186 - 10/28/21 09:42 AM Re: PressTalk Carriage Return or Feed Line not working [Re: phinix_mike]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 674
Loc: Québec, Canada
Yes that makes a lot more sense.
Knowing now that you have a CSV file as input and that a field contains text with LF in it, helps in designing a solution.

So here's my text example:
"CU98408920","Mrs","Alice","Aubin","Hello, {LF}{LF}Please enjoy blablabla {LF}{LF}blablabla"
"CU98408920","Mrs","Michele","Stuart","Congratulations, {LF}{LF}You are currently our 1 000th customer! {LF}{LF}You will receive your prize..."
"CU98408920","Mr","Pierre","Minion","Hello, {LF}{LF}Tired of winter? {LF}{LF}Select one of our resorts..."


In PPress, first created a Text object and set it up as close to the final result you want (positionning, font color, etc...)
Add all the data where it is supposed to be in it but don't try to do the CRLF yet for the message part. Simply add it as a whhole line.

Next, go to the Tool menu and select Convert to PlanetPress Talk, while having your Text object selected.
Once done, double-click on what is now a PressTalk object. what you see now is the actual PressTalk generated by the Text Object based on your inital settings.

Mine looks like this:
Code:
MoveTo(0,0)
MoveTo(&Width,&Height)
Define(&LocalVariable,string,@(2,1,3))
Set(&LocalVariable,@(2,1,3))
Define(&LocalVariable1,string,@(3,1,34))
Set(&LocalVariable1,@(3,1,34))
Define(&LocalVariable2,string,@(4,1,23))
Set(&LocalVariable2,@(4,1,23))
Define(&LocalVariable3,string,@(5,1,100))
Set(&LocalVariable3,@(5,1,100))
Margin(0.0000,0.0000)


BeginParagraph(0.0000,&Width,0.0000,'left',0.1667,False)
   SetStyle(&Style1)
   Show('Dear '+&LocalVariable+' '+&LocalVariable1+' '+&LocalVariable2)
EndParagraph()
CRLF(0.1667)

search(&LocalVariable3,'{LF}')
   BeginParagraph(0.0000,&Width,0.0000,'left',0.1667,False)
      SetStyle(&Style1)
      Show(&LocalVariable3)
   EndParagraph()
endsearch()

BeginParagraph(0.0000,&Width,0.0000,'left',0.1667,False)
   setStyle(&Style1)
   Show(&LocalVariable3)
EndParagraph()


Notice the use of the Search()...EdnSearch() procedure, which acts as a loop. Basically it goes through all the words in your variable and look for a specific pattern {LF}. It will loop as many time as it finds it. When it does, it execute its inner content while removing the found pattern from the content of the variable, leaving in the variable what was there that is not the pattern (I know, not quite intuitive but it works...see link to online help for more technical explanation).

That should be a good start for you.

Best,
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#58187 - 10/28/21 10:02 AM Re: PressTalk Carriage Return or Feed Line not working [Re: Jean-Cédric]
phinix_mike Offline
OL Newbie

Registered: 02/11/21
Posts: 7
Originally Posted By: Jean-Cédric
Yes that makes a lot more sense.
Knowing now that you have a CSV file as input and that a field contains text with LF in it, helps in designing a solution.

So here's my text example:
"CU98408920","Mrs","Alice","Aubin","Hello, {LF}{LF}Please enjoy blablabla {LF}{LF}blablabla"
"CU98408920","Mrs","Michele","Stuart","Congratulations, {LF}{LF}You are currently our 1 000th customer! {LF}{LF}You will receive your prize..."
"CU98408920","Mr","Pierre","Minion","Hello, {LF}{LF}Tired of winter? {LF}{LF}Select one of our resorts..."


In PPress, first created a Text object and set it up as close to the final result you want (positionning, font color, etc...)
Add all the data where it is supposed to be in it but don't try to do the CRLF yet for the message part. Simply add it as a whhole line.

Next, go to the Tool menu and select Convert to PlanetPress Talk, while having your Text object selected.
Once done, double-click on what is now a PressTalk object. what you see now is the actual PressTalk generated by the Text Object based on your inital settings.

Mine looks like this:
Code:
MoveTo(0,0)
MoveTo(&Width,&Height)
Define(&LocalVariable,string,@(2,1,3))
Set(&LocalVariable,@(2,1,3))
Define(&LocalVariable1,string,@(3,1,34))
Set(&LocalVariable1,@(3,1,34))
Define(&LocalVariable2,string,@(4,1,23))
Set(&LocalVariable2,@(4,1,23))
Define(&LocalVariable3,string,@(5,1,100))
Set(&LocalVariable3,@(5,1,100))
Margin(0.0000,0.0000)


BeginParagraph(0.0000,&Width,0.0000,'left',0.1667,False)
   SetStyle(&Style1)
   Show('Dear '+&LocalVariable+' '+&LocalVariable1+' '+&LocalVariable2)
EndParagraph()
CRLF(0.1667)

search(&LocalVariable3,'{LF}')
   BeginParagraph(0.0000,&Width,0.0000,'left',0.1667,False)
      SetStyle(&Style1)
      Show(&LocalVariable3)
   EndParagraph()
endsearch()

BeginParagraph(0.0000,&Width,0.0000,'left',0.1667,False)
   setStyle(&Style1)
   Show(&LocalVariable3)
EndParagraph()


Notice the use of the Search()...EdnSearch() procedure, which acts as a loop. Basically it goes through all the words in your variable and look for a specific pattern {LF}. It will loop as many time as it finds it. When it does, it execute its inner content while removing the found pattern from the content of the variable, leaving in the variable what was there that is not the pattern (I know, not quite intuitive but it works...see link to online help for more technical explanation).

That should be a good start for you.

Best,


Thanks, I'll try that, but am I correct - does this search for actual string {LF}?

Thing is, in csv file you don't see those, LF or CR are invisible, so it looks like this:

"CU98408920","Mrs","Alice","Aubin","Hello,Please enjoy BlablablaDododoBlablablaFromJohn"

then once processed, message field should look like

Hello,
Please enjoy Blablabla
Dododo
Blablabla

From
John


So instead of : search(&LocalVariable3,'{LF}')
can it be: search(&LocalVariable3,Chr(10) or Chr(13)) ?

Top
#58188 - 10/28/21 10:15 AM Re: PressTalk Carriage Return or Feed Line not working [Re: phinix_mike]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 674
Loc: Québec, Canada
Then that migth become more tricky.

When you look at your data in a text editor, you don't see you "message" all on the same line, right?

I mean you don't see it as I display my text example?
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#58189 - 10/28/21 10:22 AM Re: PressTalk Carriage Return or Feed Line not working [Re: phinix_mike]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 674
Loc: Québec, Canada

To help you properly we would need to see the form and reproduce the issue. I suggest you open a technical support ticket through our website.
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#58190 - 10/29/21 07:36 AM Re: PressTalk Carriage Return or Feed Line not working [Re: Jean-Cédric]
phinix_mike Offline
OL Newbie

Registered: 02/11/21
Posts: 7
Originally Posted By: Jean-Cédric
Then that migth become more tricky.

When you look at your data in a text editor, you don't see you "message" all on the same line, right?

I mean you don't see it as I display my text example?


Yes, I don't see special characters, only in specific editing software, like notepad++.


In general, does it mean that PP design doesn't automatically accept Chr10 or Chr13?

I found walkaround way to use them, I need to swap them with some regular string/characters, then replace them in PressTalk, but I was hoping that there is way to "natively" use CRs.




Edited by phinix_mike (10/29/21 07:38 AM)

Top
Page 1 of 2 1 2 >