2016-06-26 3 views
0

AppleTV(第2世代)から正しく表示され、ソートされるように、私はプログラムの「リリース日」を設定しようとしています。私のiTunesライブラリのすべてのテレビエピソード。残念ながら、そのフィールドはトラックオブジェクトのr/oなので、UIスクリプトを使って設定しています。 UI要素の名前を見つけるプロセスが完了しましたが、入力を受け入れるために必要な要素を取得できません。それに焦点が当てられていますが、キープレスはそれに到達していないようです。Applescript UIスクリプティングを使用してTVエピソードの情報の日付フィールドを設定する

tell application "iTunes" 
    tell frontmost to activate 
    if selection is not {} then 

     set originalSelection to selection 

     repeat with theEpisode in originalSelection 
      set addedDate to (date added of theEpisode) 
      if (release date of theEpisode) is missing value then 
       tell application "System Events" 
        tell process "iTunes" 
         tell menu bar 1 
          tell menu bar item "Edit" 
           tell menu "Edit" 
            click menu item "Get Info" 
           end tell 
          end tell 
         end tell 
         delay 1 
         tell window "TV Show Info" 
          activate 
          tell scroll area 1 
           tell group 1 
            set focused of UI element 2 to true 
            tell window "TV Show Info" to activate 
            keystroke "1" 
           end tell 
          end tell 
         end tell 
        end tell 
       end tell 
       -- I'd prefer to just do this, but the property is r/o 
       -- set release date of theEpisode to (date added of theEpisode) 
      end if 
     end repeat 
    end if  
end tell 

実際に焦点を当てるために日付フィールドを取得するには、いくつかの冗長で効果的ではない、必死の試みがあります。アクティブな要素として強調表示されていますが、まだキーを押していません。私は何が欠けていますか?

それはおそらく、彼らは辞書でそれを変更するのを忘れている、iTunesの12.4.1.6上で可能だが、

答えて

1

(これはつまり、どんな違いがあれば、iTunesの12.4.1.6である)。しかし。

tell application "iTunes" 
    repeat with theEpisode in (get selection) 
     if (release date of theEpisode) is missing value then 
      set addedDate to (date added of theEpisode) 
      set release date of theEpisode to addedDate 
     end if 
    end repeat 
end tell 
+0

最初、私はその反応に少し腹が立っていました。それが私の出発点でした。 *しかし、重要なのは、スクリプトエディタから実行するだけで、辞書で報告されるr/oアスペクトを尊重することです。一方、iTunesのスクリプトメニューからコンパイルされたスクリプトを実行することは、私が望んでいた通りに動作します。私の元のソリューションを再訪してくれてありがとう! Applescriptのもう一つの変わった点は、中間変数を経由しなければならないということです。さもなければ、間違ったエラーが報告されます。 – Chris

関連する問題