Line returns in Growl Messages?

The Growl forums have moved to Google Groups, this forum is read only.
Locked
peteo
Harmless
Posts: 3
Joined: Thu Feb 22, 2007 10:58 pm

Line returns in Growl Messages?

Post by peteo »

Any idea how to create a line return or paragraph break in Growl messages that are displayed on-screen? I'm using Growl in a college setting to display a message of the day when students log in. Knowing how to format these messages to add line breaks would help a lot!

- Pete O
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

Have you tried inserting the line break escape code, \n, in your message string?

Also, I'd love to hear more about how you're coding this -- retrieving a MOTD and displaying it, I mean. The implementation might be useful to others in other contexts, as well.
The duck still burns.
--
My company: Saltatory Software. Check it out :)
peteo
Harmless
Posts: 3
Joined: Thu Feb 22, 2007 10:58 pm

Nope, \n doesn't work

Post by peteo »

\n doesn't work, it just prints out as visible "\n" along with the rest of the text of the message. I've also tried web-type html formatting using <p> or <br /> and they just print visibly too, so apparently there is no html interpreter in Growl.

Any other ideas?
User avatar
bgannin
Growl Team
Posts: 1817
Joined: Thu Dec 02, 2004 8:11 am
Location: ..here
Contact:

Post by bgannin »

I think \n should have been respected, HTML would not as there's not going to be HTML support in notification text and titles.
Try my software!

#define ADIUMX pimp //by me
#define QUESTION ((2b) || (!2b))
Have you hugged a programmer today?
ICHIV
Harmless
Posts: 1
Joined: Tue Mar 06, 2007 1:36 pm

Newline

Post by ICHIV »

Hi,

Try this :

Code: Select all

 echo -e "Test \nNewline" | growlnotify 
HTH
DeltaTee
Latté
Posts: 71
Joined: Sun Jun 05, 2005 7:58 pm
Contact:

Post by DeltaTee »

What method are you using to post the messages?
peteo
Harmless
Posts: 3
Joined: Thu Feb 22, 2007 10:58 pm

Got it!

Post by peteo »

Finally was able to figure this out. What I needed to insert into the text string was a *literal line return*. I did this by editing my text message in vi (or vim) and placing literal line returns wherever I need them. "i" to enter insert mode, "control-v" to insert a literal character, and then hit the "return" key to place the return character into the text string. Then "esc" to exit insert mode, and ":wq" to write the file and quit out of vim. I don't completely understand why this works and "\n" doesn't, but it solves my problem. I can also use two literal line returns in a row to create a paragraph break and begin a new paragraph in my message.

For those who are interested, we're using Growl to display a "message of the day" on Macintosh screens in a school lab setting when students log in. The message file is stored on a Macintosh OS X Server. Students are logging into network (roaming) home directories. We use a login hook on the Lab Macs to curl retrieve the file from the server and then Growl handles a nice display of the message in upper right corner of the screen. Message stays there until student clicks to dismiss it. We're also using Growl to display remaining quota space available to student on the server.
User avatar
evands
Cocoaforge Admin
Posts: 3152
Joined: Thu Dec 02, 2004 10:55 pm
Location: Decatur, GA
Contact:

Post by evands »

Ah. When you load that file, those line returns are converted to an internal representation of \n by whatever is reading it, as that's how line breaks are stored in strings. We all assumed you were doing this message programatically.
The duck still burns.
--
My company: Saltatory Software. Check it out :)
Locked