同じくsearchを使って検索しているのですが、下記は"■数字."の文字列を検索し見つかれば"■見出し"という段落スタイルを付けています。
searchはCS3以降変更されているので、あくまで段落スタイルを適応するための参考程度にしてください。
tell application "Adobe InDesign CS2_J"
set oldFindPreferences to properties of find preferences
set oldChangePreferences to properties of change preferences
tell active document
tell page 1
my setPstyle(text frame 1, "■^9.", "■見出")
end tell
end tell
set properties of find preferences to oldFindPreferences
set properties of change preferences to oldChangePreferences
end tell
on setPstyle(TF serchString, styleName)
tell application "Adobe InDesign CS2_J"
set find preferences to nothing
set change preferences to nothing
tell active document
set PS1 to paragraph style styleName
search TF with find attributes {find text:serchString} ¬
with change attributes {applied paragraph style:PS1}
end tell
end tell
end setPstyle
コメントする