Issuing "sudo" cmds + password from Rev Scripts
Mark Schonewille
m.schonewille at economy-x-talk.com
Sat Feb 16 17:36:36 EST 2008
Hi Sivakatirswami,
A nice way to do this is to use AppleScript:
do shell script "a shell command here" with administrator privileges
and another way is to pipe the password. Here is an example that
empties the trash:
on mouseUp
ask "Enter your password"
if it is not empty then
put it into myPW
put "#!/bin/sh" & cr into myScript
put "pw=" & quote & myPW & quote & cr after myScript
put "echo $pw | sudo rm -rf ~/.Trash/*" & cr after myScript
put shell(myScript) into myCheck -- do the command & get the
result
end if
end mouseUp
Unfortunately, you will have to make a password dialog window to do
this correctly.
Best regards,
Mark Schonewille
--
Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Convert colours between different colour spaces with Color Converter.
Download at http://economy-x-talk.com/cc.html
Op 16-feb-2008, om 23:26 heeft Sivakatirswami het volgende geschreven:
> I've been bitten very hard recently with Apple's new quarantine bit
> set in extended attributes for downloaded files. I used to be able
> to open 20-40 text files that I might receive from a remote
> correspondent, in BBedit in one go and spellcheck them rapidly...
> Now I get the dread "This is a web application downloaded from the
> internet...." I click "OK" and only the first of the selected
> files open.
>
> It is possible to set up folder actions with apple script to apply:
>
> sudo xattr -d com.apple.quarantine /Downloads
>
> to all incoming downloads saved that folder. One can also drop into
> terminal and work on the cmd line... very inefficient.. I would
> like to make a little Rev utility to run against an existing file
> set that may have been moved or saved to a different location.
>
> How do does one deal, from within a Rev script, with the shell
> requirement to enter the password before sudo executes? I saw an
> earlier thread where one might approach this by doing it thru
> apples script. Does that mean it's not possible with transcript alone?
>
> Or perhaps someone knows of such a utility already? I can't find
> one on the net and people are complaining about this as recently as
> Jan 20th... It will be a simple matter to set up a drag and drop
> button that gets a path and runs the cmd against all files in a
> folder... but I need a way to supply the password...
>
>
More information about the use-livecode
mailing list