Controlling Operation
Can't Believe I'm Posting About GUI Scripting
It is a fact universally acknowledged—in my house—that GUI Scripting stinks. But the flip side of that is that sometimes it can be the only way to automate something with AppleScript. Especially so if the developers of the app you are 'scripting have long been ignoring your suggestions. Again, my house.
GUI Scripting is a way to write AppleScript that works by simulating mouse clicks, selections, key presses and other "touches" of the GUI elements of an app in order to get the app to do what those clicks and presses do. For instance, you can simulate a mouseclick on a menu item in a menu and whatever happens when you usually click that menu item will happen. GUI Scripting is clunky to work with for a number of reasons, but the two most discouraging are that it's tough to know what and how and where to click and press for the Thing you want to do; and that if the developer changes an app's layout in the future the scripts could break because something isn't where it was before.
Despite all that, I've been playing with GUI Scripting lately. It's what I use to change playlist views in Playlist Manager and how Needle Drop clicks the "Clear" button in the Playing Next panel. If you've used those scripts, you've had to give permission in "Accessibility" to allow those scripts to use the "System Events" app. System Events is what enables AppleScript to target GUI elements.
Here's a little scripting project that uses some GUI Scripting to do three things that I like to do somewhat regularly in the Music app: open the selected playlist in its own window; change the playlist View to "as Songs"; reposition the playlist window to a standard place, rather than BANG right over the main browser window. (Note that I could only get it to work on the latest version of Big Sur with the latest version of Music, which bears out my thoughts above about clunkiness.)
UPDATED: Play Random Album v4.1
For macOS 10.15 and later only. This script scans your library, creates a playlist of a complete single album chosen at random and begins playback of the playlist created. Works great when assigned a keyboard shortcut
Latest version:
- Accommodations for macOS 11 Big Sur
- Performance, UI and security enhancements
More information for Play Random Album v4.1 and download link is here.
UPDATED: Side Splitter v2.1
For macOS 10.15 and later only. This script will copy a selection of tracks (presumably the tracks of a single particular album) into separate user-designated "album side" playlists and place these playlists in a distinct Playlist Folder. The script will then play each playlist "side" one at a time, pausing after each one until you accede to play the next "side" (as might occur with an actual LP record).
You can get the track order for an album if you Search Discogs or Search Wikipedia.
Written as a sort of joke to illustrate the awkwardness of recreating an analog music listening experience digitally.

Latest version:
- Accommodations for macOS 11 Big Sur
- Performance, UI and security enhancements
More information for Side Splitter v2.1 and download link is here.
UPDATED: Skip Back or Ahead v3.2
For macOS 10.15 and later only. Floating panel allows you to control rewinding or skipping forward in the currently playing track by a user-entered number of seconds (1-120). Optionally, play/pause the current track. Useful for 'scoping through tracks, making transcriptions, and so on.

Latest version:
- Additional accommodations for macOS 11 Big Sur
More information for Skip Back or Ahead v3.2 and download link is here.
UPDATED: Skip Back or Ahead v3.1
For macOS 10.15 and later only. Floating panel allows you to control rewinding or skipping forward in the currently playing track by a user-entered number of seconds (1-120). Optionally, play/pause the current track. Useful for 'scoping through tracks, making transcriptions, and so on.

Latest version:
- Accommodations for macOS 11 Big Sur
- Performance, UI and security enhancements
More information for Skip Back or Ahead v3.1 and download link is here.
UPDATED: Skip Back or Ahead v3.0
Floating panel allows you to control rewinding or skipping forward in the currently playing track by a user-entered number of seconds (1-120). Optionally, play/pause the current track. Useful for 'scoping through tracks, making transcriptions, and so on.

Latest version:
- Accommodations for macOS 10.15 Catalina
- UI tidying
- Performance and security enhancements
More information for Skip Back or Ahead v3.0 and download link is here.
UPDATED: Side Splitter v2.0
For macOS 10.15 Catalina and later only. This script will copy a selection of tracks (presumably the tracks of a single particular album) into separate user-designated "album side" playlists and place these playlists in a distinct Playlist Folder. The script will then play each playlist "side" one at a time, pausing after each one until you accede to play the next "side" (as might occur with an actual LP record).
You can get the track order for an album if you Search Discogs or Search Wikipedia.
Written as a sort of joke to illustrate the awkwardness of recreating an analog music listening experience digitally.

Latest version:
- Accommodations for macOS 10.15 Catalina
- Adds option to "insert" 4 seconds of delay between tracks
- Performance and security enhancements
More information for Side Splitter v2.0 and download link is here.
