Re: [Cocoadialog-users] Newline in --informative-text?
Status: Beta
Brought to you by:
sporkstorms
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 |