1

I use Make Bookmarkable to convert some audio files to the m4b bookmarkable format. However, since macOS High Sierra, there is a problem when running the script with a batch of files.

tell (add loc) raises --> error number -1700 that number -1700 can't be converted to item

The conversion does happen but then stops executing, meaning files have to be converted one by one. I'm not not familiar with AppleScript but suspect that the problem maybe because of changes in iTunes.

1 Answer 1

3

mp4, m4a, and m4b are alternative filename extensions for the MPEG-4 Part 14 container format. To "convert" an m4a file to m4b, just rename the file. That's what the script you linked to also does.

The option to remember the previous playback position in iTunes is enabled by default for files with an m4b extension but not for files with an m4a extension, but it can just as well be enabled for files with an m4a extension, so they are not any less "bookmarkable". Just check the "Remember playback position" checkbox from the "Options" tab in the information window. (I think old versions of iTunes didn't have that checkbox, which is probably why the script you linked to was originally created.)

iTunes also displays m4b files under audiobooks by default, but an m4a file can be listed as an audiobook by setting "media kind" to "Audiobook" in the "Options" tab of an information window.

Edit: the script below renames the files of the tracks selected in iTunes and changes the bookmarkable and media kind properties.

tell application "iTunes"
    repeat with t in (get selection)
        set bookmarkable of t to true
        set media kind of t to audiobook
        set l to location of t
        tell application "Finder"
            set f to file l
            set name of f to (text 1 thru -2 of (get name of f)) & "b"
        end tell
    end repeat
end tell
4
  • 1
    Thanks, but there's a bit more to it. I also use the file type to stop my music player playing my audio files. I could do this in the file system and reimport but it's exactly the sort of thing that AppleScript is supposed to be for. Commented Apr 3, 2018 at 15:30
  • 1
    @CharlieClark I edited the answer to add a script that renames the files selected in iTunes and changes the bookmarkable and media kind properties. I don't think there is any reason to delete and reimport the tracks. Maybe the script by Doug does it because in old versions of iTunes the bookmarkable property couldn't be changed through AppleScript (or even the iTunes GUI).
    – nisetama
    Commented Apr 3, 2018 at 16:13
  • 1
    Thanks, works as it should. I've kept the check for the file type around because I have a workflow of MP3 to M4A to M4B. It's quite a bit faster now that it doesn't have to delete then add. Commented Apr 3, 2018 at 17:01
  • 1
    hm, just discovered that files like this are moved to the audiobooks folder and ITunes seems to lose the file descriptor as a result. Commented Apr 3, 2018 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .