Calculate line break in multiline text in control pages

ParMan
Posts: 11
Joined: Fri Feb 15, 2019 12:05 pm

Calculate line break in multiline text in control pages

Post by ParMan »

Hi,
Is there a way to calculate line breaks to a fixed with in a control page using this plugin?
I'm specifically looking at automatically adding line breaks to weather+ worded forecast strings that usually a string far too long to fit on a control page -especially on an iPhone.
Is this possible?
If not, Is there any other plugin that can do this?

Thank you
User avatar
DaveL17
Posts: 7321
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Calculate line break in multiline text in control pages

Post by DaveL17 »

The Matplotlib plugin has a Multiline Text Device that generates image files of long strings. It doesn't automatically detect line breaks--rather it splits the text based on a number of characters listed in the device's configuration settings.
chart_multiline.png
chart_multiline.png (16.75 KiB) Viewed 3257 times
I came here to drink milk and kick ass....and I've just finished my milk.

My Plugins and Scripts
ParMan
Posts: 11
Joined: Fri Feb 15, 2019 12:05 pm

Re: Calculate line break in multiline text in control pages

Post by ParMan »

Thanks, but I was hoping for a text based solution, as I need to have different length text strings in different layouts - each layout having 10 strings that needs to have line breaks :-(
User avatar
DaveL17
Posts: 7321
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Calculate line break in multiline text in control pages

Post by DaveL17 »

Is there a way to calculate line breaks to a fixed wi[d]th in a control page using this plugin?
I'm specifically looking at automatically adding line breaks...
I need to have different length text strings in different layouts - each layout having 10 strings that needs to have line breaks
Can you elaborate? It's difficult to understand exactly what you're trying to accomplish. Please be specific.
I came here to drink milk and kick ass....and I've just finished my milk.

My Plugins and Scripts
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Calculate line break in multiline text in control pages

Post by berkinet »

The fmt command will do what you want. However, getting your text into and back from fmt may be non-trivial. It really depends on your data source and how you get the text to the control page. But, for a example, it would be fairly simple to pipe the output of some command to fmt, and then save the results in an Indigo variable by using a RESTapi call.

For more information do “man fmt” in a terminal window.
Post Reply

Return to “Device Extensions Plugin”