Calling Mac programs from Python instead of from AppleScript

D

dvschorre

When I'm running Script Editor, I can get Maya to draw a sphere by
typing:

tell application "Maya"
execute "sphere"
end tell

When I try this using Python, I get this error message:

IDLE 1.2.2
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
app('Maya').execute('sphere')
NameError: name 'app' is not defined
Maybe I need to load some libraries first.

Please help me to get started.

Thanks
Dewey V. Schorre
 
K

Kevin Walzer

When I'm running Script Editor, I can get Maya to draw a sphere by
typing:

tell application "Maya"
execute "sphere"
end tell

When I try this using Python, I get this error message:

IDLE 1.2.2

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
app('Maya').execute('sphere')
NameError: name 'app' is not defined

Maybe I need to load some libraries first.

Please help me to get started.

Thanks
Dewey V. Schorre

Take a look at appscript:

http://appscript.sourceforge.net/
 
P

Python.Arno

When I'm running Script Editor, I can get Maya to draw a sphere by
typing:

tell application "Maya"
execute "sphere"
end tell

When I try this using Python, I get this error message:

IDLE 1.2.2

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
app('Maya').execute('sphere')
NameError: name 'app' is not defined

Maybe I need to load some libraries first.

I never used applescript more than to record some clicks but you might
try

tell application "/Applications/Autodesk/maya2008/Maya"

(replace maya2008 with you app's foldername)
or even

tell application "/Applications/Autodeks/maya2008/Maya/Contents/MacOS/
Maya"

Please help me to get started.
like any other VFX app, maya is also adding python libs
you can access MEL commands from a python library:
http://www.autodesk.com/us/maya/doc...ces&file=Introduction_to_Maya_Python_API.html

Thanks
Dewey V. Schorre
gr
Arno Beekman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top