Code Monkey home page Code Monkey logo

applescript-music's Introduction

AppleScript Scripts for macOS Music

Though moribund for many years, AppleScript remains the sole (more or less) reliable tool to control macOS and many of its apps such as Music. It’s unclear what will replace it. Automator, too, is on its way out; Shortcuts cannot compare since it is considerably less powerful. So it’s in AppleScript we trust.

Scripts

  • Add Characters to Start of Track Title
    Use this to add (say) “BWV 988 – ” to the start of all of an album’s tracks in case you don’t like it if they only say “Aria”, etc. (Suggested shortcut: ⌥⌘S.)

  • Crop Characters
    Delete one or many characters from either the beginning or the end of any tag. (Suggested shortcut: ⌥⌘C.)

  • Search-and-Replace Tag Text
    Search any string anywhere, and replace it with something else. (Suggested shortcut: ⌥⌘R.)

  • Albumize Selection
    An example use case: when I added Quatuor Ébène’s recording of the SQs by Debussy, Ravel, and Fauré to my Music library, I made an ‘album’ out of each of the three works. (Suggested shortcut: ⌥⌘A.)

  • Add PDF to Album
    Select a track from the album to which you’d like to add the PDF file as track, and then run the script twice in immediate succession – I’m afraid I’m unable to make it work in one run. (Suggested shortcut: ⌥⌘P.)

  • Fade In
    For when you are paused midway. (Suggested shortcut: ⌥⌘,.)

  • Fade Out and Pause
    A simple stop sometimes feels too savage. (Suggested shortcut: ⌥⌘..)

  • Fade Out and Stop
    A variation on the above. (Suggested shortcut: ⌥⇧⌘..)

  • Fade Out and Play Next
    Another variation. (Suggested shortcut: ⌥⇧..)

  • Toggle Checkmarks of Selection
    Allows you to keep certain tracks in your library, while not having to listen to them when (say) you’re selecting an album. (Suggested shortcut: ⌥⌘X.)

  • Open Scripts Folder
    This opens the folder at ~/Library/Music/Scripts. (Suggested shortcut: ⌥⇧⌘S.)

Format

The scripts are uncompiled, whence the extension applescript. This prevents occasional errors when saving and allows one to use version control. It also makes it easy to quicklook a file. (Peek colours them nicely.)

The script files are encoded in UTF-16. To force the Unicode conversion in Script Editor, I used a Greek colon (·) in each script’s initial line. If you remove the character in Script Editor and then resave the file, it will be automatically re-encoded in MacRoman. Script Editor can work with either encoding; but whenever all characters are within the ASCII set, Script Editor will use the MacRoman encoding. GitHub, on the other hand, automatically converts MacRoman to UTF-8. For simplicity’s sake, and to prevent conversion errors, I use UTF-16.

Installation

  1. Download the zip file on the right under Releases, and unzip it.
  2. Create a folder called Scripts within the Music folder of your user library – either manually or by running the following command in your terminal: mkdir -p $HOME/Library/Music/Scripts/. (Nothing will happen to the folder if it already exists.)
  3. Move the scripts you’d like to use from where you downloaded them to your Scripts folder. (The user library is generally hidden: if you type ⇧⌘., you can see all hidden files and folders, including your user library; type the same keystrokes again, and they’re again hidden.)
  4. Reopen macOS Music. You’ll now see a new menu with a scroll icon to the left of the Help menu. AppleScript scripts appear here: one can select them, assign them to shortcuts, and so forth, just as if they were ordinary menu items.

applescript-music's People

Contributors

schmidhauser avatar

Stargazers

Robert J. avatar  avatar Geoff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.