EXCELの行をコピーしIllustratorの選択した小組に流し込みます。テキストフレームがエリアテキストの場合はオーバーフローすれば収まるように長体がかかります。改行を含む文字の場合の長体処理はしていません。
小組のテキストフレーム1つ1つにIllustratorのレイヤーパレットで"A","B","C","D"・・・と名前をあらかじめつけておきます。
※レイヤーに名前を付けるようにレイヤーパレット内のテキストをダブルクリックして名前を付ける事が出来ます。
このテキストフレームがEXCELの列の"A","B","C","D"・・・と関連づきます。
※EXCELのA列の文字がIllustratorの"A"と名前を付けたテキストフレームに流し込まれます。
準備が終わったらIllustratorの小組を選択し、EXCELの行をコピーしてからスクリプトを実行してみてください。
※レイヤーに名前を付けるようにレイヤーパレット内のテキストをダブルクリックして名前を付ける事が出来ます。
このテキストフレームがEXCELの列の"A","B","C","D"・・・と関連づきます。
※EXCELのA列の文字がIllustratorの"A"と名前を付けたテキストフレームに流し込まれます。
準備が終わったらIllustratorの小組を選択し、EXCELの行をコピーしてからスクリプトを実行してみてください。
global textFlameList
set myRec to the clipboard
set textFlameList to {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
set OriginalDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {tab}
set myRec to text items of myRec
tell application "Adobe Illustrator"
tell document 1
set mySele to selection
repeat with selObj in mySele
my getTextFrameIndex(selObj)
end repeat
repeat with N from 1 to count myRec
my NAGASIKOMI(item N of textFlameList, item N of myRec)
end repeat
end tell
end tell
set AppleScript's text item delimiters to OriginalDelimiters
on getTextFrameIndex(selObj)
tell application "Adobe Illustrator"
if class of selObj is group item then
set myCount to count page items of selObj
repeat with N from 1 to myCount
my getTextFrameIndex(page item N of selObj)
end repeat
else if class of selObj is text frame then
set myName to name of selObj
set itemNum to my getItemNum(myName)
if itemNum > 0 then
set item itemNum of textFlameList to selObj
end if
end if
end tell
end getTextFrameIndex
on getItemNum(myName)
return offset of myName in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
end getItemNum
on NAGASIKOMI(targetTextFrame, inputStr)
if targetTextFrame is 0 then
return
end if
tell application "Adobe Illustrator"
set contents of targetTextFrame to inputStr
if kind of targetTextFrame is area text then
if my overflow(targetTextFrame) is true then
set mySCL to horizontal scale of paragraph 1 of targetTextFrame
my choutai(targetTextFrame, mySCL)
end if
end if
end tell
end NAGASIKOMI
on choutai(targetTextFrame, mySCL)
set mySCL to mySCL - 3
tell application "Adobe Illustrator"
set horizontal scale of paragraph 1 of targetTextFrame to mySCL
end tell
if my overflow(targetTextFrame) is true then
my choutai(targetTextFrame, mySCL)
end if
end choutai
on overflow(tFrame)
set OriginalDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to ""
tell application "Adobe Illustrator"
set myLastP to (contents of every paragraph of tFrame) as string
set myLastL to (contents of every line of tFrame) as string
set AppleScript's text item delimiters to OriginalDelimiters
if myLastP is not myLastL then
set AppleScript's text item delimiters to OriginalDelimiters
return true
else
set AppleScript's text item delimiters to OriginalDelimiters
return false
end if
end tell
end overflow
コメントする