[Cocoadialog-users] Unsubscribe
Status: Beta
Brought to you by:
sporkstorms
From: Brad S. <sc...@ya...> - 2008-12-01 13:57:09
|
Unsubscribe Sent from my iPhone On Dec 1, 2008, at 6:08 AM, coc...@li... wrote: Send Cocoadialog-users mailing list submissions to coc...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/cocoadialog-users or, via email, send a message with subject or body 'help' to coc...@li... You can reach the person managing the list at coc...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Cocoadialog-users digest..." Today's Topics: 1. Bourne Shell Script Equivalent to Perl Script Sample for CocoaDialog Dropdown (Thomas Patko) 2. Re: Bourne Shell Script Equivalent to Perl Script Sample for CocoaDialog Dropdown (Bill Larson) 3. Re: Bourne Shell Script Equivalent to Perl Script Sample for CocoaDialog Dropdown (Thomas Patko) 4. Re: Bourne Shell Script Equivalent to Perl Script Sample for CocoaDialog Dropdown (Bill Larson) ---------------------------------------------------------------------- Message: 1 Date: Sun, 30 Nov 2008 11:35:17 -0800 From: "Thomas Patko" <tp...@gm...> Subject: [Cocoadialog-users] Bourne Shell Script Equivalent to Perl Script Sample for CocoaDialog Dropdown To: coc...@li... Message-ID: <ae1...@ma...> Content-Type: text/plain; charset="iso-8859-1" Hello CocoaDialog Users: I am trying to integrate CocoaDialog with some drag and drop run applications that I am building with Platypus. I saw one of the Cocoa dialog that would be quite useful for such a purpose, the dropdown. I am however using Bourne shell script to build these little applications rather than Perl. Is there an example of a Bourne shell script equivalent to the perl scrip example provided? http://cocoadialog.sourceforge.net/examples/dropdown.pl.txt I would be appreciative of any assistance towards this end. Best Regards, Thomas Patko -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 2 Date: Sun, 30 Nov 2008 22:27:10 -0700 From: Bill Larson <wl...@sw...> Subject: Re: [Cocoadialog-users] Bourne Shell Script Equivalent to Perl Script Sample for CocoaDialog Dropdown To: Thomas Patko <tp...@gm...> Cc: coc...@li... Message-ID: <C04...@sw...> Content-Type: text/plain; charset="us-ascii" On Nov 30, 2008, at 12:35 PM, Thomas Patko wrote: Hello CocoaDialog Users: I am trying to integrate CocoaDialog with some drag and drop run applications that I am building with Platypus. I saw one of the Cocoa dialog that would be quite useful for such a purpose, the dropdown. I am however using Bourne shell script to build these little applications rather than Perl. Is there an example of a Bourne shell script equivalent to the perl scrip example provided? http://cocoadialog.sourceforge.net/examples/dropdown.pl.txt I would be appreciative of any assistance towards this end. Best Regards, You need to play around a little. There are examples provided of using CocoaDialog with shell scripts. Take these, along with the documentation for the dropdown function and put together a shell script and test it out. I tossed together the following script that duplicates the function of the Perl script that provides a dropdown menu. Use it as an example. #!/bin/sh CD="/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog" result=`$CD dropdown \ --title "Preferred OS" \ --no-newline \ --items "Mac OS X" "GNU/Linux" "Windows" \ --button1 'That one!' \ --button2 Nevermind` return=`echo $result | awk '{print $1}'` answer=`echo $result | awk '{print $2}'` if [ $return -eq 1 ]; then echo "Answer: $answer" fi if [ $return -eq 2 ]; then echo "Nevermind" fi Please note, I make NO claims that this is a "good" script, nor do I like using "awk" in this manner, but it does seem to work. -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 3 Date: Sun, 30 Nov 2008 22:44:04 -0800 From: "Thomas Patko" <tp...@gm...> Subject: Re: [Cocoadialog-users] Bourne Shell Script Equivalent to Perl Script Sample for CocoaDialog Dropdown To: "Bill Larson" <wl...@sw...> Cc: coc...@li... Message-ID: <ae1...@ma...> Content-Type: text/plain; charset="iso-8859-1" Hello Bill: Thank you very much for the Bourne shell script code and concept. I agree that it is not necessarily the most elegant approach but the combination of --no-newline and the awk '{print $X}' code reliably script out the multiple variables passed back by CocoaDialog. I have made it work quite well for my application, wherein I was only really interested in the second variable. Cheers, Thomas On Sun, Nov 30, 2008 at 9:27 PM, Bill Larson <wl...@sw...> wrote: On Nov 30, 2008, at 12:35 PM, Thomas Patko wrote: Hello CocoaDialog Users: I am trying to integrate CocoaDialog with some drag and drop run applications that I am building with Platypus. I saw one of the Cocoa dialog that would be quite useful for such a purpose, the dropdown. I am however using Bourne shell script to build these little applications rather than Perl. Is there an example of a Bourne shell script equivalent to the perl scrip example provided? http://cocoadialog.sourceforge.net/examples/dropdown.pl.txt I would be appreciative of any assistance towards this end. Best Regards, You need to play around a little. There are examples provided of using CocoaDialog with shell scripts. Take these, along with the documentation for the dropdown function and put together a shell script and test it out. I tossed together the following script that duplicates the function of the Perl script that provides a dropdown menu. Use it as an example. #!/bin/sh CD="/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog" result=`$CD dropdown \ --title "Preferred OS" \ --no-newline \ --items "Mac OS X" "GNU/Linux" "Windows" \ --button1 'That one!' \ --button2 Nevermind` return=`echo $result | awk '{print $1}'` answer=`echo $result | awk '{print $2}'` if [ $return -eq 1 ]; then echo "Answer: $answer" fi if [ $return -eq 2 ]; then echo "Nevermind" fi Please note, I make NO claims that this is a "good" script, nor do I like using "awk" in this manner, but it does seem to work. -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 4 Date: Mon, 1 Dec 2008 04:13:49 -0700 From: Bill Larson <wl...@sw...> Subject: Re: [Cocoadialog-users] Bourne Shell Script Equivalent to Perl Script Sample for CocoaDialog Dropdown To: "Thomas Patko" <tp...@gm...> Cc: coc...@li... Message-ID: <316...@sw...> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Nov 30, 2008, at 11:44 PM, Thomas Patko wrote: Hello Bill: Thank you very much for the Bourne shell script code and concept. I agree that it is not necessarily the most elegant approach but the combination of --no-newline and the awk '{print $X}' code reliably script out the multiple variables passed back by CocoaDialog. I have made it work quite well for my application, wherein I was only really interested in the second variable. An alternative, without using "awk", and having a "case...esac" statement to display the selected answer: #!/bin/sh CD="/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog" result=`$CD dropdown \ --title "Preferred OS" \ --items "Mac OS X" "GNU/Linux" "Windows" \ --button1 "That one!" \ --button2 Nevermind` return=`echo $result | cut -d" " -f1` answer=`echo $result | cut -d" " -f2` if [ $return -eq 1 ]; then case $answer in 0) echo "Mac OS X";; 1) echo "GNU/Linux";; 2) echo "Windows";; esac else echo "Nevermind" fi The "--no-newline" really isn't necessary. I originally included it because the original Perl script had it there. I am using "cut" to parse the output rather than "awk". My complaint with using "awk" is that it is a fairly heavy handed approach to a problem. It is great when you need to do a lot of processing of the input but has a tremendous amount of overhead to use when the processing is quite simple. I'm actually very impressed to see that someone is USING this mailing list. The inactivity on this list implies that not much is happening with CocoaDialog, which I'm glad to see isn't totally correct. ------------------------------ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ------------------------------ _______________________________________________ Cocoadialog-users mailing list Coc...@li... https://lists.sourceforge.net/lists/listinfo/cocoadialog-users End of Cocoadialog-users Digest, Vol 3, Issue 1 *********************************************** |