Automator Module Reference
New in version 0.0.4.
Control Automator using JXA-like syntax.
Classes:
|
A class for managing and interacting with actions in Automator.app. |
|
A wrapper around a list of Automator required resources which utilizes fast enumeration techniques. |
|
A class for managing and interacting with Automator.app. |
|
A class for managing and interacting with Automator windows. |
|
A wrapper around a list of Automator documents which utilizes fast enumeration techniques. |
|
A class for managing and interacting with required resources in Automator.app. |
|
A wrapper around a list of Automator required resources which utilizes fast enumeration techniques. |
|
A class for managing and interacting with Automator settings (i.e. named values). |
|
A wrapper around a list of Automator settings which utilizes fast enumeration techniques. |
|
A class for managing and interacting with Automator variables. |
|
A wrapper around a list of Automator variables which utilizes fast enumeration techniques. |
|
A class for managing and interacting with Automator windows. |
|
A class for managing and interacting with Automator workflows. |
|
A wrapper around a list of Automator workflows which utilizes fast enumeration techniques. |
- class PyXA.apps.Automator.XAAutomatorAction(properties)[source]
Bases:
XAObject
A class for managing and interacting with actions in Automator.app.
See also
New in version 0.0.4.
Attributes:
The bundle identifier for the action.
The categories that contain the action
The comment for the name of the action.
Whether the action is enabled.
The text error message generated by execution of the action.
The numeric error code generated by execution of the action.
The result of the action, passed as input to the next action.
The name for the icon associated with the action.
The unique identifier for the action.
Whether the action ignores input when run.
The index of the action from the first action in the workflow.
The input types accepted by the action.
The keywords that describe the action.
The localized name of the action.
The output types produced by the action.
The workflow that contains the action.
The path of the file that contains the action.
Whether the action should show its user interface when run.
The application(s) with which the action communicates.
The version of the action.
The action suggested by the warning, if any.
The level of the warning, increasing in likelihood of data loss.
The message that accompanies the warning, if any.
Methods:
required_resources
([filter])Returns a list of required resource, as PyXA objects, matching the given filter.
settings
([filter])Returns a list of settings, as PyXA objects, matching the given filter.
- property bundle_id: str
The bundle identifier for the action.
- property category: list[str]
The categories that contain the action
- property comment: str
The comment for the name of the action.
- property enabled: bool
Whether the action is enabled.
- property execution_error_message: str
The text error message generated by execution of the action.
- property execution_error_number: int
The numeric error code generated by execution of the action.
- property execution_result: Any
The result of the action, passed as input to the next action.
- property icon_name: str
The name for the icon associated with the action.
- property id: str
The unique identifier for the action.
- property ignores_input: bool
Whether the action ignores input when run.
- property index: int
The index of the action from the first action in the workflow.
- property input_types: list[str]
The input types accepted by the action.
- property keywords: list[str]
The keywords that describe the action.
- property name: str
The localized name of the action.
- property output_types: list[str]
The output types produced by the action.
- property parent_workflow: XAAutomatorWorkflow
The workflow that contains the action.
- required_resources(filter: dict | None = None) XAAutomatorRequiredResourceList [source]
Returns a list of required resource, as PyXA objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter resources by, defaults to None
- Returns:
A PyXA list object wrapping a list of required resources
- Return type:
New in version 0.0.4.
- settings(filter: dict | None = None) XAAutomatorSettingList [source]
Returns a list of settings, as PyXA objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter settings by, defaults to None
- Returns:
A PyXA list object wrapping a list of settings
- Return type:
New in version 0.0.4.
- property show_action_when_run: bool
Whether the action should show its user interface when run.
- property target_application: list[str]
The application(s) with which the action communicates.
- property version: str
The version of the action.
- property warning_action: str
The action suggested by the warning, if any.
- property warning_level: WarningLevel
The level of the warning, increasing in likelihood of data loss.
- property warning_message: str
The message that accompanies the warning, if any.
- class PyXA.apps.Automator.XAAutomatorActionList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of Automator required resources which utilizes fast enumeration techniques.
All properties of required resources can be called as methods on the wrapped list, returning a list containing each resource’s value for the property.
New in version 0.0.4.
Methods:
by_bundle_id
(bundle_id)by_category
(category)by_comment
(comment)by_enabled
(enabled)by_execution_error_number
(execution_error_number)by_execution_result
(execution_result)by_icon_name
(icon_name)by_id
(id)by_ignores_input
(ignores_input)by_input_types
(input_types)by_keywords
(keywords)by_name
(name)by_output_types
(output_types)by_parent_workflow
(parent_workflow)by_path
(path)by_show_action_when_run
(show_action_when_run)by_target_application
(target_application)by_version
(version)by_warning_action
(warning_action)by_warning_level
(warning_level)by_warning_message
(warning_message)category
()comment
()enabled
()index
()Returns the index of the first occurrence of the element in the list, or -1 if no such element exists in the list.
keywords
()name
()path
()version
()- by_bundle_id(bundle_id: str) XAAutomatorAction | None [source]
- by_category(category: list[str]) XAAutomatorAction | None [source]
- by_comment(comment: str) XAAutomatorAction | None [source]
- by_enabled(enabled: bool) XAAutomatorAction | None [source]
- by_execution_error_message(execution_error_message: str) XAAutomatorAction | None [source]
- by_execution_error_number(execution_error_number: int) XAAutomatorAction | None [source]
- by_execution_result(execution_result: Any) XAAutomatorAction | None [source]
- by_icon_name(icon_name: str) XAAutomatorAction | None [source]
- by_id(id: str) XAAutomatorAction | None [source]
- by_ignores_input(ignores_input: bool) XAAutomatorAction | None [source]
- by_input_types(input_types: list[str]) XAAutomatorAction | None [source]
- by_keywords(keywords: list[str]) XAAutomatorAction | None [source]
- by_name(name: str) XAAutomatorAction | None [source]
- by_output_types(output_types: list[str]) XAAutomatorAction | None [source]
- by_parent_workflow(parent_workflow: XAAutomatorWorkflow) XAAutomatorAction | None [source]
- by_path(path: str) XAAutomatorAction | None [source]
- by_show_action_when_run(show_action_when_run: bool) XAAutomatorAction | None [source]
- by_target_application(target_application: list[str]) XAAutomatorAction | None [source]
- by_version(version: str) XAAutomatorAction | None [source]
- by_warning_action(warning_action: str) XAAutomatorAction | None [source]
- by_warning_level(warning_level: WarningLevel) XAAutomatorAction | None [source]
- by_warning_message(warning_message: str) XAAutomatorAction | None [source]
- index() list[int] [source]
Returns the index of the first occurrence of the element in the list, or -1 if no such element exists in the list.
New in version 0.1.2.
- parent_workflow() XAAutomatorWorkflowList [source]
- warning_level() list[WarningLevel] [source]
- class PyXA.apps.Automator.XAAutomatorApplication(properties)[source]
Bases:
XASBApplication
,XACanOpenPath
A class for managing and interacting with Automator.app.
See also
New in version 0.0.4.
Classes:
ObjectType
(value)The object types available for creation in Automator.
WarningLevel
(value)Options for warning level in regard to likelihood of data loss.
Methods:
add
(action, workflow[, index])Adds the specified action to a workflow at the specified index.
automator_actions
([filter])Returns a list of Automator actions, as PyXA objects, matching the given filter.
documents
([filter])Returns a list of documents, as PyXA objects, matching the given filter.
make
(specifier, properties, data)Creates a new element of the given specifier class without adding it to any list.
open
(path)Opens the file at the given filepath.
variables
([filter])Returns a list of Automator variables, as PyXA objects, matching the given filter.
workflows
([filter])Returns a list of Automator workflows, as PyXA objects, matching the given filter.
Attributes:
Whether Automator is the active application.
The name of the application.
The version of Automator.app.
- class ObjectType(value)[source]
Bases:
Enum
The object types available for creation in Automator.
New in version 0.3.0.
Attributes:
- ACTION = 'action'
- DOCUMENT = 'document'
- REQUIRED_RESOURCE = 'required_resource'
- SETTING = 'setting'
- VARIABLE = 'variable'
- class WarningLevel(value)[source]
Bases:
Enum
Options for warning level in regard to likelihood of data loss.
Attributes:
- IRREVERSIBLE = 1769108086
- NONE = 1852796517
- REVERSIBLE = 1920361068
- add(action: XAAutomatorAction, workflow: XAAutomatorWorkflow, index: int = -1) XAAutomatorApplication [source]
Adds the specified action to a workflow at the specified index.
- Parameters:
action (XAAutomatorAction) – The action to add
workflow (XAAutomatorWorkflow) – The workflow to add the action to
index (int, optional) – The index at which to add the action, defaults to -1
- Returns:
A reference to the application object
- Return type:
New in version 0.0.4.
- automator_actions(filter: dict | None = None) XAAutomatorActionList [source]
Returns a list of Automator actions, as PyXA objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter actions by, defaults to None
- Returns:
A PyXA list object wrapping a list of actions
- Return type:
New in version 0.0.4.
- documents(filter: dict | None = None) XAAutomatorDocumentList [source]
Returns a list of documents, as PyXA objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter documents by, defaults to None
- Returns:
A PyXA list object wrapping a list of documents
- Return type:
New in version 0.0.4.
- property frontmost: bool
Whether Automator is the active application.
- make(specifier: str | ObjectType, properties: dict, data: Any)[source]
Creates a new element of the given specifier class without adding it to any list.
Use
XABase.XAList.push()
to push the element onto a list.- Parameters:
specifier (Union[str, XAAutomatorApplication.ObjectType]) – The classname of the object to create
properties (dict) – The properties to give the object
data (Any) – The data to give the object
- Returns:
A PyXA wrapped form of the object
- Return type:
New in version 0.0.4.
- property name: str
The name of the application.
- open(path: str | NSURL) XAAutomatorWorkflow [source]
Opens the file at the given filepath.
- Parameters:
target (Union[str, AppKit.NSURL]) – The path to a file or the URL to a website to open.
- Returns:
A reference to the PyXA object that called this method.
- Return type:
New in version 0.0.1.
- variables(filter: dict | None = None) XAAutomatorVariableList [source]
Returns a list of Automator variables, as PyXA objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter variables by, defaults to None
- Returns:
A PyXA list object wrapping a list of variables
- Return type:
New in version 0.0.4.
- property version: str
The version of Automator.app.
- workflows(filter: dict | None = None) XAAutomatorWorkflowList [source]
Returns a list of Automator workflows, as PyXA objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter workflows by, defaults to None
- Returns:
A PyXA list object wrapping a list of workflows
- Return type:
New in version 0.0.4.
- class PyXA.apps.Automator.XAAutomatorDocument(properties)[source]
Bases:
XAObject
A class for managing and interacting with Automator windows.
See also
New in version 0.0.4.
Attributes:
Whether the document has been modified since its last save.
The title of the document.
The path to the document on the disk.
- property modified: bool
Whether the document has been modified since its last save.
- property name: str
The title of the document.
- class PyXA.apps.Automator.XAAutomatorDocumentList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of Automator documents which utilizes fast enumeration techniques.
All properties of documents can be called as methods on the wrapped list, returning a list containing each document’s value for the property.
New in version 0.0.4.
Methods:
by_id
(id)by_index
(index)by_title
(title)id
()index
()Returns the index of the first occurrence of the element in the list, or -1 if no such element exists in the list.
title
()- by_id(id: int) XAAutomatorDocument | None [source]
- by_index(index: int) XAAutomatorDocument | None [source]
- by_title(title: str) XAAutomatorDocument | None [source]
- class PyXA.apps.Automator.XAAutomatorRequiredResource(properties)[source]
Bases:
XAObject
A class for managing and interacting with required resources in Automator.app.
See also
New in version 0.0.4.
Attributes:
The kind of required resource.
The name of the required resource.
The specification of the required resource.
The minimum acceptable version of the required resource.
- property kind: str
The kind of required resource.
- property name: str
The name of the required resource.
- property resource: str
The specification of the required resource.
- property version: int
The minimum acceptable version of the required resource.
- class PyXA.apps.Automator.XAAutomatorRequiredResourceList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of Automator required resources which utilizes fast enumeration techniques.
All properties of required resources can be called as methods on the wrapped list, returning a list containing each resource’s value for the property.
New in version 0.0.4.
Methods:
by_kind
(kind)by_name
(name)by_resource
(resource)by_version
(version)kind
()name
()resource
()version
()- by_kind(kind: str) XAAutomatorRequiredResource | None [source]
- by_name(name: str) XAAutomatorRequiredResource | None [source]
- by_resource(resource: str) XAAutomatorRequiredResource | None [source]
- by_version(version: int) XAAutomatorRequiredResource | None [source]
- class PyXA.apps.Automator.XAAutomatorSetting(properties)[source]
Bases:
XAObject
A class for managing and interacting with Automator settings (i.e. named values).
See also
New in version 0.0.4.
Attributes:
The default value of the setting.
The name of the setting.
The value of the setting.
- property default_value: Any
The default value of the setting.
- property name: str
The name of the setting.
- property value: Any
The value of the setting.
- class PyXA.apps.Automator.XAAutomatorSettingList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of Automator settings which utilizes fast enumeration techniques.
All properties of settings can be called as methods on the wrapped list, returning a list containing each setting’s value for the property.
New in version 0.0.4.
Methods:
by_default_value
(default_value)by_name
(name)by_value
(value)name
()value
()- by_default_value(default_value: Any) XAAutomatorSetting | None [source]
- by_name(name: str) XAAutomatorSetting | None [source]
- by_value(value: Any) XAAutomatorSetting | None [source]
- class PyXA.apps.Automator.XAAutomatorVariable(properties)[source]
Bases:
XAObject
A class for managing and interacting with Automator variables.
See also
New in version 0.0.4.
Attributes:
The name of the variable.
Whether the name and value of the variable can be changed.
The value of the variable.
- property name: str
The name of the variable.
- property settable: bool
Whether the name and value of the variable can be changed.
- property value: Any
The value of the variable.
- class PyXA.apps.Automator.XAAutomatorVariableList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of Automator variables which utilizes fast enumeration techniques.
All properties of variables can be called as methods on the wrapped list, returning a list containing each variable’s value for the property.
New in version 0.0.4.
Methods:
by_name
(name)by_settable
(settable)by_value
(value)name
()settable
()value
()- by_name(name: str) XAAutomatorVariable | None [source]
- by_settable(settable: bool) XAAutomatorVariable | None [source]
- by_value(value: Any) XAAutomatorVariable | None [source]
- class PyXA.apps.Automator.XAAutomatorWindow(properties)[source]
Bases:
XASBWindow
A class for managing and interacting with Automator windows.
See also
New in version 0.0.4.
Attributes:
The document currently displayed in the window.
Whether the window floats.
Whether the window is a modal window.
Whether the window has a title bar.
- property document: XAAutomatorDocument
The document currently displayed in the window.
- property floating: bool
Whether the window floats.
- property modal: bool
Whether the window is a modal window.
- property titled: bool
Whether the window has a title bar.
- class PyXA.apps.Automator.XAAutomatorWorkflow(properties)[source]
Bases:
XAAutomatorDocument
A class for managing and interacting with Automator workflows.
See also
New in version 0.0.4.
Methods:
automator_actions
([filter])Returns a list of actions, as PyXA objects, matching the given filter.
delete
()Closes the workflow.
execute
()Executes the workflow.
save
()Saves the workflow to the disk at the location specified by
XAAutomatorWorkflow.path
, or in the downloads folder if no path has been specified.variables
([filter])Returns a list of variables, as PyXA objects, matching the given filter.
Attributes:
The current or most recent action of the workflow.
The text error message generated by the most recent execution.
The numeric error code generated by the most recent execution.
The unique identifier for the current or most recent execution.
The result of the most resent execution.
The name of the workflow.
- automator_actions(filter: dict | None = None) XAAutomatorActionList [source]
Returns a list of actions, as PyXA objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter actions by, defaults to None
- Returns:
A PyXA list object wrapping a list of actions
- Return type:
New in version 0.0.4.
- property current_action: XAAutomatorAction
The current or most recent action of the workflow.
- execute() Any [source]
Executes the workflow.
- Returns:
The return value of the workflow after execution
- Return type:
Any
New in version 0.0.5.
- property execution_error_message: str
The text error message generated by the most recent execution.
- property execution_error_number: int
The numeric error code generated by the most recent execution.
- property execution_id: str
The unique identifier for the current or most recent execution.
- property execution_result: Any
The result of the most resent execution.
- property name: str
The name of the workflow.
- save() XAAutomatorWorkflow [source]
Saves the workflow to the disk at the location specified by
XAAutomatorWorkflow.path
, or in the downloads folder if no path has been specified.- Returns:
The workflow object.
- Return type:
New in version 0.0.5.
- variables(filter: dict | None = None) XAAutomatorVariableList [source]
Returns a list of variables, as PyXA objects, matching the given filter.
- Parameters:
filter (dict, optional) – Keys and values to filter variables by, defaults to None
- Returns:
A PyXA list object wrapping a list of variables
- Return type:
New in version 0.0.4.
- class PyXA.apps.Automator.XAAutomatorWorkflowList(properties: dict, filter: dict | None = None)[source]
Bases:
XAList
A wrapper around a list of Automator workflows which utilizes fast enumeration techniques.
All properties of workflows can be called as methods on the wrapped list, returning a list containing each workflow’s value for the property.
New in version 0.0.4.
Methods:
by_current_action
(current_action)by_execution_error_number
(execution_error_number)by_execution_id
(execution_id)by_execution_result
(result)by_name
(name)name
()- by_current_action(current_action: XAAutomatorAction) XAAutomatorWorkflow | None [source]
- by_execution_error_message(execution_error_message: str) XAAutomatorWorkflow | None [source]
- by_execution_error_number(execution_error_number: int) XAAutomatorWorkflow | None [source]
- by_execution_id(execution_id: str) XAAutomatorWorkflow | None [source]
- by_execution_result(result: Any) XAAutomatorWorkflow | None [source]
- by_name(name: str) XAAutomatorWorkflow | None [source]
- current_action() XAAutomatorActionList [source]