Archive for the ‘Cocoa-AppleScript’ Category
Week or so ago this site got some hits from a post at Reddit which served to remind me that “Uh, this site’s been around for thirteen years.” One of the comments reported that “I used a file renamer script that renames files based on the tracks metadata. It changed all my .m4a tracks to .mp3 and broke a lot of my library even though I told it to not replace file extensions.” Sorry about that.
The original version of File Renamer (which was written by a fellow named Tino Heth) was posted in January 2002 and it hasn’t been updated since. Back then, there were only MP3s, so the script didn’t have to account for M4A. Unfortunately, it didn’t account for any other extensions either. So I thought if people are still talking about it after all these years I’d better update it.
You can download it here.
I’ve been using a variation of this search script for a while so I thought I’d update it with some customization settings nailed on and post it (there’s a simple snippet version of it here). The thing is: I often want my iTunes search results to go directly to a playlist so I can get right to work on them there, usually tag editing. Without some automation this is typically a multi-stage grind comprised of searching, selecting track results, making new playlist, naming new playlist, locating and selecting the tracks again when new playlist gets focus (stab!), putting tracks into playlist by any one of various means, and then forgetting why I was searching for these tracks in the first place. (Related memory-loss issue: Name New Playlist From Selection.)
Search Results to Playlist puts a floating window over iTunes that provides the ability to search iTunes and copy the track results to a designated Results Playlist.
It can search the entire library, the selected playlist, or any of the categories (Music, Movies, Books, etc) for text in All, Name, Artist, Album, or Composer tags and then copy the results to a playlist. The script will create this Results Playlist if necessary. If the playlist already exists then the track results can replace its current contents or may be appended to it.
Dual-Pass Search conducts a two-pass search for tracks in the currently selected playlist. On the first pass, the search query behaves like iTunes’ own searchbox. Then the track results from the first pass are processed with a second search query.
The track results can be displayed in a Results Window and optionally sent to Results Playlist in iTunes.
Playlist Manager v1.1 can perform common useful tasks on a multiple selection of playlists: rename (add text, remove text, search and replace text), toggle repeat and shuffle, duplicate, delete, export, merge.
This latest version fixes a problem with renaming playlists that are contained in Playlist Folders and now allows “blank” to be used as the replace text in the Search and Replace tool.
I create, reuse, and recycle playlists frequently and my playlists rarely remain static. A hindrance in my playlist management is the inability to select more than one playlist at a time to, say, delete or rename them. Well, I got around to fixing that with Playlist Manager.
This applet can perform common useful tasks on a multiple selection of playlists: rename (add text, remove text, search and replace text), toggle repeat and shuffle, duplicate, delete, export, merge.
Remove n Characters From Front or Back lets you delete a specified number of characters from either the beginning or the ending of the Song Name, Album, Artist, Comments, Composer or Show tag (or their “Sort” siblings) of each selected track. For example, delete the initial digits and the space from “01 First Track”, “02 Second Track”, and so on.
This updated version caps the maximum number of characters to the length of the shortest text in the selected tags, preventing inadvertent deletion of tag text that may be shorter than the user-set number of characters to remove.
As you may know, OS X 10.8 introduces a new security feature called Gatekeeper which can conditionally disallow software downloaded from the internet from being launched on your machine. You can access the Gatekeeper settings in the Security pane of System Preferences.
Gatekeeper offers three “trusted source” security settings for launching downloaded apps:
- Only launch apps from the Mac App Store
- Only launch apps from the Mac App Store or digitally signed with an authorized Apple Developer ID
- Launch anything downloaded from anywhere
The default Gatekeeper setting is Number 2. My guess is that the sort of people who visit this site will have lowered that to Number 3, “Allow from Anywhere”.
Gatekeeper doesn’t take notice of most of the types of AppleScripts available from this site so downloading and launching scripts from here shouldn’t trigger Gatekeeper no matter what the security setting. Cocoa-AppleScripts, which constitute the majority of recent applets and droplets, have been/will be codesigned with an Apple Developer ID.
However, it is still remotely possible that a handful of older scripts from this site may be quarantined by Gatekeeper and won’t be permitted to launch after you download them to OS X 10.8. (This does not affect scripts that you have already downloaded and have launched at least once.)
What to do: Control-Click/Right-Click on the script in the Finder and choose “Open” which will present an option to override any Gatekeeper settings. Alternatively, you could lower your Gatekeeper security setting temporarily while you launch the script and then restore the setting afterwards.
Once you’ve successfully launched the script the first time, by whatever means, it will be ignored by Gatekeeper thereafter.
Update: additional new information posted here.
It hadn’t ever occurred to me that the term “convert”, as it applies to converting an audio file from one type to another and which is the AppleScript command for doing so, could be construed to mean “replace”. Though that’s probably why Apple has unambiguously named the menu item in the iTunes Advanced menu used to “convert” a track selection as “Create MP3 Version” (or whatever the current import setting is). It’s pretty obvious you get an additional new track and not a transformed replacement.
“Convert” in its “replace” sense, however, is what a number of Correspondents have wanted to do: downsize some ALAC tracks to AAC or MP3, for example, and have the converted versions replace the occurrences of the originals in any playlists.
Convert and Replace will convert a batch of selected tracks—or the tracks in a selected playlist—using an encoder chosen on-the-fly (the encoder’s current Preferences-set options will be applied) and replace the originals throughout your entire library with the converted versions. Additionally, you can opt to Trash/delete or keep the original files and tracks. (If the tracks are kept they remain in the “Music” library but will have been replaced in all other playlists.)
Possible deal-breaker: newly converted tracks will have a Date Added of “now”. There is no getting around this since Date Added is a read-only property assigned by iTunes when a new track is added to its library.
For OS X 10.6 or better.
There are some scripts here that export files to chosen locations. And of course, you can drag-and-drop selected tracks from iTunes to copy their associated files. But Correspondent Chris Updegrove inquired about a workflow to get MP3 files into a playlist-named folder on a flash drive for use in his car audio system. (I think that some MP3-CD players worked this way, too. I think I remember MP3-CDs.)
Export Files to Folder will export the files of the tracks in a selected playlist—or just the selected tracks in a playlist—to a new folder in a user-selected location; the folder will be created using the name of the selected playlist. Here I’ve used it to dump a bunch of playlists to a mounted flash drive:
Optionally, an activity log can be created on the Desktop that will list what was copied (or not copied and error messages).
It’s a Cocoa-AppleScript applet so it can only run on OS X 10.6 or better.
Thanks to a couple of recent posts at Mac OS X Hints and Cult of Mac, Change Hidden iTunes Preferences saw a lot of downloads in the past week or two. Unfortunately, I hadn’t had time until today to give it an update. An older preference, “Show buttons horizontally”, is no longer applicable and a new preference, “Disable ‘elastic’ scrolling behavior”, applicable in Lion, needed to be added. These changes are in the latest version of Change Hidden iTunes Preferences.
Additionally, this version is written as a Cocoa-AppleScript applet and can only be run on OS X 10.6 or better.