1月 24, 2011
kamata

System Events でプレビューを操作する

System Events でプレビューの表示を2ページにするスクリプトです。

(注:System Eventsを利用するには、システム環境設定>ユニバーサルアクセスの下にある、「補助装置にアクセスできるようにする」にチェックを入れておきます)

set theApp to “Preview”
tell application theApp

activate
tell application “System Events” to tell process theApp to tell menu bar 1

get name of menu bar items
–{“Apple”, “プレビュー”, “ファイル”, “編集”, “表示”, “移動”, “ツール”, “ブックマーク”, “ウインドウ”, “ヘルプ”}
set mt to 5
get name of menu bar item mt

tell menu bar item mt to tell menu 1

get name of menu items
–{“PDF 表示”, “プロファイルを使ってソフトプルーフ”, “書類の背景を表示”, “自動的にサイズ変更”, missing value, “実際のサイズ”, “ウインドウに合わせる”, “拡大”, “縮小”, “選択部分に合わせて拡大”, missing value, “サイドバー”, “注釈ツールバーを表示”, “メモを表示”, “ツールバーを隠す”, “ツールバーをカスタマイズ…”, missing value, “スライドショー”}
set mi to 1
get name of menu item mi
–”PDF 表示”

tell menu item mi to tell menu 1

get name of menu items
–{“単一ページ”, “単一ページ(連続)”, “2 ページ”, “2 ページ(連続)”, missing value, “切り取りボックス”, “メディアボックス”}
click menu item 3 –2ページをクリックする

end tell

end tell

end tell

end tell


Leave a comment