Re: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates

2010-12-22 Thread Adam Morris
> print sa.do_shell_script("ls -l", administrator_privileges=True)

Thanks Charles, I had forgotten that do shell script is a part of the
Standard Addition osax. Now I know how to run a script that needs the
user's permission without having to use some GUI scripts to get the
admin/password dialog.
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates

2010-12-22 Thread Charles Turner
OK, I got it:

> import osax
> 
> sa = osax.OSAX()
> 
> print sa.do_shell_script("ls -l", administrator_privileges=True)

If you look in the Applescript dictionary, it appears the function syntax is:

> set theResult to do shell script unicode text ¬
>  as type class ¬
>  administrator privileges boolean ¬
>  user name unicode text ¬
>  password unicode text ¬
>  altering line endings boolean

So administrator privileges is a boolean.

Have a look at the documentation for py-appscript OSAX:



And there's this about invoking the shell from Applescript:



HTH, Charles

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates

2010-12-22 Thread Charles Turner
On Dec 22, 2010, at 2:12 AM, Adam Morris wrote:

> How to translate this applescript into appscript?:
> 
> do shell script "sudo rm /usr/bin/file" with administrator privileges
> 
> Thanks for your software, has.

I don't have the "with" solved, but it goes something like this:

>> import osax
>> 
>> sa = osax.OSAX()
>> 
>> print sa.do_shell_script("ls -l")

HTH, Charles


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] [ann] ASDictionary, ASTranslate updates

2010-12-21 Thread Adam Morris
How to translate this applescript into appscript?:

do shell script "sudo rm /usr/bin/file" with administrator privileges

Thanks for your software, has.

-Adam
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG