LoginSignup
1
0

More than 5 years have passed since last update.

AppleScriptで写真(Photos)の選択項目を取得できない

Posted at
コード
tell application "Photos"
    set photo to item 1 of selection
end tell
結果
error "Photosでエラーが起きました: item 1 of selectionのタイプをspecifierに変換できません。" number -1700 from item 1 of selection to specifier

写真(Photos)アプリで選択している写真を処理するAppleScriptを書こうとしたが、selectionの要素を変数に代入しようとするとエラーになる。選択する写真の数を変えてからcountを調べるとちゃんと変化しているので、選択自体はされている模様。

selection (list of media item, r/o) : The currently selected media items in the application

リファレンスによるとselectionにはmedia itemが入っているはずだが、代入時の型変換に失敗している?

ネットで検索しても、アルバムに含まれる写真全てに対して処理を行うサンプルしか見つからない。

1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0