22)特殊なノンブル

| コメント(0) | トラックバック(0)

WORDのPDFが元原稿で、それにあわせて全角数字でどうしてもノンブルを入れなくては行けない時のサンプルです。これは単ページのドキュメントのセンター下にテキストフレームを作りそこに全角数字のノンブルを入れます。

tell application "Adobe InDesign CS2_J"
	tell active document
		set PS to paragraph style "ノンブル"
		set countPage to count pages
		repeat with N from 1 to countPage
			tell page N
				set myStr to my HanToZen((N) as string)
				--ページ番号をオリジナル関数HanToZenを使って全角にする。
				set Tobj to make text frames at beginning with properties ¬
					{contents:myStr, visible bounds:¬
					{297 - 15, 210 / 2 - 20, 297 - 10 + 5, 210 / 2 + 20}}
					--テキストフレームを作成し文字を入れる
				set applied paragraph style of paragraph 1 of Tobj to PS
				--スタイルを当てる。
			end tell
		end repeat
	end tell
end tell

--オリシナル関数HanToZen
on HanToZen(myStr)
	set findList to {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
	--半角文字リストを作成
	set repList to {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
	--全角文字リストを作成
	repeat with N from 1 to count findList
		set myStr to my FindAndRep(item N of findList, item N of repList, myStr)
		--リスト分検索置換
	end repeat
	return myStr
end HanToZen

--オリシナル関数FindAndRep(検索置換)
on FindAndRep(findStr, repStr, motoStr)
	set OriginalDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {findStr}
	set motoStr to text items of motoStr
	set AppleScript's text item delimiters to {repStr}
	set motoStr to motoStr as string
	set AppleScript's text item delimiters to OriginalDelimiters
	return motoStr
end FindAndRep

トラックバック(0)

トラックバックURL: http://www.adg7.com/mt/mt-tb.cgi/102

Comments are nofollow setting

コメントする

エントリー一覧

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