Skip to content

Latest commit

 

History

History
596 lines (499 loc) · 35 KB

CHANGELOG.md

File metadata and controls

596 lines (499 loc) · 35 KB

PyXA Changelog

[PyXA 0.3.0] - 2023-04-13

Additions

  • Added XACamera.
  • Added XAMicrophone.
  • Added XAScreen.
  • Added XADatetimeBlock type representing dates with a duration attached.
  • Added XAList.map().
  • Added XAText.extract_urls(). Returns a list of XAURL objects.
  • Added XAText.extract_dates(). Returns a list of XADatetimeBlock objects.
  • Added XAText.extract_addresses(). Returns a list of XALocation objects.
  • Added XAText.extract_phone_numbers(). Returns a list of XAText objects.
  • Script Editor:
    • Added XAScriptEditorApplication.make().
  • Shortcuts:
    • Added XAShortcutsApplication.make().
  • Bike Outliner:
    • Added XABikeApplication.RowType enum.
    • Added XABikeApplication.query().
    • Added XABikeRowList.type(). Returns a list of XABikeApplication.RowType.
    • Added XABikeRowList.by_type(). Returns a XABikeRowList.
    • Added XABikeRowList.delete().
    • Added XABikeRowList.rows().
    • Added XABikeRowList.attributes().
    • Added XABikeRow.type(). Returns a XABikeApplication.RowType.
    • Added XABikeRow.delete().
  • Added XAErrors.AppleScriptError for handling AppleScript compilation and runtime errors.
  • New Applications:
    • Added support for Arc.
    • Added greater support for various Chromium browsers.
    • Added support for OmniWeb.
    • Added support for Path Finder.

Changes

  • AppleScript:
    • AppleScript.load()
    • AppleScript.run() now accepts one argument, args, providing a list of arguments to pass to the script.
    • AppleScript.run() now raises the error returned by the script, if any.
  • Maps:
    • XAMapsApplication.sidebar_showing can now be set to True/False.
    • XAMapsApplication.search() now accepts both str and XAText as input.
    • XAMapsApplication.directions_to() now accepts both str and XAText as input.
    • XAMapsTabList and XAMapsTab now print elegantly.
    • XAMapsTabList is now a subclass of XASystemEventsUIElementList.
    • XAMapsTab is now a subclass of XASystemEventsUIElement.

Bug Fixes

  • Fixed AppleScript.load() removing excess characters from scripts, causing e.g. lists not to work.
  • Fixed error when creating new note in Notes using XANotesApplication.new_note(). (Resolve #13)
  • Fixed XAAudio.beep() failing due to too many arguments.

[PyXA 0.2.2] - 2023-03-15

Additions

  • Added XAObject.exists().
  • Added “exists” filter support.
  • Added “not exists” filter support.
    • Alternate forms: “!exists”, “nonexistent”
  • iWork Improvements:
    • Added XAKeynoteSlide.move().
    • Added XAKeynoteSlide.duplicate().
  • Music improvements:
    • Added XAMusicApplication.make().
    • Added XAMusicTrack.move().
    • Added XAMusicTrack.duplicate().
    • Added XAMusicPlaylist.move().
    • Added XAMusicPlaylist.duplicate().
    • Added XAMusicPlaylist.add_tracks().
  • TV improvements:
    • Added XATVApplication.make().
    • Added XATVTrack.move().
    • Added XATVTrack.duplicate().
    • Added XATVPlaylist.move().
    • Added XATVPlaylist.duplicate().
    • Added XATVPlaylist.add_tracks().
  • Added support for IINA+

Changes

  • Reverted use of shared base classes for media applications.
    • Removed MediaApplicationBase.
    • This should have no impact on most code, unless it references specific class types. Otherwise, the methods and attributes available for media application classes are the same.
  • XAMusicApplication.current_track is now a property instead of a method.

Bug Fixes

  • Fixed Music objects not correctly specializing to Music-specific classes. (#10)
  • Fixed TV objects not correctly specializing to TV-specific classes.
  • Fixed XANotesApplication.new_note() failing due to not getting string form of XAText object.
  • Fixed XAMusicSourceList.by_kind() and XATVSourceList.by_kind() always returning None.
  • Fixed XAMusicSourceList.filter() and XATVSourceList.filter() not transforming “kind” value into proper event format.
  • Fixed XAMusicTrackList.by_cloud_status() always returning None.
  • Fixed XAMusicTrackList.by_rating_kind() and XATVTrackList.by_rating_kind() always returning None.
  • Fixed XAMusicTrackList.by_media_kind() and XATVTrackList.by_media_kind() always returning None.
  • Fixed XAMusicTrackList.by_album_rating_kind() and XATVTrackList.by_album_rating_kind() always returning None.
  • Fixed XAMusicTrackList.filter() and XATVTrackList.filter() not transforming event values into proper event format.
  • Fixed XASystemEventsDesktop.dynamic_style, XASystemEventsDockPreferencesObject.double_click_behavior, XASystemEventsDockPreferencesObject.minimize_effect, XASystemEventsDockPreferencesObject.screen_edge yielding an error due to improper conversion from event format.

[PyXA 0.2.1] - 2023-03-04

Additions

  • Added XADiskItem.move_to(folder) and XADiskItemList.move_to(folder).
  • Improvements to Bike support:
    • Added XABikeDocumentList.edit_mode().
    • Added XABikeDocument.edit_mode.
    • Added XABikeDocument.import_rows().
    • Added XABikeDocument.export().
    • Added XABikeRowList.container_document().
    • Added XABikeRow.duplicate().
  • Improvements to Media apps (Music/TV):
    • Added XAMediaApplication.library_playlists().
    • Added XAMediaApplication.file_tracks().
    • Added XAMediaApplication.url_tracks().
    • Added XAMediaApplication.shared_tracks().
    • Added XAMediaPlaylist.play().
    • Added XAMusicAirPlayDeviceList.supports_video().
    • Added XAMusicApplication.user_playlists().
    • Added XAMusicApplication.subscription_playlists(). (#8)
    • Added XAMusicApplication.radio_tuner_playlists().
    • Added XAMusicApplication.audio_cd_playlists().
  • Improvements to Mail support:
    • Added XAMailAccountList.mailboxes().
    • Added XAMailboxList.messages().

Bug Fixes/Changes

  • Fixed missing dependencies: ApplicationServices, CoreText
  • Fixed XASBWindow object not correctly linking to the UI element subsystem of System Events. Scriptable and non-scriptable applications should now behave the same (previously only non-scriptable applications could directly access their UI elements). (#8)
  • Fixed XAFolder.aliases(), XAFolder.disk_items(), XAFolder.files(), XAFolder.file_packages(), and XAFolder.folders() always returning None.
  • Fixed XAFilePackage.aliases(), XAFilePackage.disk_items(), XAFilePackage.files(), XAFilePackage.file_packages(), and XAFilePackage.folders() always returning None.
  • Fixed XADisk.aliases(), XADisk.disk_items(), XADisk.files(), XADisk.file_packages(), and XADisk.folders() always returning None.
  • Fixed XAAlias.aliases(), XAAlias.disk_items(), XAAlias.files(), XAAlias.file_packages(), and XAAlias.folders() always returning None.
  • Fixed XAClassicDomainObject.folders() always returning None.
  • Fixed XADomain.folders() always returning None.
  • Fixed XAMusicApplication.airplay_enabled yielding an error due to invalid property name.
  • Fixed XAMusicApplication.eq_enabled yielding an error due to invalid property name.
  • Fixed XAMusicApplication.play(item) resuming playback instead of playing the specified item. (#8)
  • Fixed XAMusicAirPlayDeviceList.by_kind() always returning None.
  • Fixed XAProtocols.XAPrintable running in the main thread instead of separately.

[PyXA 0.2.0] - 2023-01-18

Additions

  • Added support for Python 3.10 (Removed ‘Self’ type annotations)
  • Added support for Database Events
  • New Notes app functionality
    • Notes.XANotesFolder.folders() - Gets the subfolders of a folder.
    • Notes.XANotesFolderList.folders() - Gets the subfolders of each folder in a list.
  • Added Additions.UI.XAHeaderMenuItem and Additions.UI.XAMenuBarMenu.new_header() for adding non-clickable section headers to menus.

Bug Fixes/Changes

  • Upgraded to PyObjC 9.x (Current version is 9.0.1). Resolves #3.
  • Getting the ID of a Notes.app object now always returns a string.
  • Fixed Terminal.XATerminalSettingsSetList.by_cursor_color(), Terminal.XATerminalSettingsSetList.by_background_color(), Terminal.XATerminalSettingsSetList.by_normal_text_color(), and Terminal.XATerminalSettingsSetList.by_bold_text_color() always returning None.

Deprecations

  • XABase.XAObject.set_properties() — Use set_property() instead. This change is being made to reduce unnecessary redundancy within the codebase.
  • XABase.XAImageList — Use XAImage method with iteration instead. This change is being made to reduce unnecessary redundancy within the codebase.

Removals

  • Removes XAObject.has_element() — Deprecated in v0.0.9. If necessary, perform this check manually instead.
  • Removed _XAObject.has_element_properties() — Deprecated in v0.0.8. All elements now have a properties dictionary, even if it is empty.
  • Removed _XAObject.set_element() — Deprecated in v0.0.9.
  • Removed ability to pass a data parameter when initializing an XAImage — Deprecated in v0.1.0. Pass data as the image_reference parameter instead.
  • Removed XASBWindow.toggle_zoom() — Deprecated in v0.1.0.2. Set the zoomed attribute instead.
  • Removed Calendar.XACalendarCalendar.week_events() — Deprecated in v0.1.2. Use events_in_range() instead.
  • Removed Finder.XAFinderApplication.recycle_items() — Deprecated in v0.1.2. Use recycle_item() instead.
  • Removed Finder.XAFinderApplication.delete_items() — Deprecated in v0.1.2. Use delete_item() instead.
  • Removed Finder.XAFinderApplication.duplicate_items() — Deprecated in v0.1.2. Use duplicate_item() instead.
  • Removed Additions.UI.XAAlertStyle and Additions.UI.XAAlert.style — Deprecated in v0.1.2. Customize the icon by setting the alert’s icon attribute instead.
  • Removed Additions.UI.XAMenuBar.add_menu() — Deprecated in v0.1.1. Use new_menu() instead.
  • Removed XAMediaWindow.collapseable and XAMediaWindow.collapsed attributes — Deprecated in v0.1.1. Use the miniaturizable and miniaturized attributes instead.
  • Removed XAiWorkImage.rotate() and XAiWorkShape.rotate() — Deprecated in v0.1.1. Set the rotation attribute instead.
  • Removed Additions.UI.XAMenuBar.add_item() — Deprecated in v0.1.1. Use Additions.UI.XAMenuBarMenu.new_item() instead.
  • Removed Additions.UI.XAMenuBar.set_item() — Deprecated in v0.1.1. Set the image attribute of menus and menu items instead.
  • Removed Additions.UI.XAMenuBar.set_item() — Deprecated in v0.1.1. Set the title attribute of menus and menu items instead.
  • Removed Additions.UI.XAMenuBar.add_separator() — Deprecated in v0.1.2. Use Additions.UI.XAMenuBarMenu.new_separator() instead.
  • Removed Additions.UI.XAMenuBarMenuItem.new_subitem() — Deprecated in v0.1.2. Use new_item() instead.
  • Removed Additions.UI.XAMenuBarMenuItem.remove_subitem() — Deprecated in v0.1.2. Use remove_item() instead.
  • Removed various XASystemEvents UI classes, now condensed to a single UI element class — this better represents the scripting dictionary for System Events. Unless scripts reference these classes directly, there will be no observable impact of this change.
  • Removed numpy dependency.

[PyXA 0.1.2] - 2022-12-14

Additions

  • Added ability to instantiate application objects by calling their title-case name (with whitespace removed) on the PyXA module, e.g. PyXA.Calendar() and PyXA.Safari()
  • Added Additions.UI.XAHUD — A class for displaying momentary messages to the user via a HUD window in the center of their screen.
  • Added SystemEvents.XASystemEventsProcessList.by_displayed_name(str)
  • Added bulk methods to XASoundList.
  • Added by_property methods to XAApplicationList.
  • Added XABase.XAURLList.
  • Added XAList.index(element), which functions the same as the index method of standard list objects.
  • Added ability to quit menu bar apps from the terminal with control+C

Bug Fixes/Changes

  • XAMenuBar now automatically hides the dock icon of the application.
  • XANotesAttachment.url now return an XAURL instance.
  • Fixed bulk getter methods on XAList objects sometimes attempting to operate on empty lists and causing a TypeError. Bulk getter methods should now always return a list, even if empty.
  • Fixed XAFinderContainerList.entire_contents not returning anything. Now returns an instance of XAFinderItemList.
  • Fixed XAFinderListViewOptions.colums() returning instance of XAFinderColumn instead of XAFinderColumnList.
  • Fixed XAFinderContainerList.container_window() failing to return a list of windows due to inaccessible object property.
  • XANoteList.by_creation_date(), XANoteList.by_modification_date(), XANotesAttachmentList.by_creation_date(), and XANotesAttachmentList.by_modification_date() always returning None.
  • Fixed XANoteList.by_container() failing due to AttributeError.
  • Fixed XANotesAccountList.by_default_folder() failing due to AttributeError.
  • Fixed XANotesFolderList.by_container() failing due to AttributeError.
  • Fixed XANotesAttachmentList.by_container() failing due to AttributeError.
  • Fixed Reminders.XARemindersReminderList.container returning creation dates instead of containers (Now returns list of Reminders lists).
  • Fixed setting XAVLCDocument.path not working due to infinite recursion.
  • Fixed XARemindersApplication.new_list() failing due to trying to access ID property of proxy element.
  • Fixed XARemindersApplication.new_reminder() failing due to trying to set an unknown property key.
  • Fixed XARemindersAccountList.by_properties(), XARemindersListList.by_properties(), and XARemindersReminderList.by_properties() failing due to accessing unknown property key.
  • Fixed XARemindersListList.by_container() and XARemindersReminderList.by_container() always returning None.
  • Fixed XACalendarCalendarList.properties() returning a list of None elements.
  • Fixed XACalendarCalendarList.by_properties() failing due to AttributeError.
  • Fixed XACalendarCalendarList.description() returning a list of None elements.
  • Fixed XACalendarCalendarList.by_description() failing due to slight differences in memory locations.
  • Fixed XACalendarEventList.properties() returning a list of None elements.
  • Fixed XACalendarEventList.by_properties() failing due to AttributeError.
  • Fixed XACalendarEventList.by_description() always returning None.
  • Fixed XACalendarEvent.properties always returning None.
  • Fixed XACalendarEventList.duplicate(), XACalendarEventList.duplicate_to(), and XACalendarEventList.move_to() not saving events.
  • Fixed XACalendarAttachmentList.uuid() having a typo in its declaration.

Deprecations

  • Importing various classes from the core PyXA module is now deprecated in favor of submodule imports
    • These classes are still available via PyXA.[class_name] for now, but importing them from their respective submodule will be necessary in the future. This is to minimize memory usage and load time when importing PyXA.
  • XAFinderApplication.delete_items() — Use delete_item() instead.
  • XAFinderApplication.duplicate_items() — Use duplicate_item() instead.
  • XAFinderApplication.recycle_items() — Use recycle_item() instead.
  • XACalendarCalendar.week_events() — Use events_in_range() instead.

Removals

  • Removed logging using the Python logging module as it was causing issues with PyXA scripts bundled as Mac apps via py2app. NSLog is (minimally) used instead.
  • XACalendarCalendarList.calendar_identifier(), XACalendarCalendarList.by_calendar_identifier(), and XACalendarCalendar.calendar_identifier; these methods/attributes have never worked correctly and cannot currently be fixed.

[PyXA 0.1.1] - 2022-11-23

Additions

  • Added various property setters that were missing previously.
  • Added setter for the ‘properties’ property of many objects.
    • Setting this will update multiple properties at once.
    • Updates only the properties specified in the provided dictionary.
  • Added XAApplication.launch()
  • Added bulk attribute methods to XABaseScriptable.XASBWindowList
  • Added XABaseScriptable.XASBWindowList.uncollapse()
  • Added XAList.extend(ls); functions the same as Python’s list.extend() method.
  • Added XAImage.symbol(name) for initializing images of system symbols (any symbol in the SF Symbols collection).
  • Added XAColor.hex_value for getting the HEX representation of a color.
  • Added XACalendarEventList.end_date().

Changes

  • Reworked XAMenuBar structure and functionality; now follows OOP more closely.
    • Added XAMenuBarMenu, XAMenuBarMenuItem classes
    • Added XAMenuBar.new_menu, XAMenuBarMenu.new_item, XAMenuBarMenuItem.new_subitem, XAMenuBar.remove_menu, XAMenuBarMenu.remove_item, XAMenuBarMenuItem.remove_subitem methods
    • Kept previous functionality for the time being, but will remove it in the near future.
  • Reduced XAObject instantiation time by moving property documentation into the property’s associated method(s), thus avoiding slow downs caused by on-init requests for property values. This provides a slight performance boost to many classes.
  • Improved performance of XALists by reducing calls to PyObjC’s nsarray__len__() method.
  • Improved performance of the Calendar and Reminders modules by utilizing lazy loading for translating between ScriptingBridge and EventKit objects.
  • Improved performance of calling PyXA.running_applications().windows() about 25% by better utilizing list comprehension.
  • XAApplication.activate() now launches the application if it is not already running, then activates it.
  • Fixed XABaseScriptable.XASBWindowList.collapse() not reliably collapsing every window in the list (fixed by adding success check and delay).
  • Fixed XAScriptEditorApplication.classes() not working due to misspelling.
  • Fixed XASystemEventsApplication.key_code() and XASystemEventsApplication.key_stroke() not working; now uses CGEventCreateKeyboardEvent.
  • Fixed setting XAFinderApplication.selection to an XAFinderItemList object doing nothing.
  • Adjusted the str and repr format of various classes, generally with the aim to balance execution time and utility.
    • Beyond a certain length, for example, many XALists will simply report their length instead of attempting to get information about each element
  • Restructured XABase.py and PyXA.additions, moving some classes into addition modules. This is primarily to reduce the complexity of XABase.py, which is currently a headache to work with. There should be no impact on end-user scripts. The new structure (as of now) is as follows:
    • PyXA.additions
      • XALearn.py
        • XALSM
      • XASpeech.py
        • XASpeech
        • XASpeechRecognizer
        • XACommandDetector
      • XAUtils.py
        • SDEFParser
        • XAMenuBar
      • XAWeb.py
        • RSSFeed

Deprecations

  • PyXA.PyXA.py
    • All classes and methods have been integrated into XABase.py. Use those instead.
  • XABase.XAMenuBar.add_menu() — Use the new_menu() method instead.
  • XABase.XAMenuBar.addItem() — Use the new_item() method of the XAMenuBarMenu class instead.
  • XABase.XAMenuBar.set_image() — Set the image attribute of XAMenuBarMenu and XAMenuBarMenuItem objects directly instead.
  • XABase.XAMenuBar.set_text() — Set the title attribute XAMenuBarMenu and XAMenuBarMenuItem objects directly instead.
  • QuickTimePlayer.XAQuickTimeWindow.set_property — Set the desired attribute directly instead.
  • MediaApplication.XAMediaWindow.collapseable — Use MediaApplication.XAMediaWindow.miniaturizable instead.
  • MediaApplication.XAMediaWindow.collapsed — Use MediaApplication.XAMediaWindow.miniaturized instead.
  • Finder.XAFinderApplication.directory(path) — Use the XAFinderApplication.folders() method with a filter instead.

Images An image of a menu bar app for copying colors in various representations created with the new XAMenuBar structure.


[PyXA 0.1.0] - 2022-10-30

Note: This version of PyXA requires Python 3.11.

Additions

  • XALSM — A class for convenient text classification using latent semantic mapping
    • Added save() method for saving LSM models to the disk.
    • Added load() method for loading LSM models from the disk.
    • Added add_category() method for easily adding new categories to the mapping.
    • Added add_data() method for adding categories and training data.
    • Added add_text() method for adding training data.
    • Added categorize_query() method for mapping a string to a category using the built model.
  • XABase.XAApplicationPicker — A class for having users selected an application from a menu
    • Works similarly to XAFolderPicker and XAFilePicker.
  • XABase.XATextDocumentList — General class for text documents that provides several bulk functions
    • Has the same methods and attributes as the DocumentList class previously found in the TextEdit module
  • XABase.XAVideo — Initial support for working with videos in PyXA
    • Added reverse() method for reversing videos (this takes some time)
    • Added save() method for saving modified videos to the disk
    • Added show_in_quicktime() method for opening videos in QuickTime
  • New features for XABase.XAImage and XABase.XAImageList:
    • Added additional non-mutable information attributes has_alpha_channel, is_opaque, and color_space_name.
    • Added ability to control image properties using mutable attributes for gamma, vibrance, tint, temperature, white_point, highlight, and shadow.
    • Added an open() method to open one or more images from files or URLs.
    • Added a save() method to save images to the disk.
    • Added several filter methods for easy image adjustments, e.g. gaussian_blur(), pixellate(), invert(), and bloom(), among others.
    • Added auto_enhance() method to automatically apply suggested image enhancements, e.g. correct red-eye.
    • Added several distortion methods such as bump(), pinch(), and twirl().
    • Added several transformation methods such as flip_horizontally(), rotate(), crop(), scale(), and pad().
    • Added composition methods such as overlay_image(), overlay_text(), stitch_horizontally(), and additive_composition().
    • Added extract_text() and image_from_text() to read text from images and turn text into images, respectively.
    • All of these methods are implemented in both XAImage and XAImageList, with the latter offering some performance benefits
  • New features for XABase.XAColor:
    • Added several class methods, such as white(), black(), and orange(), for instantiating common XAColor objects.
    • Added make_swatch() method for making a solid color image of a specified size
    • Added clipboard-codability
  • New features for XABase.XAList:
    • Added additional filtering methods such as equalling(), not_equalling(), not_containing(), beginning_with(), ending_with(), greater_than(), less_than(), and between()
    • Added count() method for counting elements of XALists that pass a key function
    • Added support for checking membership in XALists using the “in” keyword
  • New methods for XABase.XASound:
    • Added trim() method for adjusting the length of sounds via PyXA
    • Added save() method for saving modified sounds to the disk
    • Added information attributes such as num_sample_frames, sample_rate, and duration
  • New features fro XABase.XAText:
    • Added working sentences() method to get a list of sentences in a text document.
    • Added methods for tagging tokens by sentiment, lemma, language, and part of speech
  • PyXA Additions — Modules that utilize other packages alongside PyXA and PyObjC features to provide useful automation features.
    • Additions.XAWeb — A module for internet-related PyXA additions.
      • RSS Features
        • Additions.XAWeb.RSSReader — A class for fetching items from RSS feeds
        • Additions.XAWeb.RSSItem, Additions.XAWeb.RSSItemList — Classes for interacting with fetched RSS items, e.g. to view metadata, access the contained content, or extract URLs from link tags
        • Additions.XAWeb.RSSItemContent, Additions.XAWeb.RSSItemContentList — Classes for interacting with the content of RSS items, e.g to retrieve all images and links within in their full-featured PyXA representation
  • Pythonic properties and setters for every class
  • Added local debug logging
  • Support for New Applications
    • Adobe Acrobat Reader
    • Amphetamine
    • Bike
    • CardHop
    • Flow
    • Image Events
    • iTerm
    • RStudio
    • Spotify
    • System Events

Changes

  • XABase.XAList
    • Now correctly responds to negative indexing.
    • Filtering now works with (more) non-string values.
    • Push() now correctly returns either the added element(s) or None — before, it would return a location reference that could end up incorrectly pointing to another element.
  • XABase.XAURL / XABase.XAPath
    • Now tries to prepend necessary schemes if no valid is present when the object is initialized.
  • XABase.XAColor
    • red(), green(), and blue() methods now create instances of pure red, pure green, and pure blue colors, respectively. The red_value, green_value, and blue_value attributes now take on the previous functionality of these methods. Other value-getting methods have been transitioned to attributes as well.
  • In general, modules have been tweaked to support more data types when calling methods, where appropriate.
  • Many behind-the-scenes changes have been made to support faster execution.
  • Documentation throughout several modules has been significantly improved, especially for the iWork suite.

Deprecations

  • PyXA.application() — Use the PyXA.Application class instead.
  • XABase.XATextDocument.set_text() — Directly set the XABase.XATextDocument.text attribute instead
  • Providing NSData as the data parameter when initializing an XABase.XAList object — Pass the NSData as the image_reference parameter instead.
  • XAiWorkItem.rotate(), in all forms — Set the rotate attribute instead.

Removals

  • XABase.XAImage.name — Removed due to lack of use case
  • TextEdit.XATextEditDocument.copy() — Deprecated in 0.0.8, now fully removed

Direction for Next Release

  • Performance improvements
  • Code reorganization
  • Full macOS Ventura Support
  • Integrate Finder classes with System Events classes

[PyXA 0.0.9] - 2022-08-25

Additions

  • XASpotlight class — ability to search for files on the disk using Spotlight
    • Returns a list of XAURL objects
    • Supports searching by string, date, date range, and combinations of those
    • Supports searching by custom predicate
    • XASpotlight.run() — Runs the search
    • XASpotlight.show_in_finder() — Shows the search in Finder (but might not display the exact same results)
  • XANotification — ability to display notifications, currently supported by osascript
    • XANotification.display() — Displays the notification
  • XACommandDetector — ability to listen for specific spoken commands and react accordingly
    • XACommandDetector.on_detect() — Adds or replaces a command to listen for and associates it with a specified function
    • XACommandDetector.listen() — Begins listening for all specified commands
  • XASpeechRecognizer — ability to listen for spoken queries matching some condition and react accordingly
    • XASpeechRecognizer.on_detect() — Adds a rule that executes some method when a query meets the conditions of the rule
    • XASpeechRecognizer.listen() — Begins listening for a query, continues until a rule returns True
  • XASpeech — ability to speak text with customizable voices, volume, and speaking rate
    • XASpeech.speak() — Speaks the specified text or outputs the spoken audio to an AIFF file
    • XASpeech.voice() — Lists available voice names
  • XAMenuBar — ability to create menus on the system menu/status bar + ability to add items to those menus that execute specified functions when clicked
    • Supports images
    • Supports runtime changes to menu display parameters (text, image)
    • Automatically adds “Quit” item to menus
    • XAMenuBar.add_menu() — Adds a new menu
    • XAMenuBar.add_item() — Adds a new item to a menu
    • XAMenuBar.set_image() — Sets the image displayed for a menu or menu item
    • XAMenuBar.set_text() — Sets the text displayed for a menu or menu item
    • XAMenuBar.display() — Displays the menu bar, keeping it displayed until the program is quit
    • Examples:
      • JWSTMenuBar
      • CPUMonitor
  • New methods for AppleScript class
    • AppleScript.insert() — Inserts a string, list of strings, or script object as a line entry in the current script
    • AppleScript.pop() — Removes and returns the line at the specified index of the script
    • AppleScript.load() — Loads an AppleScript .scpt file as a runnable AppleScript object
    • AppleScript.save() — Saves the current script to the specified file path
    • AppleScript.extract_result_data() — Attempts to extract string data from an execution result dictionary
  • New features for XALocation class
    • XALocation.current_location property — Holds the user’s current location object
  • PyXA.scriptable_applications variable — Holds a list of the currently supported applications
  • Setters for properties on many classes
  • Support for new applications
    • Fantastical
    • OmniOutliner
    • Script Editor
  • Documentation for many more classes and methods

Changes

  • All new classes going forward will utilize @property and @x.setter decorators; existing classes will be updated over the course of the next few updates.
  • Several methods have been converted to attributes of the parent class
    • XATerminalApplication.current_tab()
    • XATerminalWindow.selected_tab()
    • XATerminalTab.current_settings()
  • XAColor can now be instantiated using PyXA.XAColor()
  • Various small bug fixes

Deprecations

  • XAObject.has_element() — Perform this check manually instead.
  • XAObject.set_element() — Set the element attribute directly instead.

Removals

  • PyXA.open_url() — Deprecated in v0.0.5, now completely replaced by XAURL class
  • PyXA.get_clipboard(), PyXA.get_clipboard_strings(), PyXA.set_clipboard() — Deprecated in v0.0.5, now completely replaced by XAClipboard class
  • PyXA.run_application() — Deprecated in v0.0.5, now completely replaced by AppleScript class

[PyXA 0.0.8] - 2022-08-18

Additions

  • XAProtocols.py — Contains definitions for high-level classes that can be subclassed to indicate availability of functionality to other aspects of PyXA. For example, XAClipboard utilizes the get_clipboard_representation() method of classes subclassed from XAClipboardCodable.
    • Current protocols:
      • XAShowable
      • XASelectable
      • XADeletable
      • XAPrintable
      • XACloseable
      • XAClipboardCodable
      • XACanOpenPath
      • XACanPrintPath
  • Expanded functionality for XABase.XAClipboard via XAProtocols.XAClipboardCodable protocol - All Python literals can be set as the content of the clipboard - Many PyXA objects can be set as the content of the clipboard
  • New properties and methods for XABase.XAURL
    • base_url — The base/host portion of the URL, e.g. www.google.com
    • parameters — The parameter portion of the URL, e.g. ?query=“Hi”
    • scheme — The scheme portion of the URL, e.g. http:///
    • fragment — The fragment portion of the URL, e.g. #example
    • html — The HTML code for the webpage at the URL
    • title — The title of the webpage at the URL
    • extract_text() -> List[str] — Gets the visible text of the webpage at the URL
    • extract_images() -> List[XAImage] — Gets all images on the webpage at the URL
  • XABase.XAImage.show_in_preview() — Shows the TIFF representation of the image in Preview
  • User input classes — Currently use NSAppleScript to create the views that users are accustomed to. Might use custom-created windows and views in the future.
    • XABase.XADialog
    • XABase.XAMenu
    • XABase.XAFilePicker
    • XABase.XAFolderPicker
    • XABase.XAFileNameDialog
  • Support for several new applications
    • Numbers
    • Alfred
    • Drafts
    • Hammerspoon
    • VLC

Changes

  • Several methods that actually represent properties have been corrected to be object properties.
    • XAApplication.front_window, XAScriptableApplication.front_window
    • XAMusicApplication.current_track
    • XASafariApplication.current_document
  • Added SaveOption and PrintErrorHandling enums to XABaseScriptable.XASBApplication

Deprecations

  • Using property dictionaries to filter XALists is now deprecated functionality. Use the XABase.XAList.filter() method instead.
  • XABase.XAList.containing() — Use the XABase.XAList.filter() method instead.
  • XABase.XAObject.has_element_properties() — all elements now have a properties dictionary, even if it is empty.
  • XABase.XAClipboard.set_contents() — Directly set the XABase.XAClipboard.contents property instead.
  • TextEdit.XATextEditDocument.copy() - Use the XABase.XAClipboard class instead.

Removals

  • XABase.XAHasElements, XABaseScriptable.XAHasScriptableElements, and all associated methods — Functionalities completely replaced by XAList. No impact to existing scripts.
  • XABase.XAAcceptsPushedElements — Functionality replaced by XAList. No impact to existing scripts.
  • XABase.XACanConstructElement — Functionality replaced by per-application make() methods. No impact to existing scripts.
  • XABase.XAShowable, XABase.XACanOpenPath, XABase.XASelectable, XABase.XADeletable, XABase.CanPrintPath, XABase.XACloseable — Moved to XAProtocols. No impact to existing scripts.
  • XABase.xa_url() — Deprecated in v0.0.5. Now completely replaced by XAURL.
  • XABase.xa_path() — Deprecated in v0.0.5. Now completely replaced by XAPath.

Full Changelog: https://github.com/SKaplanOfficial/PyXA/compare/v0.0.7...v0.0.8


[PyXA 0.0.7] - 2022-08-12

This pre-release version expands fast enumeration over list objects to the Music, TV, Contacts, and Terminal apps, improves documentation throughout the project, and adds an introductory tutorial.

Full Changelog: https://github.com/SKaplanOfficial/PyXA/compare/v0.0.6...v0.0.7


[PyXA 0.0.6] - 2022-08-02

This pre-release version includes performance improvements, support for several new applications (Maps, Font Book, Pages, Stocks, QuickTime Player), expanded support for UI scripting, and updates throughout other areas to improve PyXA's overall utility and stability.

Full Changelog: https://github.com/SKaplanOfficial/PyXA/compare/v0.0.5...v0.0.6


[PyXA 0.0.5] - 2022-07-14

This is the first pre-release version of PyXA available on PyPi.org and installable via pip install mac-pyxa.

Features:

  • Support for Automator, Calculator, Calendar, Console, Contacts, Dictionary, Finder, Keynote, Mail, Messages, Music, Notes, Photos, Preview, Reminders, Safari, Shortcuts, System Preferences, Terminal, TextEdit, and TV applications
  • Support for native alert dialogs and color pickers via XAAlert and XAColorPicker, respectively
  • Additional classes for interacting with the system clipboard (XAClipboard), URLs (XAURL), paths (XAPath), images (XAImage), colors (XAColor), locations (XALocation)
  • Fast enumeration over lists of scriptable objects via the XAList class
  • Support for executing AppleScript script strings via the AppleScript class