Re: [Cocoadialog-users] Help with incorporating with Platypus/PHP/Cocoadialog
Status: Beta
Brought to you by:
sporkstorms
From: Bill L. <wl...@sw...> - 2008-12-18 14:14:04
|
Mark, you example is simple and clean. The CocoaDialog developers have examples of using Bash and Perl, but I think this would be a good addition. To clean up, I played with this and found a whole script of: #!/usr/bin/php <?php $return_values=`/Applications/CocoaDialog.app/Contents/MacOS/ CocoaDialog \ standard-inputbox --text "hello world" --string-output`; list($button, $value)=explode("\n", $return_values); echo "User typed \"$value\" and pressed the \"$button\" button.\n"; ?> Andy, I completely agree with Mark, skip Bash and write PHP scripts directly. Bill Larson On Dec 17, 2008, at 6:16 AM, Mark A. Stratman wrote: > Hello Andy, > > My recommendation is to just simply not use bash. Since your main > program is in PHP anyway, just run CocoaDialog from PHP (within your > 'mm.php' program). > > PHP also uses backticks for capturing program output, if i recall > correctly. So just put a dollar sign in front of those variables, > add a > semicolon to the end of each statement, and you should be good to go. > > Here's a simple inputbox example for php: > $return_values = `/path/to/CocoaDialog standard-inputbox --text "hello > world" --string-output`; > list($button, $value) = explode("\n", $return_values); > echo "User typed $value and pressed the $button button.\n"; > > hope this helps. > - mark > > Andy H wrote: >> Hello all. First off, I've just started to use Cocoadialog today. I'm >> trying to incorporate my PHP script that has args into a GUI using >> Platypus and Cocoadialog. So, my problem is that cocoadialog is >> reporting the wrong args to the PHP script. My bash shell script >> looks >> like this: >> >> #!/bin/bash >> >> CD="CocoaDialog.app/Contents/MacOS/CocoaDialog" >> un=`$1/Contents/Resources/$CD inputbox --title "Username" --no- >> newline >> --width 400 --height 250 --informative-text "Enter your username >> here" >> --button1 "Enter"` >> pass=`$1/Contents/Resources/$CD inputbox --width 400 --no-newline >> --height 250 --no-show --informative-text "Enter your password" >> --button1 "Enter"` >> coins=`$1/Contents/Resources/$CD inputbox --width 400 --height 250 >> --informative-text "Enter the amount of coins you wish to have here >> (must be between 1 and 1,000,000. the higher you go, the better >> chance >> you have of being banned)" --button1 "Enter"` >> php $1/Contents/Resources/files/mm.php $un $pass $coins >> >> My PHP script's variables look like this: >> $Username = $argv[1]; >> $Password = $argv[2]; >> $coins = $argv[3]; >> >> So, when I run the script, and tell it to echo the args I gave it >> from >> bash (echo "$un" echo "$pass" etc etc..) and my username is foo, >> password is fooie, and coins is 10 it returns: >> 1 >> foo >> 1 >> fooie >> 1 >> 10 >> >> I read up on this, and it seems that it echos what button was pressed >> then in a new line it says the text that was entered. Is there a way >> that I can remove the number that says what button was pressed and >> just make it say the text entered in three lines? >> >> Thanks, >> Andy >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------------ >> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, >> Nevada. >> The future of the web can't happen without you. Join us at MIX09 >> to help >> pave the way to the Next Web now. Learn more and register at >> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Cocoadialog-users mailing list >> Coc...@li... >> https://lists.sourceforge.net/lists/listinfo/cocoadialog-users >> > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, > Nevada. > The future of the web can't happen without you. Join us at MIX09 to > help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > Cocoadialog-users mailing list > Coc...@li... > https://lists.sourceforge.net/lists/listinfo/cocoadialog-users |