Created
October 27, 2011 00:16
-
-
Save logicaroma/1318418 to your computer and use it in GitHub Desktop.
AppleScript for allowing multiple Apple iTunes User Account on a machine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Keychain Scripting" | |
set myKeyChain to current keychain | |
set theKeyList to every generic key of myKeyChain whose description is "iTunes innlogging" | |
end tell | |
set theKeyNamesList to {} | |
repeat with x in theKeyList | |
copy name of x to the end of theKeyNamesList | |
end repeat | |
set selectedKey to text of button returned of (display dialog "Velg hvilken konto du vil logge inn med:" buttons theKeyNamesList) | |
tell application "Keychain Scripting" | |
repeat with x from 1 to (length of theKeyList) | |
set theKey to item x of theKeyList | |
if the name of theKey is selectedKey then | |
set thePassword to password of theKey | |
set theUserID to the account of theKey | |
end if | |
end repeat | |
end tell | |
tell application "System Events" | |
tell process "iTunes" | |
set frontmost to true | |
try | |
click menu item "Logg av" of menu "Butikk" of menu bar item "Butikk" of menu bar 1 | |
end try | |
click menu item "Logg p�¥â�¦" of menu "Butikk" of menu bar item "Butikk" of menu bar 1 | |
keystroke theUserID | |
keystroke tab | |
keystroke thePassword | |
keystroke return | |
delay 3 | |
keystroke return | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment