py-appscript

3. Examples

from osax import *

# Create an OSAX instance that contains Standard Additions
# terminology and targets the host process
sa = OSAX() 

# Beep
sa.beep()

# Speak a phrase
sa.say("Hello World!")

# Get path to user's Scripts folder
print sa.path_to(k.scripts_folder)
# Result: mactypes.Alias(u"/Users/foo/Library/Scripts/")

# Display a dialog
print sa.display_dialog("Python says hello!",
                        buttons=["Hi!", "Howdy!", "Duuuude!"],
                        default_button=3)
# Result: {k.button_returned: u"Howdy!"}