Is there a way for Keyboard Maestro to open iTunes and hold Option at the same time so that it brings up the box to switch libraries?
I am using KM 6.4.7 on Mac 10.9.5.
Thanks.
Is there a way for Keyboard Maestro to open iTunes and hold Option at the same time so that it brings up the box to switch libraries?
I am using KM 6.4.7 on Mac 10.9.5.
Thanks.
@Emm -
There is good news and there is bad news about doing that.
You can find both answers immediately, by using search in the upper right corner of this screen:
Emm
Were you able to accomplish this? I have 3 iTunes libraries that I frequently go between. Ideally, Iād like to set up hotkey to open each specific library without having to go through the library menu.
Thanks.
This is a very simple macro to option-open iTunes. If it's already running the macro will quit it first:
[test] Option-Open iTunes.kmmacros (4.7 KB)
The rest (opening a specific library) is a thing of GUI scripting, since I don't think there is direct AppleScript access to that.
Thanks for this but Iām just getting iTunes opening to the current library. Itās not bringing up the library menu. Any ideas?
Have you tried it several times? Sometimes the Option key doesnāt seem to get pressed, I donāt know why. Mostly (9 out of 10) it works here, but this may depend on the actual system and hardware config.
Play around with some slight Pause actions before/after/inbetween the modifier key actions.
PS:
If it doesnāt work well enough for you, Iāve seen a nice idea on Stackoverflow, which is based on changing iTunesā library prefs on the fly.
It works fine in the Terminal and if you want we can build a macro around it.
OK, here is a macro that does the trick without GUI scripting:
Open iTunes with a Specific Library.kmmacros (8.6 KB)
ā
When you launch the macro it willā¦
Unfortunately iTunes does not store the library path as a human-readable POSIX path but as Alias data.
So, before running the macro the first time you have to gather that data. This is a one-time thing and it is simple:
1) Launch iTunes with your first (non-default) library.
2) Quit iTunes.
3) Run this command in the Terminal:
echo -n $(defaults read com.apple.itunes 'alis:1:iTunes Library Location') | pbcopy
This will copy the Alias data of the current iTunes library to the clipboard.
4) Paste the clipboard into the first green Variable value field ("iTunesLib1"). It should look similar as shown in the screenshot.
ā
Repeat the steps for your other iTunes libraries, filling up the other two variables ("iTunesLib2" and "iTunesLib3"). You don't have to do that for the library at the default location (~/Music/iTunes).
Note:
The macro does a minor sanity check for the pasted data before changing iTunesā prefs. If it finds anything that does not start with "<" and end with ">" it will set the library location to the default by removing the location entry from the prefs.
Tom,
Thanks very much.
Worked great once I overcame a few brain cramps. Also, had trouble with the macro halting on time out due to it taking a long time for the previous open iTunes to save the library, so I had to disable timeouts for the All Conditions Met actions.
Donāt know how many use multiple libraries, but thatās a good macro to post (if it isnāt already).
Tony
I have established the timeout because otherwise I (sometimes) ended up with two running instances of the macro when there were problems with quitting/starting iTunes.
In any case itās not a good idea to restart iTunes with another library while it is still busy with the currently open library. I got several iTunes crashes doing so.
So I recommend to not open iTunes with different libraries in very short order. Give it some time (10 to 20 seconds).
Please read (again) the instructions for the macro in my post above.
As said the macro has slots (room) for 3 different library locations, not counting the default library location.
You see the three green actions in the macro? These are the 3 variables (āiTunesLib1ā, āiTunesLib2ā, āiTunesLib3ā) whose task is to hold the location data for the libraries.
Just use the Terminal command from above as described to get the location data for each library, and paste that data into the value field of one of the green Variable actions.
Do not change the name of the variables! But of course you can change the displayed names in the User Prompt action (āJohnā, āJimā, āJackā), after the double underscore.
If you need more than 3 library locations (that is, more than 4 if we count the default location), then justā¦
%Variable%iTunesLib3%__John
where āJohnā is the freely choosable displayed name. The entries have to be separated by a pipe (vertical line) character ā|ā.PS:
To reply to any of my posts please click the āReplyā link at the bottom of that post. Otherwise I will not get notified via mail.
Tom,
Understand about adding additional libraries. I was just suggesting that it would be a good macro to post.
Ah, sorry, I completely misunderstood. (I interpreted your sentence as ādonāt know how to use many multiple librariesā, because otherwise I couldnāt make any sense out of it. My bad.)
Happy to hear that it works for you.
Well, the macro is effectively posted here. However, a forum admin (for example @JMichaelTX) could maybe assign the thread (or the latest posts starting with post #4) to the Macro Library category.