Thread: [Cocoadialog-users] Newline in --informative-text?
Status: Beta
Brought to you by:
sporkstorms
From: Thomas P. <tp...@gm...> - 2009-01-03 17:22:42
|
Hello CocaDialog Users: Is it possible to print out multiple lines in the --informative-text portion of a CocoaDialog call? In my particular case it is for a yesno-msgbox type call. I would like to be able to do something like: --informative-text "Process ID: $MAINFIREFLYPID \n Run Time: $TIME"` But obviously this will not work. Is there a syntax that support newline calls from within the --informative-text option and if so what is the syntax? Thanks, Thomas |
From: Bill L. <wl...@sw...> - 2009-01-03 19:04:35
|
On Jan 3, 2009, at 10:22 AM, Thomas Patko wrote: > Hello CocaDialog Users: > > Is it possible to print out multiple lines in the --informative-text > portion of a CocoaDialog call? In my particular case it is for a > yesno-msgbox type call. > > I would like to be able to do something like: > > --informative-text "Process ID: $MAINFIREFLYPID \n Run Time: $TIME"` > > But obviously this will not work. Is there a syntax that support > newline calls from within the --informative-text option and if so > what is the syntax? It doesn't appear that CocoaDialog will do what you are asking. You could kludge this using a "textbox" item under CocoaDialog and getting the text from a file using the "--text-from-file" option, but this may not provide you exactly what you desire. Assuming the risk of promoting another GUI building tool, I'd suggest that you look into Pashua (http://www.bluem.net/downloads/pashua_en/) as an alternative to CocoaDialog. Both meet the primary requirement of being free with good documentation. Pashua doesn't appear to be actively developed, but neither is CocoaDialog. With Pashua, you can include the string "[return]" in a text string to break multiple lines, similar to the: Process ID: $MAINFIREFLYPID [return]Run Time: $TIME example that you were using in your CocoaDialog example. One "trick" that you will have to be aware of is now the shell parses strings and substitutes variables. Notice that I included a space after the $MAINFIREFLYPID variable to insure that this would be substituted properly. You may also enclose the variable name in "{}" braces to insure proper substitution, such as: Process ID: ${MAINFIREFLYPID}[return]Run Time: ${TIME} Quite honestly, I use both CocoaDialog and Pashua for developing GUI controlled shell scripts. Each has it's own advantages and disadvantages. CocoaDialog is easier to work with as each GUI window is a single shell command. Pashua passes a text string to the command with its own syntax making it a little more complex but more flexible. Pashua also includes instructions and examples of how to wrap a shell script up into a MacOS X "application" avoiding the need to use Platypus too. The is nothing wrong with Platypus. It also is good and it provides greater flexibility to building applications in MacOS X than Pashua, but this flexibility may not always be necessary. Again, just picking and choosing your tools can simplify your development. Bill Larson |
From: Mark A. S. <ma...@sp...> - 2009-01-03 22:44:36
|
I'm sure there's a cleaner way to do it, but you can just hard-code a newline in there: CocoaDialog yesno-msgbox --text "Hi" --informative-text "hello, world" That will work just fine, but I admit it's not the most elegant way. But anyway, it definitely supports multiple lines, both forced, and wrapped if you have a really long informative-text. This was a feature/fix I added to the 2.1.0 release. The informative-text label in the nib file will allow for an extremely large amount of text. It wraps lines automatically, and will extend itself vertically to allow for as much as text as you need (within reason). - mark Thomas Patko wrote: > Hello CocaDialog Users: > > Is it possible to print out multiple lines in the --informative-text > portion of a CocoaDialog call? In my particular case it is for a > yesno-msgbox type call. > > I would like to be able to do something like: > > --informative-text "Process ID: $MAINFIREFLYPID \n Run Time: $TIME"` > > But obviously this will not work. Is there a syntax that support > newline calls from within the --informative-text option and if so what > is the syntax? > > Thanks, > > Thomas > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > > ------------------------------------------------------------------------ > > _______________________________________________ > Cocoadialog-users mailing list > Coc...@li... > https://lists.sourceforge.net/lists/listinfo/cocoadialog-users > |
From: Thomas P. <tp...@gm...> - 2009-01-04 06:08:22
|
Hello Mark: Yes. That works. It is a bit brute force, but it works. A discrete call for a newline without --informative text would be nice for the next release. The informative text does wrap VERY nicely and does support large amounts of text (just what i needed here). I am writing a simple job termination little app with Platpus/CocoaDialog and echoing out the parameters of the job (pulled from separate calls) that the user is going to be terminating (to ensure that they are killing the RIGHT job). It seems to work OK using the syntax below, but the final line is not printed out in the dialog box. Any ideas why? CD="CocoaDialog.app/Contents/MacOS/CocoaDialog" rv=`"$1"/Contents/Resources/$CD yesno-msgbox --no-cancel --float --string-output --no-newline \ --title "Firefly for Mac Job Termination Prompt" \ --text "Do you want to cancel this Firefly Job? Job $COUNT of $NO_ITEMS" \ --informative-text "Job Type Summary : $JOBTYPE Run Time (Minutes:Seconds) : $TIME Input File : $INPUTFILE Number of CPU Cores : $NCPU Firefly Process ID : $MAINFIREFLYPID"` Cheers, Thomas On Sat, Jan 3, 2009 at 2:44 PM, Mark A. Stratman <ma...@sp...>wrote: > I'm sure there's a cleaner way to do it, but you can just hard-code a > newline in there: > CocoaDialog yesno-msgbox --text "Hi" --informative-text "hello, > world" > > That will work just fine, but I admit it's not the most elegant way. But > anyway, it definitely supports multiple lines, both forced, and wrapped if > you have a really long informative-text. This was a feature/fix I added to > the 2.1.0 release. > > The informative-text label in the nib file will allow for an extremely > large amount of text. It wraps lines automatically, and will extend itself > vertically to allow for as much as text as you need (within reason). > > - mark > > Thomas Patko wrote: > >> Hello CocaDialog Users: >> >> Is it possible to print out multiple lines in the --informative-text >> portion of a CocoaDialog call? In my particular case it is for a >> yesno-msgbox type call. >> >> I would like to be able to do something like: >> >> --informative-text "Process ID: $MAINFIREFLYPID \n Run Time: $TIME"` >> >> But obviously this will not work. Is there a syntax that support newline >> calls from within the --informative-text option and if so what is the >> syntax? >> >> Thanks, >> >> Thomas >> ------------------------------------------------------------------------ >> >> >> ------------------------------------------------------------------------------ >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Cocoadialog-users mailing list >> Coc...@li... >> https://lists.sourceforge.net/lists/listinfo/cocoadialog-users >> > |
From: Mark A. S. <ma...@sp...> - 2009-01-04 06:17:26
|
Well, the problem with sending the newline isn't one for CocoaDialog. CocoaDialog takes exactly what you give it, newlines included, and displays it. Finding an elegant way to send a newline to a program in command-line arguments is a problem with the shell. In Perl, for example, you can do `cocoadialog yesno-msgbox --informative-text "one\ntwo"` without a problem. Regarding the last line being cut off... do you mean the one that says "Filefly Process ID : " ? If so, I just tested it, copying and pasting that command exactly as you typed it, and it worked just fine. So I don't know what the problem might be. Are you using the newest version of cocoadialog (i added auto-resizing to dialogs in one of the later releases)? - mark Thomas Patko wrote: > Hello Mark: > > Yes. That works. It is a bit brute force, but it works. A discrete > call for a newline without --informative text would be nice for the > next release. The informative text does wrap VERY nicely and does > support large amounts of text (just what i needed here). I am writing > a simple job termination little app with Platpus/CocoaDialog and > echoing out the parameters of the job (pulled from separate calls) > that the user is going to be terminating (to ensure that they are > killing the RIGHT job). > > It seems to work OK using the syntax below, but the final line is not > printed out in the dialog box. Any ideas why? > > CD="CocoaDialog.app/Contents/MacOS/CocoaDialog" > rv=`"$1"/Contents/Resources/$CD yesno-msgbox --no-cancel --float > --string-output --no-newline \ > --title "Firefly for Mac Job Termination Prompt" \ > --text "Do you want to cancel this Firefly Job? Job $COUNT of > $NO_ITEMS" \ > --informative-text "Job Type Summary : $JOBTYPE > Run Time (Minutes:Seconds) : $TIME > Input File : $INPUTFILE > Number of CPU Cores : $NCPU > Firefly Process ID : $MAINFIREFLYPID"` > > Cheers, > > Thomas > > On Sat, Jan 3, 2009 at 2:44 PM, Mark A. Stratman <ma...@sp... > <mailto:ma...@sp...>> wrote: > > I'm sure there's a cleaner way to do it, but you can just > hard-code a newline in there: > CocoaDialog yesno-msgbox --text "Hi" --informative-text "hello, > world" > > That will work just fine, but I admit it's not the most elegant > way. But anyway, it definitely supports multiple lines, both > forced, and wrapped if you have a really long informative-text. > This was a feature/fix I added to the 2.1.0 release. > > The informative-text label in the nib file will allow for an > extremely large amount of text. It wraps lines automatically, and > will extend itself vertically to allow for as much as text as you > need (within reason). > > - mark > > Thomas Patko wrote: > > Hello CocaDialog Users: > > Is it possible to print out multiple lines in the > --informative-text portion of a CocoaDialog call? In my > particular case it is for a yesno-msgbox type call. > > I would like to be able to do something like: > > --informative-text "Process ID: $MAINFIREFLYPID \n Run Time: > $TIME"` > > But obviously this will not work. Is there a syntax that > support newline calls from within the --informative-text > option and if so what is the syntax? > > Thanks, > > Thomas > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > ------------------------------------------------------------------------ > > _______________________________________________ > Cocoadialog-users mailing list > Coc...@li... > <mailto:Coc...@li...> > https://lists.sourceforge.net/lists/listinfo/cocoadialog-users > |