スクスニップ

AppleScriptの断片をここに書く

InDesign 定規の開始位置を変更する AppleScript

「2-1 本章の概要」99ページのコラムには2つのスクリプト(本文ではプログラムと記述されている)が書かれている。

組版時間を半減する! InDesign自動処理実例集

組版時間を半減する! InDesign自動処理実例集

  • 定規の開始位置を「ページ」にする
  • 定規の開始位置を「スプレッド」にする

これを書く前に、まずは「定規の開始位置を確認する」AppleScriptを書く。

--定規の開始位置を確認する
tell application "Adobe InDesign CS6"
    ruler origin of view preferences of active document
end tell

--定規の開始位置をダイアログで確認する
tell application "Adobe InDesign CS6"
    --display dialog ruler origin of view preferences of active document as string
end tell

--定規の開始位置をダイアログで確認する(ハンドラ)
on getRulerOrigin()
    tell application "Adobe InDesign CS6"
        display dialog ruler origin of view preferences of active document as string
    end tell
end getRulerOrigin

f:id:mikomaya:20141110162020p:plain


確認ができるようになったので、「定規の開始位置を変更」するスクリプトを書いてみる。

--定規の開始位置を「ページ」にする
tell application "Adobe InDesign CS6"
    set ruler origin of view preferences of active document to page origin
end tell
getRulerOrigin()

f:id:mikomaya:20141110162020p:plain

--定規の開始位置を「スプレッド」にする
tell application "Adobe InDesign CS6"
    set ruler origin of view preferences of active document to spread origin
end tell
getRulerOrigin()

f:id:mikomaya:20141110162144p:plain

めでたし、めでたし。