Utils Module

New in version 0.1.1.

A collection of classes for interacting with macOS features in various ways.

Classes:

AppBuilder(name)

A class for constructing on-the-fly PyXA Application classes for scriptable applications that do not have a pre-defined class.

SDEFParser(sdef_file)

A class for parsing SDEF files and generating Python code for interacting with scriptable applications.

class PyXA.Additions.Utils.AppBuilder(name: str)[source]

Bases: object

A class for constructing on-the-fly PyXA Application classes for scriptable applications that do not have a pre-defined class.

Warning

This is an experimental feature and may not work as expected.

New in version 0.3.0.

Methods:

application()

Creates and instantiates a new PyXA Application class for the application specified in the AppBuilder's name attribute.

application()[source]

Creates and instantiates a new PyXA Application class for the application specified in the AppBuilder’s name attribute.

Returns:

An instance of the newly created PyXA Application class.

Return type:

PyXA.Application

class PyXA.Additions.Utils.SDEFParser(sdef_file: XAPath | str)[source]

Bases: object

A class for parsing SDEF files and generating Python code for interacting with scriptable applications.

New in version 0.1.1.

Methods:

export(output_file)

Exports the scripting suites parsed from the SDEF file to a Python module.

parse()

Parses the SDEF file specified in the SDEFParser's file attribute.

Attributes:

file

The full path to the SDEF file to parse

export(output_file: XAPath | str)[source]

Exports the scripting suites parsed from the SDEF file to a Python module.

Parameters:

output_file (Union[XABase.XAPath, str]) – The full path to the file to export module code to.

file

The full path to the SDEF file to parse

parse()[source]

Parses the SDEF file specified in the SDEFParser’s file attribute.

Returns:

A list of scripting suites, each containing a list of classes and a dictionary of commands.

Return type:

list[dict[str, Any]]

New in version 0.1.1.