Common writable folders

Ken Ray kray at sonsothunder.com
Thu Jan 18 16:28:49 EST 2007


On Jan 18, 2007, at 12:13 PM, J. Landman Gay wrote:

> sims wrote:
>> At 8:48 PM -0800 1/17/07, Richard Gaskin wrote:
>>> You mean Apple provides no way for any scripting language to  
>>> request authorization on its own? Not even AppleScript?
>> For the dialog use AppleScript:
>> do shell script "command" with administrator privileges
>> To pass other items use:
>> do shell script "command" user name "me" password "mypassword"  
>> with administrator privileges
>
> I'm having trouble with this. I do get the official Apple password  
> dialog, but can't execute a command.
>
> I want to change permissions on a folder. This script fails with  
> "execution error":
>
> put "chmod 777 /Library/Application Support/myfolder/" into tShellCmd
>   put "do shell script" &&quote& tShellCmd &quote&& "with  
> administrator privileges" into tCmd
>   do tCmd as applescript
>   put the result
>
> So I figured I needed to escape the space. When I do that, this  
> script fails with "compiler error":
>
> put "chmod 777 /Library/Application\ Support/myfolder/" into tShellCmd
>   put "do shell script" &&quote& tShellCmd &quote&& "with  
> administrator privileges" into tCmd
>   do tCmd as applescript
>   put the result

Jacque, you needt to escape the backslash because AppleScript uses  
that for its own purposes. Try this:

   put "chmod 777 /Library/Application\\ Support/myfolder/" into  
tShellCmd
   put "do shell script" &&quote& tShellCmd &quote&& "with  
administrator privileges" into tCmd
   do tCmd as applescript
   put the result


Ken Ray
Sons of Thunder Software, Inc.
Web Site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com






More information about the use-livecode mailing list