Finder Module Reference

New in version 0.0.1.

Control Finder using JXA-like syntax.

Classes:

XAFinderAliasFile(properties)

A class for managing and interacting with alias files in Finder.app.

XAFinderAliasFileList(properties[, filter])

A wrapper around lists of alias files that employs fast enumeration techniques.

XAFinderApplication(properties)

A class for managing and interacting with Finder.app.

XAFinderApplicationFile(properties)

A class for managing and interacting with application files in Finder.app.

XAFinderApplicationFileList(properties[, filter])

A wrapper around lists of application files that employs fast enumeration techniques.

XAFinderClipping(properties)

A class for managing and interacting with clippings in Finder.app.

XAFinderClippingList(properties[, filter])

A wrapper around lists of clippings that employs fast enumeration techniques.

XAFinderClippingWindow(properties)

A class for managing and interacting with clipping windows in Finder.

XAFinderClippingWindowList(properties[, filter])

A wrapper around lists of clipping windows that employs fast enumeration techniques.

XAFinderColumn(properties)

A class for managing and interacting with columns in Finder windows.

XAFinderColumnList(properties[, filter])

A wrapper around lists of Finder columns that employs fast enumeration techniques.

XAFinderColumnViewOptions(properties)

A class representing the column view options of a Finder window.

XAFinderComputer(properties)

A class for managing and interacting with the Desktop.

XAFinderContainer(properties)

A class for managing and interacting with containers in Finder.

XAFinderContainerList(properties[, filter, ...])

A wrapper around lists of containers that employs fast enumeration techniques.

XAFinderDesktop(properties)

A class for managing and interacting with the Desktop.

XAFinderDesktopWindow(properties)

A class representing the containing window around Finder's desktop element.

XAFinderDisk(properties)

A class for managing and interacting with disks in Finder.

XAFinderDiskList(properties[, filter])

A wrapper around lists of disks that employs fast enumeration techniques.

XAFinderDocumentFile(properties)

A class for managing and interacting with document files in Finder.app.

XAFinderDocumentFileList(properties[, filter])

A wrapper around lists of document files that employs fast enumeration techniques.

XAFinderFile(properties)

A class for managing and interacting with files in Finder.

XAFinderFileList(properties[, filter, obj_class])

A wrapper around lists of files that employs fast enumeration techniques.

XAFinderFinderWindow(properties)

A class for managing and interacting with internal windows within Finder.app.

XAFinderFinderWindowList(properties[, filter])

A wrapper around lists of Finder internal windows (such as preference and information windows) that employs fast enumeration techniques.

XAFinderFolder(properties)

A class for managing and interacting with folders in Finder.

XAFinderFolderList(properties[, filter])

A wrapper around lists of folders that employs fast enumeration techniques.

XAFinderIconViewOptions(properties)

A class representing the icon view options of a Finder window.

XAFinderInformationWindow(properties)

A class for interacting with information windows in Finder.app.

XAFinderInformationWindowList(properties[, ...])

A wrapper around lists of info windows that employs fast enumeration techniques.

XAFinderInternetLocationFile(properties)

A class for managing and interacting with internet location files in Finder.app.

XAFinderInternetLocationFileList(properties)

A wrapper around lists of internet location files that employs fast enumeration techniques.

XAFinderItem(properties)

A generic class with methods common to the various item classes of Finder.

XAFinderItemList(properties[, filter, ...])

A wrapper around lists of Finder items that employs fast enumeration techniques.

XAFinderListViewOptions(properties)

A class representing the list view options in a Finder window.

XAFinderPackage(properties)

A class for managing and interacting with packages in Finder.app.

XAFinderPackageList(properties[, filter])

A wrapper around lists of packages that employs fast enumeration techniques.

XAFinderPreferences(properties)

A class for managing general preferences of Finder.app.

XAFinderPreferencesWindow(properties)

A class for managing and interacting with preference windows in Finder.app.

XAFinderTrash(properties)

A class for managing and interacting with Finder's Trash.

XAFinderWindow(properties)

A class for managing and interacting with windows of Finder.app.

XAFinderWindowList(properties[, filter, ...])

A wrapper around lists of Finder windows that employs fast enumeration techniques.

class PyXA.apps.Finder.XAFinderAliasFile(properties)[source]

Bases: XAFinderFile

A class for managing and interacting with alias files in Finder.app.

New in version 0.0.3.

Attributes:

original_item

The original item pointed to by the alias.

property original_item: XAFinderItem

The original item pointed to by the alias.

class PyXA.apps.Finder.XAFinderAliasFileList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderFileList

A wrapper around lists of alias files that employs fast enumeration techniques.

All properties of alias files can be called as methods on the wrapped list, returning a list containing each alias files’s value for the property.

New in version 0.0.3.

Methods:

by_original_item(original_item)

original_item()

by_original_item(original_item: XAFinderItem) XAFinderAliasFile | None[source]
original_item() list[XAFinderItem][source]
class PyXA.apps.Finder.XAFinderApplication(properties)[source]

Bases: XASBApplication, XACanOpenPath

A class for managing and interacting with Finder.app.

Changed in version 0.0.3: Added methods and properties to reach parity with Finder.h.

New in version 0.0.1.

Classes:

Arrangement(value)

Arrangement options for lists of items in Finder windows.

ColumnName(value)

Columns in Finder windows.

IconSize(value)

Options for the size of icons in Finder windows.

ItemFormat(value)

Options for file and disk formats of Finder items.

LabelPosition(value)

Options for the label position of items in Finder windows.

Panel(value)

Options for information panels in Finder.

PrivacySetting(value)

Options for privacy settings on Finder items.

SortDirection(value)

Options for sort direction of lists of Finder items.

ViewSetting(value)

View options for lists of items in Finder windows.

Methods:

alias_files([filter])

Returns a list of alias files matching the filter.

application_files([filter])

Returns a list of application files matching the filter.

applications_directory()

Obtains a reference to the system applications directory.

clipping_windows([filter])

Returns a list of clipping windows matching the filter.

clippings([filter])

Returns a list of clippings matching the filter.

containers([filter])

Returns a list of containers matching the filter.

delete_item(path)

Permanently deletes the file or folder at the specified path.

directory(path)

Deprecated since version 0.1.1.

disks([filter])

Returns a list of disks matching the filter.

document_files([filter])

Returns a list of document files matching the filter.

documents_directory()

Obtains a reference to the current user's documents directory.

downloads_directory()

Obtains a reference to the current user's downloads directory.

duplicate_item(path)

Duplicates the specified file or folder in its containing folder.

empty_trash()

Empties the trash.

files([filter])

Returns a list of files matching the filter.

finder_windows([filter])

Returns a list of Finder windows matching the filter.

folders([filter])

Returns a list of folders matching the filter.

get_labels()

Gets the list of file labels.

home_directory()

Obtains a reference to the current user's home directory.

internet_location_files([filter])

Returns a list of internet location files matching the filter.

items([filter])

Returns a list of items matching the filter.

movies_directory()

Obtains a reference to the current user's movies directory.

music_directory()

Obtains a reference to the current user's music directory.

packages([filter])

Returns a list of packages matching the filter.

pictures_directory()

Obtains a reference to the current user's pictures directory.

public_directory()

Obtains a reference to the public directory.

recycle_item(path)

Moves the file or folder at the specified path to the trash.

search(query)

Opens a Finder search window and searches for the specified term.

select_item(path)

Selects the file or folder at the specified path.

select_items(paths)

Selects the files or folders at the specified paths.

temp_directory()

Obtains a reference to the temporary directory for the current user.

trash_directory()

Obtains a reference to the current user's trash directory.

Attributes:

computer_container

The computer directory.

desktop

The user's desktop.

desktop_picture

The desktop picture of the main monitor.

finder_preferences

Preferences for Finder as a whole.

frontmost

Whether Finder is the active application.

home

The home directory.

insertion_location

The container in which a new folder would be created in by default in the frontmost window.

name

The name of the application.

product_version

The system software version.

selection

The currently selected items in Finder.

startup_disk

The startup disk for this system.

trash

The system Trash.

version

The version of Finder

visible

Whether Finder is currently visible.

class Arrangement(value)[source]

Bases: Enum

Arrangement options for lists of items in Finder windows.

Attributes:

BY_CREATION_DATE

BY_KIND

BY_LABEL

BY_MODIFICATION_DATE

BY_NAME

BY_SIZE

NOT_ARRANGED

SNAP_TO_GRID

BY_CREATION_DATE = 1667527777
BY_KIND = 1802071649
BY_LABEL = 1818321505
BY_MODIFICATION_DATE = 1835299937
BY_NAME = 1851878753
BY_SIZE = 1936292449
NOT_ARRANGED = 1851880050
SNAP_TO_GRID = 1735550049
class ColumnName(value)[source]

Bases: Enum

Columns in Finder windows.

Attributes:

COMMENT

CREATION_DATE

KIND

LABEL

MODIFICATE_DATE

NAME

SIZE

VERSION

COMMENT = 1701606211
CREATION_DATE = 1701606243
KIND = 1701606251
LABEL = 1701606252
MODIFICATE_DATE = 1701606253
NAME = 1702063214
SIZE = 1701606259
VERSION = 1701606262
class IconSize(value)[source]

Bases: Enum

Options for the size of icons in Finder windows.

Attributes:

LARGE

SMALL

LARGE = 1818716515
SMALL = 1936550243
class ItemFormat(value)[source]

Bases: Enum

Options for file and disk formats of Finder items.

Attributes:

APFS

APPLE_PHOTO

APPLE_SHARE

AUDIO

EXFAT

FTP

HIGH_SIERRA

ISO9660

MACOS

MACOS_EXTENDED

MSDOS

NFS

NTFS

PACKET_WRITTEN_UDF

PRO_DOS

QUICKTAKE

SMB

UDF

UFS

UNKNOWN

WEBDAV

XSAN

APFS = 1684431216
APPLE_PHOTO = 1684435048
APPLE_SHARE = 1684431219
AUDIO = 1684431221
EXFAT = 1684437094
FTP = 1684432500
HIGH_SIERRA = 1684433011
ISO9660 = 1684420918
MACOS = 1684432998
MACOS_EXTENDED = 1684432939
MSDOS = 1684434291
NFS = 1684434534
NTFS = 1684434548
PACKET_WRITTEN_UDF = 1684435061
PRO_DOS = 1684435058
QUICKTAKE = 1684435316
SMB = 1684435821
UDF = 1684436324
UFS = 1684436326
UNKNOWN = 110390797098047
WEBDAV = 1684436836
XSAN = 1684431203
class LabelPosition(value)[source]

Bases: Enum

Options for the label position of items in Finder windows.

Attributes:

BOTTOM

RIGHT

BOTTOM = 1818390388
RIGHT = 1819436916
class Panel(value)[source]

Bases: Enum

Options for information panels in Finder.

Attributes:

ADVANCED_PREFERENCES

APPLICATION

BURNING

COMMENTS

CONTENT_INDEX

GENERAL_INFORMATION

GENERAL_PREFERENCES

LABEL_PREFERENCES

LANGUAGES

MEMORY

MORE_INFO

NAME_EXTENSION

PLUGINS

PREVIEW

SHARING

SIDEBAR_PREFERENCES

SIMPLE_HEADER

ADVANCED_PREFERENCES = 1885430902
APPLICATION = 1634758252
BURNING = 1651535468
COMMENTS = 1668312684
CONTENT_INDEX = 1667853932
GENERAL_INFORMATION = 1735421548
GENERAL_PREFERENCES = 1885826672
LABEL_PREFERENCES = 1886151280
LANGUAGES = 1886088295
MEMORY = 1836084844
MORE_INFO = 1835626092
NAME_EXTENSION = 1852862060
PLUGINS = 1886089319
PREVIEW = 1987079788
SHARING = 1936748140
SIDEBAR_PREFERENCES = 1886611812
SIMPLE_HEADER = 1936223852
class PrivacySetting(value)[source]

Bases: Enum

Options for privacy settings on Finder items.

Attributes:

NONE

READ_ONLY

READ_WRITE

WRITE_ONLY

NONE = 1852796517
READ_ONLY = 1919246692
READ_WRITE = 1919186802
WRITE_ONLY = 2003986804
class SortDirection(value)[source]

Bases: Enum

Options for sort direction of lists of Finder items.

Attributes:

NORMAL

REVERSED

NORMAL = 1936618093
REVERSED = 1936881267
class ViewSetting(value)[source]

Bases: Enum

View options for lists of items in Finder windows.

Attributes:

COLUMN_VIEW

FLOW_VIEW

GROUP_VIEW

ICON_VIEW

LIST_VIEW

COLUMN_VIEW = 1668052599
FLOW_VIEW = 1718384247
GROUP_VIEW = 1718384247
ICON_VIEW = 1768124022
LIST_VIEW = 1819506295
alias_files(filter: dict | None = None) XAFinderAliasFileList[source]

Returns a list of alias files matching the filter.

New in version 0.0.3.

application_files(filter: dict | None = None) XAFinderApplicationFileList[source]

Returns a list of application files matching the filter.

New in version 0.0.3.

applications_directory() XAFinderFolder[source]

Obtains a reference to the system applications directory.

Returns:

A PyXA reference to the system applications directory.

Return type:

XAFinderFolder

New in version 0.0.1.

clipping_windows(filter: dict | None = None) XAFinderClippingWindowList[source]

Returns a list of clipping windows matching the filter.

New in version 0.0.3.

clippings(filter: dict | None = None) XAFinderClippingList[source]

Returns a list of clippings matching the filter.

New in version 0.0.3.

property computer_container: XAFinderComputer

The computer directory.

containers(filter: dict | None = None) XAFinderContainerList[source]

Returns a list of containers matching the filter.

New in version 0.0.3.

delete_item(path: str | NSURL) XAFinderApplication[source]

Permanently deletes the file or folder at the specified path.

param path:

The path of the file or folder to delete.

type path:

Union[str, AppKit.NSURL]

return:

A reference to the Finder application object.

rtype:

XAFinderApplication

Example:
>>> import PyXA
>>> app = PyXA.Application("Finder")
>>> app.delete_item("/Users/exampleuser/Documents/Example.txt")

See also

delete_items()

New in version 0.0.1.

property desktop: XAFinderDesktop

The user’s desktop.

property desktop_picture: XAFinderFile

The desktop picture of the main monitor.

directory(path: str | NSURL)[source]

Deprecated since version 0.1.1.

Use the folders() method with a filter instead.

disks(filter: dict | None = None) XAFinderDiskList[source]

Returns a list of disks matching the filter.

New in version 0.0.3.

document_files(filter: dict | None = None) XAFinderDocumentFileList[source]

Returns a list of document files matching the filter.

New in version 0.0.3.

documents_directory() XAFinderFolder[source]

Obtains a reference to the current user’s documents directory.

Returns:

A PyXA reference to the user’s documents directory.

Return type:

XAFinderFolder

New in version 0.0.1.

downloads_directory() XAFinderFolder[source]

Obtains a reference to the current user’s downloads directory.

Returns:

A PyXA reference to the user’s downloads directory.

Return type:

XAFinderFolder

New in version 0.0.1.

duplicate_item(path: str) XAFinderApplication[source]

Duplicates the specified file or folder in its containing folder.

The duplicated item will have the name of the original with “ 2” added to the end.

param path:

The path of the file or folder to duplicate.

type path:

str

return:

A reference to the Finder application object.

rtype:

XAFinderApplication

Example:
>>> import PyXA
>>> app = PyXA.Application("Finder")
>>> app.duplicate_item("/Users/exampleuser/Documents/Example.txt")

See also

duplicate_items()

New in version 0.0.1.

empty_trash() XAFinderApplication[source]

Empties the trash.

return:

A reference to the Finder application object.

rtype:

XAFinderApplication

Example:
>>> import PyXA
>>> app = PyXA.Application("Finder")
>>> app.empty_trash()

New in version 0.0.1.

files(filter: dict | None = None) XAFinderFileList[source]

Returns a list of files matching the filter.

New in version 0.0.1.

property finder_preferences: XAFinderPreferences

Preferences for Finder as a whole.

finder_windows(filter: dict | None = None) XAFinderFinderWindowList[source]

Returns a list of Finder windows matching the filter.

New in version 0.0.3.

folders(filter: dict | None = None) XAFinderFolderList[source]

Returns a list of folders matching the filter.

New in version 0.0.1.

property frontmost: bool

Whether Finder is the active application.

get_labels() list[str][source]

Gets the list of file labels.

Returns:

The list of file labels.

Return type:

str

New in version 0.0.1.

property home: XAFinderFolder

The home directory.

home_directory() XAFinderFolder[source]

Obtains a reference to the current user’s home directory.

Returns:

A PyXA reference to the user’s home directory.

Return type:

XAFinderFolder

New in version 0.0.1.

property insertion_location: XAFinderFolder

The container in which a new folder would be created in by default in the frontmost window.

internet_location_files(filter: dict | None = None) XAFinderInternetLocationFileList[source]

Returns a list of internet location files matching the filter.

New in version 0.0.3.

items(filter: dict | None = None) XAFinderItemList[source]

Returns a list of items matching the filter.

New in version 0.0.1.

movies_directory() XAFinderFolder[source]

Obtains a reference to the current user’s movies directory.

Returns:

A PyXA reference to the user’s movies directory.

Return type:

XAFinderFolder

New in version 0.0.1.

music_directory() XAFinderFolder[source]

Obtains a reference to the current user’s music directory.

Returns:

A PyXA reference to the user’s music directory.

Return type:

XAFinderFolder

New in version 0.0.1.

property name: str

The name of the application.

packages(filter: dict | None = None) XAFinderPackageList[source]

Returns a list of packages matching the filter.

New in version 0.0.3.

pictures_directory() XAFinderFolder[source]

Obtains a reference to the current user’s pictures directory.

Returns:

A PyXA reference to the user’s pictures directory.

Return type:

XAFinderFolder

New in version 0.0.1.

property product_version: str

The system software version.

public_directory() XAFinderFolder[source]

Obtains a reference to the public directory.

Returns:

A PyXA reference to the public directory.

Return type:

XAFinderFolder

New in version 0.0.1.

recycle_item(path: str | NSURL) XAFinderApplication[source]

Moves the file or folder at the specified path to the trash.

param path:

The path of the file or folder to recycle.

type path:

Union[str, AppKit.NSURL]

return:

A reference to the Finder application object.

rtype:

XAFinderApplication

Example:
>>> import PyXA
>>> app = PyXA.Application("Finder")
>>> app.recycle_item("/Users/exampleuser/Documents/Example.txt")

See also

recycle_items()

New in version 0.0.1.

search(query: str) XAFinderApplication[source]

Opens a Finder search window and searches for the specified term.

Parameters:

query (str) – The term to search.

Returns:

A reference to the Finder application object.

Return type:

XAFinderApplication

New in version 0.0.1.

select_item(path: str) XAFinderApplication[source]

Selects the file or folder at the specified path.

This opens a new tab of Finder unless the current tab is the parent folder of the provided path and no item is currently selected.

Parameters:

path (str) – The path of the file or folder to select.

Returns:

A reference to the Finder application object.

Return type:

XAFinderApplication

Example:

>>> import PyXA
>>> app = PyXA.Application("Finder")
>>> app.select_item("/Users/exampleuser/Documents/Example.txt")

See also

select_items()

New in version 0.0.1.

select_items(paths: list[str]) XAFinderApplication[source]

Selects the files or folders at the specified paths.

This opens a new tab of Finder for each different parent folder in the list of paths to select. This method utilizes fast specialized methods from Objective-C to improve the performance of selecting large amounts of files. As such, when dealing with multiple file paths, this method should always be used instead of calling select_item() repeatedly.

Parameters:

path – The paths to select.

Returns:

A reference to the Finder application object.

Return type:

XAFinderApplication

Example:

>>> import PyXA
>>> app = PyXA.Application("Finder")
>>> items = ["/Users/exampleuser/Documents/Example 1.txt", "/Users/exampleuser/Documents/Example 2.txt"]
>>> app.select_items(items)

See also

select_item()

New in version 0.0.1.

property selection: XAFinderItemList

The currently selected items in Finder.

property startup_disk: XAFinderDisk

The startup disk for this system.

temp_directory() XAFinderFolder[source]

Obtains a reference to the temporary directory for the current user.

Returns:

A PyXA reference to the user’s temporary directory.

Return type:

XAFinderFolder

New in version 0.0.1.

property trash: XAFinderTrash

The system Trash.

trash_directory() XAFinderFolder[source]

Obtains a reference to the current user’s trash directory.

Returns:

A PyXA reference to the user’s trash directory.

Return type:

XAFinderFolder

New in version 0.0.1.

property version: str

The version of Finder

property visible: bool

Whether Finder is currently visible.

class PyXA.apps.Finder.XAFinderApplicationFile(properties)[source]

Bases: XAFinderFile

A class for managing and interacting with application files in Finder.app.

New in version 0.0.3.

Attributes:

has_scripting_terminology

Whether the process can be scripted.

id

The bundle identifier or creator type of the application.

property has_scripting_terminology: bool

Whether the process can be scripted.

property id: str

The bundle identifier or creator type of the application.

class PyXA.apps.Finder.XAFinderApplicationFileList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderFileList

A wrapper around lists of application files that employs fast enumeration techniques.

All properties of application files can be called as methods on the wrapped list, returning a list containing each application file’s value for the property.

New in version 0.0.3.

Methods:

by_has_scripting_terminology(...)

by_id(id)

has_scripting_terminology()

id()

by_has_scripting_terminology(has_scripting_terminology: bool) XAFinderApplicationFile | None[source]
by_id(id: str) XAFinderApplicationFile | None[source]
has_scripting_terminology() list[bool][source]
id() list[str][source]
class PyXA.apps.Finder.XAFinderClipping(properties)[source]

Bases: XAFinderFile

A class for managing and interacting with clippings in Finder.app.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderClippingList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderFileList

A wrapper around lists of clippings that employs fast enumeration techniques.

All properties of clippings can be called as methods on the wrapped list, returning a list containing each clipping’s value for the property.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderClippingWindow(properties)[source]

Bases: XAFinderWindow, XASBPrintable

A class for managing and interacting with clipping windows in Finder.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderClippingWindowList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderWindowList

A wrapper around lists of clipping windows that employs fast enumeration techniques.

All properties of clipping windows can be called as methods on the wrapped list, returning a list containing each window’s value for the property.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderColumn(properties)[source]

Bases: XAObject

A class for managing and interacting with columns in Finder windows.

New in version 0.0.3.

Attributes:

index

The index of the column in the front-to-back ordering within the containing window.

maximum_width

The maximum width allowed for the column in pixels.

minimum_width

The minimum width allowed for the column in pixels.

name

The column name.

sort_direction

The direction which the window is sorted.

visible

Whether the column is visible.

width

The current width of the column in pixels.

property index: int

The index of the column in the front-to-back ordering within the containing window.

property maximum_width: int

The maximum width allowed for the column in pixels.

property minimum_width: int

The minimum width allowed for the column in pixels.

property name: ColumnName

The column name.

property sort_direction: SortDirection

The direction which the window is sorted.

property visible: bool

Whether the column is visible.

property width: int

The current width of the column in pixels.

class PyXA.apps.Finder.XAFinderColumnList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of Finder columns that employs fast enumeration techniques.

All properties of Finder columns can be called as methods on the wrapped list, returning a list containing each columns’s value for the property.

New in version 0.0.3.

Methods:

by_index(index)

by_maximum_width(maximum_width)

by_minimum_width(minimum_width)

by_name(name)

by_sort_direction(sort_direction)

by_visible(visible)

by_width(width)

index()

Returns the index of the first occurrence of the element in the list, or -1 if no such element exists in the list.

maximum_width()

minimum_width()

name()

sort_direction()

visible()

width()

by_index(index: int) XAFinderColumn | None[source]
by_maximum_width(maximum_width: int) XAFinderColumn | None[source]
by_minimum_width(minimum_width: int) XAFinderColumn | None[source]
by_name(name: str) XAFinderColumn | None[source]
by_sort_direction(sort_direction: SortDirection) XAFinderColumn | None[source]
by_visible(visible: bool) XAFinderColumn | None[source]
by_width(width: int) XAFinderColumn | 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.

maximum_width() list[int][source]
minimum_width() list[int][source]
name() list[str][source]
sort_direction() list[SortDirection][source]
visible() list[bool][source]
width() list[int][source]
class PyXA.apps.Finder.XAFinderColumnViewOptions(properties)[source]

Bases: XAObject

A class representing the column view options of a Finder window.

New in version 0.0.3.

Attributes:

discloses_preview_pane

Whether the preview pane is disclosed in the column view.

shows_icon

Whether icons are shown in the column view.

shows_icon_preview

Whether icon previews are shown in the column view.

shows_preview_column

Whether the preview column is shown in the column view.

text_size

The size of text in the column view.

property discloses_preview_pane: bool

Whether the preview pane is disclosed in the column view.

property shows_icon: bool

Whether icons are shown in the column view.

property shows_icon_preview: bool

Whether icon previews are shown in the column view.

property shows_preview_column: bool

Whether the preview column is shown in the column view.

property text_size: int

The size of text in the column view.

class PyXA.apps.Finder.XAFinderComputer(properties)[source]

Bases: XAFinderItem

A class for managing and interacting with the Desktop.

New in version 0.0.2.

class PyXA.apps.Finder.XAFinderContainer(properties)[source]

Bases: XAFinderItem

A class for managing and interacting with containers in Finder.

New in version 0.0.2.

Methods:

alias_files([filter])

Returns a list of alias files matching the filter.

application_files([filter])

Returns a list of application files matching the filter.

clippings([filter])

Returns a list of clippings matching the filter.

containers([filter])

Returns a list of containers matching the filter.

document_files([filter])

Returns a list of document files matching the filter.

files([filter])

Returns a list of files matching the filter.

folders([filter])

Returns a list of folders matching the filter.

internet_location_files([filter])

Returns a list of internet location files matching the filter.

items([filter])

Returns a list of items matching the filter.

packages([filter])

Returns a list of packages matching the filter.

Attributes:

container_window

The container window for this folder.

entire_contents

The entire contents of the container, including the contents of its children.

alias_files(filter: dict | None = None) XAFinderAliasFileList[source]

Returns a list of alias files matching the filter.

New in version 0.0.3.

application_files(filter: dict | None = None) XAFinderApplicationFileList[source]

Returns a list of application files matching the filter.

New in version 0.0.3.

clippings(filter: dict | None = None) XAFinderClippingList[source]

Returns a list of clippings matching the filter.

New in version 0.0.3.

property container_window

The container window for this folder.

containers(filter: dict | None = None) XAFinderContainerList[source]

Returns a list of containers matching the filter.

New in version 0.0.3.

document_files(filter: dict | None = None) XAFinderDocumentFileList[source]

Returns a list of document files matching the filter.

New in version 0.0.3.

property entire_contents

The entire contents of the container, including the contents of its children.

files(filter: dict | None = None) XAFinderFileList[source]

Returns a list of files matching the filter.

New in version 0.0.1.

folders(filter: dict | None = None) XAFinderFolderList[source]

Returns a list of folders matching the filter.

New in version 0.0.1.

internet_location_files(filter: dict | None = None) XAFinderInternetLocationFileList[source]

Returns a list of internet location files matching the filter.

New in version 0.0.3.

items(filter: dict | None = None) XAFinderItemList[source]

Returns a list of items matching the filter.

New in version 0.0.3.

packages(filter: dict | None = None) XAFinderPackageList[source]

Returns a list of packages matching the filter.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderContainerList(properties: dict, filter: dict | None = None, object_class=None)[source]

Bases: XAFinderItemList

A wrapper around lists of containers that employs fast enumeration techniques.

All properties of containers can be called as methods on the wrapped list, returning a list with each container’s value for the property.

New in version 0.0.3.

Methods:

alias_files()

application_files()

by_container_window(container_window)

by_entire_contents(entire_contents)

clippings()

container_window()

containers()

document_files()

entire_contents()

files()

folders()

internet_location_files()

items()

packages()

alias_files() XAFinderAliasFileList[source]
application_files() XAFinderApplicationFileList[source]
by_container_window(container_window: XAFinderFinderWindow) XAFinderContainer | None[source]
by_entire_contents(entire_contents: XAFinderItemList) XAFinderContainer | None[source]
clippings() XAFinderClippingList[source]
container_window() XAFinderFinderWindowList[source]
containers() XAFinderContainerList[source]
document_files() XAFinderDocumentFileList[source]
entire_contents() XAFinderItemList[source]
files() XAFinderFileList[source]
folders() XAFinderFolderList[source]
internet_location_files() XAFinderInternetLocationFileList[source]
items() XAFinderItemList[source]
packages() XAFinderPackageList[source]
class PyXA.apps.Finder.XAFinderDesktop(properties)[source]

Bases: XAFinderContainer

A class for managing and interacting with the Desktop.

New in version 0.0.2.

Attributes:

window

The desktop window.

property window: XAFinderDesktopWindow

The desktop window.

class PyXA.apps.Finder.XAFinderDesktopWindow(properties)[source]

Bases: XAFinderWindow

A class representing the containing window around Finder’s desktop element.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderDisk(properties)[source]

Bases: XAFinderContainer

A class for managing and interacting with disks in Finder.

New in version 0.0.2.

Attributes:

capacity

The total number of bytes on the disk.

ejectable

Whether the disk can be ejected.

format

The format of the disk, e.g. "APFS format".

free_space

The number of free bytes left on the disk.

id

A unique identifier for the disk that is persistent for as long as the disc is connected and Finder is running.

ignore_privileges

Whether to ignore permissions on the disk.

journaling_enabled

Whether the disk does file system journaling.

local_volume

Whether the disk is a local volume vs.

startup

Whether the disk is the boot disk.

property capacity: int

The total number of bytes on the disk.

property ejectable: bool

Whether the disk can be ejected.

property format: ItemFormat

The format of the disk, e.g. “APFS format”.

property free_space: int

The number of free bytes left on the disk.

property id: int

A unique identifier for the disk that is persistent for as long as the disc is connected and Finder is running.

property ignore_privileges: bool

Whether to ignore permissions on the disk.

property journaling_enabled: bool

Whether the disk does file system journaling.

property local_volume: bool

Whether the disk is a local volume vs. a file server.

property startup: bool

Whether the disk is the boot disk.

class PyXA.apps.Finder.XAFinderDiskList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderContainerList

A wrapper around lists of disks that employs fast enumeration techniques.

All properties of disks can be called as methods on the wrapped list, returning a list containing each disk’s value for the property.

New in version 0.0.3.

Methods:

by_capacity(capacity)

by_ejectable(ejectable)

by_format(format)

by_free_space(free_space)

by_id(id)

by_ignore_privileges(ignore_privileges)

by_journaling_enabled(journaling_enabled)

by_local_volume(local_volume)

by_startup(startup)

capacity()

ejectable()

format()

free_space()

id()

ignore_privileges()

journaling_enabled()

local_volume()

startup()

by_capacity(capacity: int) XAFinderDisk | None[source]
by_ejectable(ejectable: bool) XAFinderDisk | None[source]
by_format(format: ItemFormat) XAFinderDisk | None[source]
by_free_space(free_space: int) XAFinderDisk | None[source]
by_id(id: int) XAFinderDisk | None[source]
by_ignore_privileges(ignore_privileges: bool) XAFinderDisk | None[source]
by_journaling_enabled(journaling_enabled: bool) XAFinderDisk | None[source]
by_local_volume(local_volume: bool) XAFinderDisk | None[source]
by_startup(startup: bool) XAFinderDisk | None[source]
capacity() list[int][source]
ejectable() list[bool][source]
format() list[ItemFormat][source]
free_space() list[int][source]
id() list[int][source]
ignore_privileges() list[bool][source]
journaling_enabled() list[bool][source]
local_volume() list[bool][source]
startup() list[bool][source]
class PyXA.apps.Finder.XAFinderDocumentFile(properties)[source]

Bases: XAFinderFile

A class for managing and interacting with document files in Finder.app.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderDocumentFileList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderFileList

A wrapper around lists of document files that employs fast enumeration techniques.

All properties of document files can be called as methods on the wrapped list, returning a list containing each document file’s value for the property.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderFile(properties)[source]

Bases: XAFinderItem, XASBPrintable

A class for managing and interacting with files in Finder.

New in version 0.0.1.

Attributes:

creator_type

The OSType of the application that created the file.

file_type

The OSType of the file and the data within it.

product_version

The version of the application the file was created with.

stationery

Whether the file is a stationery pad.

version

The version of the file.

property creator_type: int

The OSType of the application that created the file.

property file_type: int

The OSType of the file and the data within it.

property product_version: str

The version of the application the file was created with.

property stationery: bool

Whether the file is a stationery pad.

property version: str

The version of the file.

class PyXA.apps.Finder.XAFinderFileList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XAFinderItemList

A wrapper around lists of files that employs fast enumeration techniques.

All properties of files can be called as methods on the wrapped list, returning a list containing each file’s value for the property.

New in version 0.0.3.

Methods:

by_creator_type(creator_type)

by_file_type(file_type)

by_product_version(product_version)

by_stationery(stationery)

by_version(version)

creator_type()

file_type()

product_version()

stationery()

version()

by_creator_type(creator_type: int) XAFinderFile | None[source]
by_file_type(file_type: int) XAFinderFile | None[source]
by_product_version(product_version: str) XAFinderFile | None[source]
by_stationery(stationery: bool) XAFinderFile | None[source]
by_version(version: str) XAFinderFile | None[source]
creator_type() list[int][source]
file_type() list[int][source]
product_version() list[str][source]
stationery() list[bool][source]
version() list[str][source]
class PyXA.apps.Finder.XAFinderFinderWindow(properties)[source]

Bases: XAFinderWindow

A class for managing and interacting with internal windows within Finder.app.

New in version 0.0.3.

Attributes:

column_view_options

The column view options for the container window.

current_view

The current view for the container window.

icon_view_options

The icon view options for the container window.

list_view_options

The list view options for the container window.

pathbar_visible

Whether the window's path bar is visible.

sidebar_width

The width of the sidebar in pixels.

statusbar_visible

Whether the window's status bar is visible.

target

The container at which this file viewer is targeted.

toolbar_visible

Whether the window's toolbar is visible.

property column_view_options: XAFinderColumnViewOptions

The column view options for the container window.

property current_view: ViewSetting

The current view for the container window.

property icon_view_options: XAFinderIconViewOptions

The icon view options for the container window.

property list_view_options: XAFinderListViewOptions

The list view options for the container window.

property pathbar_visible: bool

Whether the window’s path bar is visible.

property sidebar_width: int

The width of the sidebar in pixels.

property statusbar_visible: bool

Whether the window’s status bar is visible.

property target: XAFinderContainer

The container at which this file viewer is targeted.

property toolbar_visible: bool

Whether the window’s toolbar is visible.

class PyXA.apps.Finder.XAFinderFinderWindowList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderWindowList

A wrapper around lists of Finder internal windows (such as preference and information windows) that employs fast enumeration techniques.

All properties of the windows can be called as methods on the wrapped list, returning a list containing each windows’s value for the property.

New in version 0.0.3.

Methods:

by_column_view_options(column_view_options)

by_current_view(current_view)

by_icon_view_options(icon_view_options)

by_list_view_options(list_view_options)

by_pathbar_visible(pathbar_visible)

by_sidebar_width(sidebar_width)

by_statusbar_visible(statusbar_visible)

by_target(target)

by_toolbar_visible(toolbar_visible)

column_view_options()

current_view()

icon_view_options()

list_view_options()

pathbar_visible()

sidebar_width()

statusbar_visible()

target()

toolbar_visible()

by_column_view_options(column_view_options: XAFinderColumnViewOptions) XAFinderFinderWindow | None[source]
by_current_view(current_view: ViewSetting) XAFinderFinderWindow | None[source]
by_icon_view_options(icon_view_options: XAFinderIconViewOptions) XAFinderFinderWindow | None[source]
by_list_view_options(list_view_options: XAFinderListViewOptions) XAFinderFinderWindow | None[source]
by_pathbar_visible(pathbar_visible: bool) XAFinderFinderWindow | None[source]
by_sidebar_width(sidebar_width: int) XAFinderFinderWindow | None[source]
by_statusbar_visible(statusbar_visible: bool) XAFinderFinderWindow | None[source]
by_target(target: XAFinderContainer) XAFinderFinderWindow | None[source]
by_toolbar_visible(toolbar_visible: bool) XAFinderFinderWindow | None[source]
column_view_options() list[XAFinderColumnViewOptions][source]
current_view() list[ViewSetting][source]
icon_view_options() list[XAFinderIconViewOptions][source]
list_view_options() list[XAFinderListViewOptions][source]
pathbar_visible() list[bool][source]
sidebar_width() list[int][source]
statusbar_visible() list[bool][source]
target() XAFinderContainerList[source]
toolbar_visible() list[bool][source]
class PyXA.apps.Finder.XAFinderFolder(properties)[source]

Bases: XAFinderContainer

A class for managing and interacting with folders in Finder.

New in version 0.0.1.

class PyXA.apps.Finder.XAFinderFolderList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderContainerList

A wrapper around lists of folders that employs fast enumeration techniques.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderIconViewOptions(properties)[source]

Bases: XAObject

A class representing the icon view options of a Finder window.

New in version 0.0.3.

Attributes:

arrangement

The arrangement setting of icons in icon view.

background_color

The background color of the icon view.

background_picture

The background picture of the icon view.

icon_size

The size of icons in icon view.

label_position

The position of a label around an icon in icon view.

shows_icon_preview

Whether a preview of the icon is shown in the window.

shows_item_info

Whether additional item information is shown in the window.

text_size

The size of text in icon view.

property arrangement: Arrangement

The arrangement setting of icons in icon view.

property background_color: XAColor

The background color of the icon view.

property background_picture: XAFinderFile

The background picture of the icon view.

property icon_size: int

The size of icons in icon view.

property label_position: LabelPosition

The position of a label around an icon in icon view.

property shows_icon_preview: bool

Whether a preview of the icon is shown in the window.

property shows_item_info: bool

Whether additional item information is shown in the window.

property text_size: int

The size of text in icon view.

class PyXA.apps.Finder.XAFinderInformationWindow(properties)[source]

Bases: XAFinderWindow

A class for interacting with information windows in Finder.app.

New in version 0.0.3.

Attributes:

current_panel

The current panel in the information window.

item

The item from which this window was opened.

property current_panel: Panel

The current panel in the information window.

property item: XAFinderItem

The item from which this window was opened.

class PyXA.apps.Finder.XAFinderInformationWindowList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderWindowList

A wrapper around lists of info windows that employs fast enumeration techniques.

All properties of info windows can be called as methods on the wrapped list, returning a list containing each window’s value for the property.

New in version 0.0.3.

Methods:

by_current_panel(current_panel)

by_item(item)

current_panel()

item()

by_current_panel(current_panel: Panel) XAFinderInformationWindow | None[source]
by_item(item: XAFinderItem) XAFinderInformationWindow | None[source]
current_panel() list[Panel][source]
item() XAFinderItemList[source]
class PyXA.apps.Finder.XAFinderInternetLocationFile(properties)[source]

Bases: XAFinderFile

A class for managing and interacting with internet location files in Finder.app.

New in version 0.0.3.

Attributes:

location

The internet location.

property location: str

The internet location.

class PyXA.apps.Finder.XAFinderInternetLocationFileList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderFileList

A wrapper around lists of internet location files that employs fast enumeration techniques.

All properties of internet location files can be called as methods on the wrapped list, returning a list containing each file’s value for the property.

New in version 0.0.3.

Methods:

by_location(location)

location()

by_location(location: str) XAFinderInternetLocationFile | None[source]
location() list[str][source]
class PyXA.apps.Finder.XAFinderItem(properties)[source]

Bases: XAObject, XASelectable, XADeletable, XAClipboardCodable

A generic class with methods common to the various item classes of Finder.

New in version 0.0.1.

Attributes:

bounds

The bounding rectangle of an item.

comment

The user-specified comment on the item.

container

The container of the item.

creation_date

The date the item was created.

description

The description of the item.

desktop_position

The position of an item on the desktop.

disk

The disk on which the item is stored.

displayed_name

The user-visible name of the item.

everyone_privileges

The privilege level of everyone else, e.g. "none".

extension_hidden

Whether the file extension is hidden.

group

The name of the group that has access to the item.

group_privileges

The privilege level of the group, e.g. "write only".

icon

The icon bitmap of the item's icon.

index

The index within the containing folder/disk.

information_window

The information window for this item.

kind

The kind of the item, e.g. "Folder" or "File".

label_index

The label assigned to the item.

locked

Whether the file is locked.

modification_date

The date the item was last modified.

name

The name of the item.

name_extension

The file extension of the item.

owner

The name of the user that owns the item.

owner_privileges

The privilege level of the owner, e.g. "read only".

physical_size

The actual disk space used by the item.

position

The position of the item within the parent window.

properties

Every property of an item.

size

The logical size of the item.

url

The URL of the item.

Methods:

copy()

Copies the item to the clipboard.

exists()

Checks whether the item exists on the disk or not.

get_clipboard_representation()

Gets a clipboard-codable representation of the item.

move_to(new_path[, overwrite])

Moves the item to the specified path.

open()

Opens the item in its default application.

reveal()

Reveals the item in the frontmost Finder window.

property bounds: XARectangle

The bounding rectangle of an item.

property comment: str

The user-specified comment on the item.

property container: XAFinderContainer

The container of the item.

copy() XAFinderItem[source]

Copies the item to the clipboard.

Returns:

A reference to the Finder item that called this method.

Return type:

XAFinderItem

New in version 0.0.1.

property creation_date: datetime

The date the item was created.

property description: str

The description of the item.

property desktop_position: XAPoint

The position of an item on the desktop.

property disk: XAFinderDisk

The disk on which the item is stored.

property displayed_name: str

The user-visible name of the item.

property everyone_privileges: PrivacySetting

The privilege level of everyone else, e.g. “none”.

exists() bool[source]

Checks whether the item exists on the disk or not.

Returns:

True if the item exists, false otherwise.

Return type:

bool

New in version 0.0.1.

property extension_hidden: bool

Whether the file extension is hidden.

get_clipboard_representation() list[str | NSURL][source]

Gets a clipboard-codable representation of the item.

When the clipboard content is set to a Finder item, the item’s name and URL are added to the clipboard.

Returns:

The name and URL of the item

Return type:

list[Union[str, AppKit.NSURL]]

New in version 0.0.8.

property group: str

The name of the group that has access to the item.

property group_privileges: PrivacySetting

The privilege level of the group, e.g. “write only”.

property icon: XAImage

The icon bitmap of the item’s icon.

property index: int

The index within the containing folder/disk.

property information_window: XAFinderInformationWindow

The information window for this item.

property kind: str

The kind of the item, e.g. “Folder” or “File”.

property label_index: int

The label assigned to the item.

property locked: bool

Whether the file is locked.

property modification_date: datetime

The date the item was last modified.

move_to(new_path: str | NSURL, overwrite: bool = False) XAFinderItem[source]

Moves the item to the specified path.

Parameters:
  • new_path (Union[str, AppKit.NSURL]) – The path to move the item to.

  • overwrite (bool, optional) – Whether to overwrite existing files of the same name at the target path, defaults to False

Returns:

A reference to the Finder item that called this method.

Return type:

XAFinderItem

New in version 0.0.1.

property name: str

The name of the item.

property name_extension: str

The file extension of the item.

open()[source]

Opens the item in its default application.

New in version 0.0.2.

property owner: str

The name of the user that owns the item.

property owner_privileges: PrivacySetting

The privilege level of the owner, e.g. “read only”.

property physical_size: int

The actual disk space used by the item.

property position: XAPoint

The position of the item within the parent window.

property properties: dict

Every property of an item.

reveal() XAFinderItem[source]

Reveals the item in the frontmost Finder window.

Returns:

A reference to the item object

Return type:

XAFinderItem

New in version 0.0.4.

property size: int

The logical size of the item.

property url: XAPath

The URL of the item.

class PyXA.apps.Finder.XAFinderItemList(properties: dict, filter: dict | None = None, object_class=None)[source]

Bases: XAList

A wrapper around lists of Finder items that employs fast enumeration techniques.

All properties of Finder items can be called as methods on the wrapped list, returning a list containing each item’s value for the property.

New in version 0.0.3.

Methods:

bounds()

by_bounds(bounds)

by_comment(comment)

by_container(container)

by_creation_date(creation_date)

by_description(description)

by_desktop_position(desktop_position)

by_disk(disk)

by_displayed_name(displayed_name)

by_everyone_privileges(everyone_privileges)

by_extension_hidden(extension_hidden)

by_group(group)

by_group_privileges(group_privileges)

by_icon(icon)

by_index(index)

by_information_window(information_window)

by_kind(kind)

by_label_index(label_index)

by_locked(locked)

by_modification_date(modification_date)

by_name(name)

by_name_extension(name_extension)

by_owner(owner)

by_owner_privileges(owner_privileges)

by_physical_size(physical_size)

by_position(position)

by_size(size)

by_url(url)

comment()

container()

creation_date()

description()

desktop_position()

disk()

displayed_name()

everyone_privileges()

extension_hidden()

get_clipboard_representation()

Gets a clipboard-codable representation of each item in the list.

group()

group_privileges()

icon()

index()

Returns the index of the first occurrence of the element in the list, or -1 if no such element exists in the list.

information_window()

kind()

label_index()

locked()

modification_date()

name()

name_extension()

owner()

owner_privileges()

physical_size()

position()

size()

url()

bounds() list[tuple[tuple[int, int], tuple[int, int]]][source]
by_bounds(bounds: tuple[tuple[int, int], tuple[int, int]]) XAFinderItem | None[source]
by_comment(comment: str) XAFinderItem | None[source]
by_container(container: XAFinderContainer) XAFinderItem | None[source]
by_creation_date(creation_date: datetime) XAFinderItem | None[source]
by_description(description: str) XAFinderItem | None[source]
by_desktop_position(desktop_position: tuple[int, int]) XAFinderItem | None[source]
by_disk(disk: XAFinderDisk) XAFinderItem | None[source]
by_displayed_name(displayed_name: str) XAFinderItem | None[source]
by_everyone_privileges(everyone_privileges: PrivacySetting) XAFinderItem | None[source]
by_extension_hidden(extension_hidden: bool) XAFinderItem | None[source]
by_group(group: str) XAFinderItem | None[source]
by_group_privileges(group_privileges: PrivacySetting) XAFinderItem | None[source]
by_icon(icon: XAImage) XAFinderItem | None[source]
by_index(index: int) XAFinderItem | None[source]
by_information_window(information_window: XAFinderInformationWindow) XAFinderItem | None[source]
by_kind(kind: str) XAFinderItem | None[source]
by_label_index(label_index: index) XAFinderItem | None[source]
by_locked(locked: bool) XAFinderItem | None[source]
by_modification_date(modification_date: datetime) XAFinderItem | None[source]
by_name(name: str) XAFinderItem | None[source]
by_name_extension(name_extension: str) XAFinderItem | None[source]
by_owner(owner: str) XAFinderItem | None[source]
by_owner_privileges(owner_privileges: PrivacySetting) XAFinderItem | None[source]
by_physical_size(physical_size: int) XAFinderItem | None[source]
by_position(position: tuple[int, int]) XAFinderItem | None[source]
by_size(size: int) XAFinderItem | None[source]
by_url(url: str | XAPath) XAFinderItem | None[source]
comment() list[str][source]
container() XAFinderContainerList[source]
creation_date() list[datetime][source]
description() list[str][source]
desktop_position() list[tuple[int, int]][source]
disk() XAFinderDiskList[source]
displayed_name() list[str][source]
everyone_privileges() list[PrivacySetting][source]
extension_hidden() list[bool][source]
get_clipboard_representation() list[str | NSURL][source]

Gets a clipboard-codable representation of each item in the list.

When the clipboard content is set to a list of Finder items, each item’s name and URL are added to the clipboard.

Returns:

The name and URL of each item in the list

Return type:

list[Union[str, AppKit.NSURL]]

New in version 0.0.8.

group() list[str][source]
group_privileges() list[PrivacySetting][source]
icon() XAImageList[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.

information_window() XAFinderInformationWindowList[source]
kind() list[str][source]
label_index() list[int][source]
locked() list[bool][source]
modification_date() list[datetime][source]
name() list[str][source]
name_extension() list[str][source]
owner() list[str][source]
owner_privileges() list[PrivacySetting][source]
physical_size() list[int][source]
position() list[tuple[int, int]][source]
size() list[int][source]
url() list[XAPath][source]
class PyXA.apps.Finder.XAFinderListViewOptions(properties)[source]

Bases: XAObject

A class representing the list view options in a Finder window.

New in version 0.0.3.

Attributes:

calculates_folder_sizes

Whether folder sizes are calculated and displayed in the window.

icon_size

The size of icons in the window.

shows_icon_preview

Whether a preview of the item is shown in the window.

sort_column

The column that the list view is sorted on.

text_size

The size of text in the window.

uses_relative_dates

Whether relative dates are shown in the window.

Methods:

columns([filter])

Returns a list of columns matching the filter.

property calculates_folder_sizes: bool

Whether folder sizes are calculated and displayed in the window.

columns(filter: dict | None = None) XAFinderColumnList[source]

Returns a list of columns matching the filter.

New in version 0.0.3.

property icon_size: IconSize

The size of icons in the window.

property shows_icon_preview: bool

Whether a preview of the item is shown in the window.

property sort_column: XAFinderColumn

The column that the list view is sorted on.

property text_size: int

The size of text in the window.

property uses_relative_dates: bool

Whether relative dates are shown in the window.

class PyXA.apps.Finder.XAFinderPackage(properties)[source]

Bases: XAFinderItem

A class for managing and interacting with packages in Finder.app.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderPackageList(properties: dict, filter: dict | None = None)[source]

Bases: XAFinderItemList

A wrapper around lists of packages that employs fast enumeration techniques.

All properties of packages can be called as methods on the wrapped list, returning a list containing each package’s value for the property.

New in version 0.0.3.

class PyXA.apps.Finder.XAFinderPreferences(properties)[source]

Bases: XAFinderItem, XASBPrintable

A class for managing general preferences of Finder.app.

New in version 0.0.3.

Attributes:

all_name_extensions_showing

Whether all name extensions are shown regardless of the "extension hidden" setting.

column_view_options

The default column view options.

delay_before_springing

The delay, in seconds, before springing open folders.

desktop_shows_connected_servers

Whether connected servers appear on the desktop.

desktop_shows_external_hard_disks

Whether external hard disks appear on the desktop.

desktop_shows_hard_disks

Whether hard drives appear on the desktop.

desktop_shows_removable_media

Whether CDs, DVDs, and iPods appear on the desktop.

folders_open_in_new_tabs

Whether folders open into new tabs.

folders_open_in_new_windows

Whether folders open into new windows.

folders_spring_open

Whether folders spring open after a delay.

icon_view_options

The default icon view options.

list_view_options

The default list view options.

new_window_target

The target location for a newly opened Finder window.

new_windows_open_in_column_view

Whether new Finder windows open in column view.

window

The Finder preferences window.

property all_name_extensions_showing: bool

Whether all name extensions are shown regardless of the “extension hidden” setting.

property column_view_options: XAFinderColumnViewOptions

The default column view options.

property delay_before_springing: bool

The delay, in seconds, before springing open folders.

property desktop_shows_connected_servers: bool

Whether connected servers appear on the desktop.

property desktop_shows_external_hard_disks: bool

Whether external hard disks appear on the desktop.

property desktop_shows_hard_disks: bool

Whether hard drives appear on the desktop.

property desktop_shows_removable_media: bool

Whether CDs, DVDs, and iPods appear on the desktop.

property folders_open_in_new_tabs: bool

Whether folders open into new tabs.

property folders_open_in_new_windows: bool

Whether folders open into new windows.

property folders_spring_open: bool

Whether folders spring open after a delay.

property icon_view_options: XAFinderIconViewOptions

The default icon view options.

property list_view_options: XAFinderListViewOptions

The default list view options.

property new_window_target: XAFinderAliasFile

The target location for a newly opened Finder window.

property new_windows_open_in_column_view: bool

Whether new Finder windows open in column view.

property window: bool

The Finder preferences window.

class PyXA.apps.Finder.XAFinderPreferencesWindow(properties)[source]

Bases: XAFinderWindow

A class for managing and interacting with preference windows in Finder.app.

New in version 0.0.3.

Attributes:

current_panel

The current panel in the Finder preferences window.

property current_panel: Panel

The current panel in the Finder preferences window.

class PyXA.apps.Finder.XAFinderTrash(properties)[source]

Bases: XAFinderContainer

A class for managing and interacting with Finder’s Trash.

New in version 0.0.2.

Attributes:

warns_before_emptying

Whether to display a dialog before emptying the Trash.

property warns_before_emptying: bool

Whether to display a dialog before emptying the Trash.

class PyXA.apps.Finder.XAFinderWindow(properties)[source]

Bases: XASBWindow, XASBPrintable

A class for managing and interacting with windows of Finder.app.

Example 1:

Setting the bounds of a Finder window

>>> import PyXA
>>> app = PyXA.Application("Finder")
>>> window = app.windows()[0]
>>> lock = False
>>> (old_w, old_h) = (0,0)
>>> while True:
>>>     if window.position.y < 50 and lock is False:
>>>         # Increase height of window when user drags it to the top
>>>         (old_w, old_h) = window.bounds.size
>>>         (x, y) = window.position
>>>         window.set_property("bounds", ((x, y), (old_w, 2000)))
>>>         lock = True
>>>     if lock is True and window.position.y > 55:
>>>         # Return to original size if user moves window down
>>>         (x, y) = window.position
>>>         window.set_property("bounds", ((x, y), (old_w, old_h)))
>>>         lock = False

New in version 0.0.3.

Attributes:

collapsed

Whether the window is collapsed.

floating

Whether the window floats.

modal

Whether the window is modal.

position

The upper left position of the window.

properties

Every property of a Finder window.

titled

Whether the window has a title bar.

property collapsed: bool

Whether the window is collapsed.

property floating: bool

Whether the window floats.

property modal: bool

Whether the window is modal.

property position: XAPoint

The upper left position of the window.

property properties: dict

Every property of a Finder window.

property titled: bool

Whether the window has a title bar.

class PyXA.apps.Finder.XAFinderWindowList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XASBWindowList

A wrapper around lists of Finder windows that employs fast enumeration techniques.

All properties of Finder windows can be called as methods on the wrapped list, returning a list containing each window’s value for the property.

New in version 0.0.3.

Methods:

by_collapsed(collapsed)

by_floating(floating)

by_modal(modal)

by_position(position)

by_properties(properties)

by_titled(titled)

collapsed()

floating()

modal()

position()

properties()

titled()

by_collapsed(collapsed: bool) XAFinderWindow | None[source]
by_floating(floating: bool) XAFinderWindow | None[source]
by_modal(modal: bool) XAFinderWindow | None[source]
by_position(position: tuple[int, int]) XAFinderWindow | None[source]
by_properties(properties: dict) XAFinderWindow | None[source]
by_titled(titled: bool) XAFinderWindow | None[source]
collapsed() list[bool][source]
floating() list[bool][source]
modal() list[bool][source]
position() list[XAPoint][source]
properties() list[dict][source]
titled() list[bool][source]