29)字取り変更

| コメント(0)

Iビームカーソルでテキストを選択し、今9字取りの文字列を7字取りに変更といったことができるスクリプト

tell application "Adobe InDesign CS2_J"
	tell document 1
		--最小3文字
		set ANS to display dialog "何字取りを何字取りにしますか?¬
			" default answer "9/7" buttons {"OK"}
		set myStr to text returned of ANS
		set motoJIDORI to 9
		set newJidori to 7
		set motoJIDORI to my nthFields(myStr, "/", 1)
		set newJidori to my nthFields(myStr, "/", 2)
		set selectedItems to selection
		if selectedItems is {} then
			return
		end if
		set selItem to item 1 of selectedItems
		tell selItem
			set jidori of every character whose jidori is motoJIDORI to newJidori
		end tell
	end tell
end tell

on nthFields(myStr, sep, num)
	set OriginalDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {sep}
	set myStr to text items of myStr
	set AppleScript's text item delimiters to OriginalDelimiters
	return item num of myStr
end nthFields
Comments are nofollow setting

コメントする

エントリー一覧

OpenID対応しています OpenIDについて
Powered by Movable Type 8.0.2
漢字イラストロジック-脳トレ京
FREE ONLINE SUDOKU