[CODE] MacOS X code to execute shell command with administrator priviledges

Andre Garzia andre at andregarzia.com
Wed Jun 30 09:57:05 CDT 2010


If you ever use this on tRev or Rodeo take a screen shot of the lines and
send it to me, I will print it and put it on my wall! :-D

On Wed, Jun 30, 2010 at 11:40 AM, Jerry Daniels <jerry.daniels at me.com>wrote:

> Great stuff, Andre, thanks!
>
> On Jun 30, 2010, at 9:16 AM, Andre Garzia wrote:
>
> > Folks,
> >
> > I just created a tiny function that I think might be useful for people
> here.
> >
> > Sometimes you want to execute a command with shell() on mac os x but your
> > command needs to be run with administrator priviledges. Some might try to
> > script sudo to do this or just give up because scripting sudo is not that
> > easy. Well, it turns out there's a simpler solution using applescript. So
> > here it is:
> >
> > function executeWithPriviledges pCmd
> >   do format("do shell script \"%s\" with administrator privileges", pCmd)
> > as applescript
> >   return the result
> > end executeWithPriviledges
> >
> > also available at http://wecode.org/paste/A9HF2D6
> >
> > This function will execute the command passed to it with administrator
> > priviledges, it will display the standard mac os x dialog box for
> > authorization. It uses applescript that in taps into Mac OS X
> Authorization
> > Services API.
> >
> > It think it is useful, specially for all those people running "apachectl
> > graceful" from inside rev (is it just me?)
> >
> > Andre
> >
> > --
> > http://www.andregarzia.com All We Do Is Code.
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list