|
Prev: Events on Serial port
Next: after ids
From: daneyul on 3 Jul 2008 18:28 Can anyone tell me why the following doesn't work? (Gives an AppleScript error 000000 was encountered) ### package require Tclapplescript AppleScript execute "do shell script \"/Users/user_name/Desktop/ Updater/updater.app/contents/MacOS/Wish\ Shell"\" with administrator privileges" ### Prepending "sudo -b" to the command doesn't change things (ie: "do shell script /"sudo -b /Users/user_name...) I can launch OSX shell commands (pwd, ls, etc.) with this syntax, but shouldn't I be able to launch a Wish Shell too in this manner? Thanks if anyone can tell me what dumb thing I'm missing! -Daniel
From: Kevin Walzer on 6 Jul 2008 22:06 daneyul wrote: > Can anyone tell me why the following doesn't work? (Gives an > AppleScript error 000000 was encountered) > > ### > package require Tclapplescript > > AppleScript execute "do shell script \"/Users/user_name/Desktop/ > Updater/updater.app/contents/MacOS/Wish\ Shell"\" with administrator > privileges" > ### > > > > Prepending "sudo -b" to the command doesn't change things (ie: "do > shell script /"sudo -b /Users/user_name...) > I can launch OSX shell commands (pwd, ls, etc.) with this syntax, but > shouldn't I be able to launch a Wish Shell too in this manner? > > Thanks if anyone can tell me what dumb thing I'm missing! > > -Daniel Can you explain exactly what you are trying to accomplish here? I use administrator commands in my Tk apps a lot, and I used to try to mix them with AppleScript/administrator privileges, and it just got very clunky. If you can tell me what you are trying to do, I may be able to suggest a better alternative. -- Kevin Walzer Code by Kevin http://www.codebykevin.com
From: Glenn Jackman on 7 Jul 2008 06:49 At 2008-07-03 06:28PM, "daneyul" wrote: > Can anyone tell me why the following doesn't work? (Gives an > AppleScript error 000000 was encountered) > > ### > package require Tclapplescript > > AppleScript execute "do shell script \"/Users/user_name/Desktop/ > Updater/updater.app/contents/MacOS/Wish\ Shell"\" with administrator > privileges" Your quoting is wrong -- you have 3 unescaped quotes. Try: AppleScript execute {do shell script "/Users/user_name/Desktop/ Updater/updater.app/contents/MacOS/Wish Shell" with administrator privileges} -- Glenn Jackman Write a wise saying and your name will live forever. -- Anonymous
From: demarchie on 7 Jul 2008 11:03 The whitespace character in the path has to written "&&" instead of "\ " So try: AppleScript execute {do shell script "/Users/user_name/Desktop/ Updater/updater.app/contents/MacOS/Wish&&Shell" with administrator privileges} Cheers, Reinhold Straub
From: daneyul on 7 Jul 2008 14:59 > Can you explain exactly what you are trying to accomplish here? I use > administrator commands in my Tk apps a lot, and I used to try to mix > them with AppleScript/administrator privileges, and it just got very > clunky. If you can tell me what you are trying to do, I may be able to > suggest a better alternative. > > -- > Kevin Walzer Sounds exactly like the kind of workaround I'm playing with-- basically, the goal is to perform a series of file copies to update a software package. I want to have the user run a single, double-clickable wish script that will prompt for the administrative password no more than once, then copy in the necessary files--some going into my software folder, but a few going into locations that potentially need administrative privileges. tclAuthorization works, but as far as I know prompts for every operation. I don't want them having to enter the password each time. Is there a technique for getting just one password prompt? I could simply build a shell script and launch it with sudo with tclAuthorization::executeWithPrivileges, but I want an easier way to deal with feedback as each copy is made/backup is made. So...I was trying to use AppleScript to do it with the "do shell script ... with administrator privileges" option. The gist of the idea there was to make an "AppMain.tcl" which, when its app is double- clicked, launches another instance of itself via the AppleScript command (with an argument flag), then exits. At least that's the idea...but the ways of wish on the Mac are strange to me... My thoughts were something like: ### # AppMain.tcl package require Tclapplescript if {[lindex $argv 1] != "launch_it"} { AppleScript execute "do shell script \"/Users/user_name/Desktop/ Updater/updater.app/contents/MacOS/Wish\ Shell\ launch_it" with administrator privileges" exit } source Update_script.tcl ### (Of course, in my initial noodling around, I couldn't even get the "wish shell" to launch at all via ApplScript, much less pass an argument to it, so here I am. If you do have any techniques that might apply I would definitely love to hear them! Thanks! -Daniel
|
Pages: 1 Prev: Events on Serial port Next: after ids |