######   ##    ##
 ##    ##  ##   ##
 ##        ##  ##
  ######   #####
       ##  ##  ##
 ##    ##  ##   ##
  ######   ##    ##


PyXA
View On GitHub
Support Development
Python for Automation, or PyXA for short, is a wrapper around sever
frameworks that enables AppleScript- and JXA-like control over macO
applications from within Python. PyXA's objects and methods are bas
applications' scripting dictionaries and coupled with additional au
features supported by Apple's macOS APIs.

PyXA was created with the goals of:

  1. Simplifying the way automation tasks can be accomplished via P

  2. Introducing new features to macOS application scripting by sim
     complex procedures into simple, declarative methods

  3. Disambiguating the capabilities of application scripting on ma
     providing easy-to-follow documentation throughout the entire p

PyXA fills a gap where currently available frameworks ultimately fa
it aims to be easy to learn for users accustomed to Python (or user
must use Python). To that end, the package's documentation contains
examples of how to use just about every method, and additional exam
provided covering specific use cases. PyXA's code also serves as a 
examples for how to use PyObjC to interact with various macOS frame

PyXA is not intended to replace AppleScript or even to cover 100% o
AppleScript's capabilities. Instead, PyXA is meant to provide gener
convenience in accomplishing AppleScript and other automation tasks
Python, for the most commonly used applications. If you need a comp
Apple Event bridge, or if you find that PyXA cannot handle your par
use case, consider using appscript or one of its derivatives. If yo
need something that works in most circumstances, that has abundant 
for you to reference, and supports some additional automation featu
as opening Maps to a specific address), then PyXA might be a good f

Feature Overview

  - Support for most AppleScript commands in built-in macOS applica
    some third-party applications (in progress)

  - Scripting capabilities for several non-scriptable applications 

  - Support for direct operations on non-scriptable applications (e

  - Command Chaining similar to JXA (e.g. PyXA.application("Reminde

  - Properties of scriptable elements accessible via object attribu

  - Support for UI scripting of non-scriptable applications

  - Fast enumeration of scriptable objects

  - Automatic translation of clipboard items to PyXA objects

  - Support for compiling and executing AppleScript scripts via NSA

  - Full access to and control over the system clipboard

  - Support for dialogs, alerts, file/color pickers, and notificati

  - Classes for speech and speech recognition

  - Ability to create custom menu bar items


Examples
Example 1 - Open URL in Safari
Example 2 - Print Current Track Information
Example 3 - Create New Note With Calendar/Reminders Agenda
Menu
root