iTunes11でiOSアプリを最新の状態にしておく
iTunesはどんどんアップデートしていく。現在のiTunesは、11.0.3である。以前のスクリプトではもはや自動アップデートできない...。
久しく手動アップデートになっていたのだが、iTunes 11.0.3に対応した自動アップデートスクリプトを作ってみた。
AppleScript(iTunes 11.0.3用のiOSアプリ自動アップデートスクリプト)
delay 10
tell application "iTunes" to launch
tell application "iTunes" to reopen
delay 10
--iTunesウィンドウに対する操作
tell application "System Events"
tell process "iTunes"
set frontmost to true
delay 1
tell window "iTunes"
keystroke "7" using {command down} --ライブラリの「App」選択
click splitter group 1's radio group 1's radio button 6 -->ラジオボタン,6,アップデート
click splitter group 1's button 1 -->ボタン,missing value,すべてのAppをアップデート or アップデートを確認
--iTunes ライブラリにある App のアップデートはありませんに対応する
delay 2
if my iTunes_dialog_exists() then
my iTunes_dialog_OK() error number -128
end if
delay 2
--ダウンロードが完了するまで待ち、年齢認証ダイアログに対応する
my iTunes_download_waiting() end tell
end tell
end tell
--ダイアログが表示されているか?
on iTunes_dialog_exists() tell application "System Events"
tell process "iTunes"
exists (windows whose subrole = "AXDialog") end tell
end tell
end iTunes_dialog_exists
--ダイアログでOKボタンを押す
on iTunes_dialog_OK() try
tell application "System Events"
tell process "iTunes"
set frontmost to true
delay 1
repeat while my iTunes_dialog_exists() click window 1's button "OK"
end repeat
end tell
end tell
end try
end iTunes_dialog_OK
--ダウンロードが完了するまで待ち、年齢認証ダイアログに対応する
on iTunes_download_waiting() tell application "System Events"
tell process "iTunes"
set frontmost to true
try
click window "iTunes"'s button 9 -->ボタン,missing value,ダウンロードウインドウ
end try
set app_items to rows of table 1 of scroll area 1 of window "ダウンロード" -->ボタン,missing value,missing value
set flag to true
repeat while flag
delay 10
my iTunes_dialog_OK() set flag to false
repeat with l in app_items
try
if l's group 1's button 1's name = "一時停止" then
set flag to true
end if
end try
end repeat
end repeat
end tell
end tell
end iTunes_download_waiting
仕様
- 上記のスクリプトを実行すると、iTunesを起動して、iOSアプリのアップデートを確認して、必要があればダウンロードするのだ。
- 年齢認証ダイアログが表示された場合は、OKボタンを押してくれる。
- iTunes ライブラリにある App のアップデートはありませんダイアログが表示された場合も、OKボタンを押してくれる。
-
-
- iTunesストアには、事前にサインインしておく必要がある。
-