Tips/オブジェクトが存在するか?
text art item 1が存在しなければtrueを返す
tell application "Adobe Illustrator 10.0.3"
tell document 1
if not (exists text art item 1) then
return true
end if
end tell
end tell
TOPへ
character/properties
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item 1
--set font of character 1 to "Osaka"
set properties of character 1 to {font:"Osaka", size:real}
end tell
end tell
end tell
10,9共通
TOPへ
character/set color範囲指定
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item 1
set fill color of characters 4 thru 5 to {cyan:100, magenta:0, yellow:0, black:0}
end tell
end tell
end tell
10,9共通
TOPへ
character/set font
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item 1
set font of character 6 to "Osaka"
end tell
end tell
end tell
10,9共通
'Process("Adobe Illustrator 9.0").SendAE "core,setd,'----':
'obj {form:prop, want:type(prop), seld:type(font), from:
'obj {form:indx, want:type(cha ), seld:6, from:
'obj {form:indx, want:type(cTXa), seld:1, from:
'obj {form:indx, want:type(docu), seld:1, from:'null'()}}}}, data:メOsakaモ"
Dim ae as AppleEvent
Dim obj as AppleEventObjectSpecifier
ae = NewAppleEvent("core", "setd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
obj = GetIndexedObjectDescriptor("cha ",obj,cha)
obj = GetpropertyObjectDescriptor(obj,"font")
ae.ObjectSpecifierParam("----") = obj
ae.stringParam("data") = FONTNAME
if Not ae.send() then
else
end if
TOPへ
character/set font範囲指定
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item num
set font of characters Scha thru Echa to Fname
end tell
end tell
end tell
10,9共通
'Process("Adobe Illustrator 9.0").SendAE "core,setd,'----':
'obj {form:prop, want:type(prop), seld:type(font), from:
'obj {form:rang, want:type(cha ), seld:
'→rang{star:obj {form:indx, want:type(cha ), seld:3, from:'ccnt'()},
'→stop:obj {form:indx, want:type(cha ), seld:6, from:'ccnt'()}}, from:
'obj {form:indx, want:type(cTXa), seld:1, from:
'obj {form:indx, want:type(docu), seld:1, from:'null'()}}}},
'data:メOsakaモ"
Dim ae as AppleEvent
Dim obj,Sobj,Eobj as AppleEventObjectSpecifier
ae = NewAppleEvent("core", "setd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
Sobj=GetIndexedObjectDescriptor("cha ",obj,Scha)
Eobj=GetIndexedObjectDescriptor("cha ",obj,Echa)
obj=GetRangeObjectDescriptor("cha ",obj,Sobj,Eobj)
obj = GetpropertyObjectDescriptor(obj,"font")
ae.ObjectSpecifierParam("----") = obj
ae.stringParam("data") = FONTNAME
if Not ae.send() then
else
end if
TOPへ
character/カーニング
set Lay to 1 as number
set ItemNum to 1 as number
set karnTable to "-0.1,-0.12,-0.14" as text
set OriginalDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {","}
set karnTable to text items of karnTable
set AppleScript's text item delimiters to OriginalDelimiters
tell application "Adobe Illustrator 10"
tell document 1
tell layer Lay
tell text art item ItemNum
repeat with N from 1 to count karnTable
set kernNum to item N of karnTable as real
if kernNum is not 0 then
tell character N
set kerning to kernNum
end tell
end if
end repeat
end tell
end tell
end tell
end tell
TOPへ
color/colorを透明にする
tell application "Adobe Illustrator 10.0.3"
tell text art item "B" of document 1
set filled of characters 1 thru -1 to false
set fill color of characters 1 thru -1 to {cyan:0, magenta:0, yellow:0, black:0}
end tell
end tell
カラー設定2つ
上は透明に
下は白に
TOPへ
document/作成する
tell application "Adobe Illustrator 9.0"
make new document with properties {color space:RGB}
end tell
TOPへ
document/保存せずに閉じる
tell application "Adobe Illustrator 10.0.3"
if name of document 1 is "TEXT.AI" then
close document 1 saving no
else if name of document 2 is "TEXT.AI" then
close document 2 saving no
end if
end tell
10,9共通
TOPへ
duplicate/オブジェクトをコピーする
tell application "Adobe Illustrator 10.0.3"
tell document 1
set myPos to position of path item 1 of layer "外枠"
set myObj to duplicate path item 1 of layer "外枠" to layer "外枠" with properties {position:myPos}
set guides of myObj to true
end tell
end tell
TOPへ
export/gif出力
set SaveFolder to choose folder with prompt "保存フォルダを選択してください"
tell application "Adobe Illustrator 10.0.3"
activate
tell document 1
set countLayer to count layer
repeat with t from 1 to countLayer
if layer t is not locked then --ロックされていないレイヤーをぜんぶ非表示にする
set visible of layer t to false
end if
end repeat
repeat with t from 1 to countLayer
if layer t is not locked then
set visible of layer t to true
set OutName to name of layer t
set saveF to (SaveFolder as text) & (OutName as text) & ".gif"
export to file saveF as GIF --[with options anything]
-- JPEG/Photoshop/SVG/PNG8/PNG24/GIF
set visible of layer t to false
end if
end repeat
end tell
end tell
下記が簡単な例
set SaveFolder to choose folder with prompt "保存フォルダを選択してください"
tell application "Adobe Illustrator 10.0.3"
activate
tell document 1
set saveF to (SaveFolder as text) & "myPicture.gif"
export to file saveF as GIF with options {class:GIF export options, horizontal scaling:200, vertical scaling:200}
end tell
end tell
TOPへ
group/グループコピー
tell application "Adobe Illustrator 10"
open file inputFile
set groupRef to make new group item of layer "IMG" of document 2
duplicate every page item of document 1 to beginning of groupRef
close document 1 saving no
end tell
TOPへ
group/コピーペースト(高速)
tell application "Adobe Illustrator 10"
tell document 1
tell every page item
set selected to true
end tell
activate
copy
end tell
make new document
tell document 1
paste
end tell
end tell
下記のようにグループ化してから
コピペしたかったけど
これをすると複合パスが消えてしまって
抜きのはずのオブジェクトに色がついてしまった。
tell application "Adobe Illustrator 10"
set docuName to name of document 1
tell document docuName
set groupRef to make new group item at end
try
move every page item to beginning of groupRef
end try
end tell
end tell
TOPへ
guide/オブジェクトをガイドにする
tell application "Adobe Illustrator 10.0.3"
tell document 1
set guides of path item 1 to true
end tell
end tell
TOPへ
paragraph/set_行揃え
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item num
tell paragraph 1
set justification to right
end tell
end tell
end tell
end tell
10,9共通
'Process("Adobe Illustrator 9.0").SendAE "core,setd,'----':
'obj {form:prop, want:type(prop), seld:type('pT16'), from:
'obj {form:indx, want:type(cpar), seld:1, from:
'obj {form:indx, want:type(cTXa), seld:1, from:
'obj {form:indx, want:type(docu), seld:1, from:'null'()}}}},
'data:'e123'"
Dim ae as AppleEvent
Dim obj as AppleEventObjectSpecifier
ae = NewAppleEvent("core", "setd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
obj = GetIndexedObjectDescriptor("cpar",obj,1)
obj = GetpropertyObjectDescriptor(obj,"pT16")
ae.ObjectSpecifierParam("----") = obj
ae.stringParam("data")="e123"
if Not ae.send() then
//
else
//
end if
TOPへ
paragraph/縦組か横組みか
tell application "Adobe Illustrator 10"
tell document 1
tell layer 1
tell text art item 1
tell line 1
get text orientation --vertical=縦--horizontal=横
end tell
end tell
end tell
end tell
end tell
TOPへ
paragraph/長体処理
--指定されたテキストボックスを1行ずつ収まるように長体
set boxName to "B"
set boxName to boxName as string
tell application "Adobe Illustrator 10"
tell document 1
tell text art item boxName
set P to 1
repeat
try
set Pstr to contents of paragraph P
set Lstr to contents of line 1 of paragraph P
on error
exit repeat
end try
if Pstr is not Lstr then
--ここではみ出した文字が5文字未満なら長体処理を行う
set Lstr2 to contents of line 2 of paragraph P
if length of Lstr2 < 5 then
my PCYOU1(boxName, P, 95)
end if
end if
set P to P + 1
end repeat
end tell
end tell
end tell
on PCYOU1(boxName, P, SCL)
tell application "Adobe Illustrator 10"
tell document 1
tell text art item boxName
--ここのchar指定を2から-1にしているので2文字目からの長体になる
set scaling of characters 2 thru -1 of paragraph P to {SCL, 100}
set Pstr to contents of paragraph P
set Lstr to contents of line 1 of paragraph P
if Pstr is Lstr then
return
else
my PCYOU1(boxName, P, SCL - 5)
end if
end tell
end tell
end tell
end PCYOU1
TOPへ
path item/make_ガイド作成(レイヤー指定)
tell application "Adobe Illustrator 10.0.3"
set X1 to X1 as real
set X2 to X2 as real
set Y1 to Y1 as real
set Y2 to Y2 as real
set startP to {X1, Y1}
set endP to {X2, Y2}
tell layer 2 of document 1
make new path item at beginning with properties {entire path:{startP, endP}, stroked:false, filled:false, guides:true} --opacity:myPathOpacity}
end tell
end tell
end tell10,9共通
TOPへ
path item/make_ライン作成
tell application "Adobe Illustrator 10.0.3"
set X1 to X1 as real
set X2 to X2 as real
set Y1 to Y1 as real
set Y2 to Y2 as real
set C to C as number
set M to M as number
set Y to Y as number
set K to K as number
set W to W as real
set Lay to Lay as number
set startP to {X1, Y1}
set endP to {X2, Y2}
tell document 1
tell layer Lay
make new path item at beginning with properties {entire path:{startP, endP}, filled:false, stroke color:{cyan:C, magenta:M, yellow:Y, black:K}, stroke width:W} --opacity:myPathOpacity}
end tell
end tell
end tell
end tell10,9共通
TOPへ
path item/pathのサイズ
pathのサイズ
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell path item num
set myB to geometric bounds
end tell
end tell
end tell
set X to item 1 of myB
set Y to item 2 of myB
set W to item 3 of myB
set H to item 4 of myB
10,9共通
TOPへ
path item/set_色
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell path item num
set fill color to {cyan:CC, magenta:MM, yellow:YY, black:KK}
end tell
end tell
end tell
10,9共通
TOPへ
placed item/oldに枠いっぱいにいれる計算
on getPercent(oldW, oldH, newW, newH)
--oldに枠いっぱいにいれる
set per1 to oldW / newW
set per2 to oldH / newH
if per1 > per2 then
return per1
else
return per2
end if
end getPercent
TOPへ
placed item/properties
XYを決めて配置する。
set X to X as text
set Y to Y as text
tell application "Adobe Illustrator 9.0"
tell document 1
tell placed item 1
set properties to {position:{X, Y}}
end tell
end tell
end tell
下記のようにWHも決めると
サイズ変更もできる。
on run {X, Y, W, H}
set X to X as text
set Y to Y as text
set W to W as text
set H to H as text
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell placed item 1
set properties to {position:{X, Y}, height:H, width:W}
end tell
end tell
end tell
return "true"
end run
10,9共通
TOPへ
placed item/回転
tell application "Adobe Illustrator 10.0.3"
tell document 1
rotate placed item 1 angle 5
end tell
end tell
TOPへ
placed item/選択されたフォルダ内のファイルを配置。
--これは選択されたフォルダ内のファイルを配置。位置調整
tell application "Finder"
set myFolder to choose folder with prompt "フォルダを選択してください"
repeat with N from 1 to the number of myFolder
set myFile to item N of myFolder
if file type obsolete of myFile = "EPSF" then
my SETAI(myFile as string, N)
end if
end repeat
end tell
on SETAI(filePath, N)
set X to 10
set Y to 10
set W to 50
set H to 50
set Y to Y + H * N
tell application "Adobe Illustrator 10"
set placedRef to make new placed item in document 1 with properties {file path:alias filePath}
set W to width of placedRef
set H to height of placedRef
--set properties of placedRef to {position:{X, Y}}
set properties of placedRef to {position:{X, Y}, height:H / 2, width:W / 2}
end tell
end SETAI
TOPへ
placed item/配置してサイズ調整
下記で配置後mySizeのサイズに変更する。
set filePath to "MacintoshHD:Users:takeuchi:Documents:かぶった画像検索:かぶり画像20041082112:101174"
set X to 10
set Y to 10
set mySize to 50
set pt to 2.83
set mySize to mySize * pt
set X to X * pt
set Y to Y * pt
tell application "Adobe Illustrator 10"
set placedRef to make new placed item in document 1 with properties {file path:alias filePath}
set pW to width of placedRef
set pH to height of placedRef
if pW > pH then
set buf to pW
else
set buf to pH
end if
set Percent to mySize / buf
set W to pW * Percent
set H to pH * Percent
set properties of placedRef to {position:{X, Y}, height:H, width:W}
end tell
TOPへ
placed item/配置する
set placedRef to make new placed item in document 1 with properties {file path:alias "Macintosh HD:ジャンプ"}
10,9共通
set EPSobj to make new group item at end of groupRef with data alias inputFile with properties {position:[X, Y2]}
このように配置すると埋め込みになる
set placedRef to make new group item at end with data alias Mpath
埋め込み簡易版
レイヤーにtellしている状態
tell application "Adobe Illustrator 10"
tell document 1
tell layer 1
set placedRef to make new placed item at end with properties {file path:alias Mpath}
end tell
end tell
end tell
TOPへ
placed item/配置画像を変更する
tell application "Adobe Illustrator 9.0"
tell document 1
tell placed item 1
set file path to file "DV HD:test:412155.eps"
end tell
end tell
end tell
TOPへ
rectangle/make_作成
tell application "Adobe Illustrator 10.0.3"
make new rectangle at beginning of document 1 with properties {bounds:{0.0, 200.0, 200.0, 50.0}, fill color:{cyan:100, magenta:100, yellow:0, black:0}}
end tell
10,9共通
TOPへ
rectangle/make_作成2
tell application "Adobe Illustrator 10.0.3"
set X1 to X1 as real
set X2 to X2 as real
set Y1 to Y1 as real
set Y2 to Y2 as real
set Lay to Lay as number
set startP to {X1, Y1}
set endP to {X2, Y2}
tell document 1
tell layer 1
make new rectangle at beginning with properties {bounds:{X1, Y1, X2, Y2}, filled:false, stroke width:0} --, note:"square"}
end tell
end tell
end tell10,9共通
TOPへ
save/EPS保存
set fileRef to fileRef as text --"DV HD:新商品 1"
tell application "Adobe Illustrator 10.0.3"
save current document in file fileRef as eps with options {class:EPS save options, compatibility:Illustrator 10, embed all fonts:true}
--class:PDF save options ツ
--, compatibility:Acrobat 4 ツ
--, preserve editability:true}
end tell
10,9共通
'★互換性///compatibility /Rb:pICp:'e207'
'Illustrator 3/Illustrator 4/Illustrator 5/Illustrator 6/Illustrator 7/Illustrator 8/Illustrator 9
'★プレビュー///preview
'none/BW Macintosh/color Macintosh/BW TIFF/color TIFF/transparent color TIFF
'★オプション
'★配置した画像を含む///embed linked files
'boolean///default: false
'★サムネールを作成included document thumbnails
'boolean///default: true
'★フォントデータを含む///embed all fonts
'boolean//default: false
'★日本語ファイル形式を使用///japanese file format
'boolean///for Illustrator 3 - 5 compatibility.///default: false
'★CMYKポストスクリプト///CMYK PostScript
'boolean///default:false
'★ポストスクリプト///PostScript
'level 1/level 2/level 3///default:level 3
'★透明度///flatten output
'preserve paths/preserve appearance///default: preserve appearance
TOPへ
symbol/symbolを配置
tell application "Adobe Illustrator 10"
set treeSymItem to make new symbol item in layer 1 of document 1 with properties {symbol:symbol "test" of document 1, position:{10, 20}}
end tell
TOPへ
text/get_サイズを調べる
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item 1
set myB to geometric bounds
end tell
end tell
end tell
set X to item 1 of myB
set Y to item 2 of myB
set W to item 3 of myB
set H to item 4 of myB
10,9共通
'Process("Adobe Illustrator 9.0").SendAE "core,getd,'----':
'obj {form:prop, want:type(prop), seld:type(aiBG), from:
'obj {form:indx, want:type(cTXa), seld:1, from:
'obj {form:indx, want:type(docu), seld:1, from:'null'()}}}"
dim X,Y,W,H,reNum as string
dim W as string
Dim ae as AppleEvent
Dim obj as AppleEventObjectSpecifier
Dim reDesc as appleEventDescList
ae = NewAppleEvent("core", "getd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
obj = GetpropertyObjectDescriptor(obj,"aiBG")
ae.ObjectSpecifierParam("----") = obj
if Not ae.send() then
return "0,0,0,0"
//return "0"
else
reDesc=ae.ReplyDescList
X = reDesc.stringItem(1)
Y = reDesc.stringItem(2)
W = reDesc.stringItem(3)
H = reDesc.stringItem(4)
return X+chr(9)+Y+chr(9)+W+chr(9)+H
return Y
//reW =val(W)
//return reW
end if
TOPへ
text/get_フォント・サイズを調べる
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item num
tell character 1
set myF to font
set myC to size
end tell
end tell
end tell
end tell
10,9共通
Dim ae as AppleEvent
Dim obj,obj1,obj2 as AppleEventObjectSpecifier
//Dim reFont,reSize as string
dim test as string
ae = NewAppleEvent("core", "getd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
obj = GetIndexedObjectDescriptor("cha ",obj,1)
obj1 = GetpropertyObjectDescriptor(obj,"font")
obj2 = GetpropertyObjectDescriptor(obj,"ptsz")
ae.ObjectSpecifierParam("----") = obj1
if Not ae.send() then
//test=re("FONT")
//return ""
else
greFont=ae.Replystring
ae.ObjectSpecifierParam("----") = obj2
if ae.send() then
greSize=ae.Replystring
end if
//return ae.Replystring
end if
TOPへ
text/get_ボックスの種類
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item num
set myK to kind
end tell
end tell
end tell
10,9共通
返り値
area text
point text
TOPへ
text/get_行数を調べる
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item num
set lineNum to count line
end tell
end tell
end tell
10,9共通
TOPへ
text/get_数を数える
tell application "Adobe Illustrator 10.0.3"
tell document 1
set boxnum to count text art item
end tell
end tell
10,9共通
TOPへ
text/get_内容を調べる
内容を調べる
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item num
set myC to contents
end tell
end tell
end tell
10,9共通
'Process("Adobe Illustrator 10").SendAE "core,getd,'----':
'obj {form:prop, want:type(prop), seld:type(pcnt), from:
'obj {form:indx, want:type(cTXa), seld:15, from:
'obj {form:indx, want:type(docu), seld:1, from:'null'()}}}"
Dim ae as AppleEvent
Dim obj as AppleEventObjectSpecifier
ae = NewAppleEvent("core", "getd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
obj = GetpropertyObjectDescriptor(obj,"pcnt")
ae.ObjectSpecifierParam("----") = obj
if Not ae.send() then
return ""
else
return ae.Replystring
end if
TOPへ
text/get_幅を調べる
幅を調べる
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item 1
set myW to width
end tell
end tell
end tell
10,9共通
TOPへ
text/set_位置変更
tell application "Adobe Illustrator 9.0"
tell document 1
tell text art item 1
set position to {0, 0}
end tell
end tell
end tell
'Process("Adobe Illustrator 9.0").SendAE "core,setd,'----':
'obj {form:prop, want:type(prop), seld:type(paPs), from:
'obj {form:indx, want:type(cTXa), seld:1, from:
'obj {form:indx, want:type(docu), seld:1, from:'null'()}}},
'data:[0, 0]"
Dim ae as AppleEvent
Dim obj as AppleEventObjectSpecifier
dim sendDesc as AppleEventDescList
sendDesc = New AppleEventDescList
ae = NewAppleEvent("core", "setd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
obj = GetpropertyObjectDescriptor(obj,"paPs")
ae.ObjectSpecifierParam("----") = obj
sendDesc.appendstring(X)//W
sendDesc.appendstring(Y)//H
ae.DescListParam("data") = sendDesc
if Not ae.send() then
else
end if
TOPへ
text/set_位置変更2
tell application "Adobe Illustrator 9.0"
tell document 1
tell text art item 1
set properties to {position:{10, 10}, height:100, width:200}
end tell
end tell
end tell
'Process("Adobe Illustrator 9.0").SendAE "core,setd,'----':
'obj {form:prop, want:type(prop), seld:type(pALL), from:
'obj {form:indx, want:type(cTXa), seld:1, from:
'obj {form:indx, want:type(docu), seld:1, from:'null'()}}},
'data:{paPs:[10, 10], pSHh:100, pSHw:200}"
Dim ae as AppleEvent
Dim obj as AppleEventObjectSpecifier
dim sendDesc as AppleEventDescList
dim sendReco as appleEventRecord
sendDesc = New AppleEventDescList
ae = NewAppleEvent("core", "setd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
obj = GetpropertyObjectDescriptor(obj,"pALL")
ae.ObjectSpecifierParam("----") = obj
sendDesc = New AppleEventDescList
sendReco = New AppleEventRecord
sendDesc.appendstring(X)//W
sendDesc.appendstring(Y)//H
sendReco.descListParam("paPs")=sendDesc
sendReco.stringParam("pSHh") = H
sendReco.stringParam("pSHw") = W
ae.recordParam("data") = sendReco
if Not ae.send() then
else
end if
TOPへ
text/set_長体
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text in text art item num
set scaling to {W, H} --W2 / W1
end tell
end tell
end tell
10,9共通
日本語を含む文字列だとうまくいかない。
その場合
contentsを"1"に変更後
長体をかけ
もういちどcontentsをsetしなおす。
'Process("Adobe Illustrator 9.0").SendAE "core,setd,'----':
'obj {form:prop, want:type(prop), seld:type('pT08'), from:
'obj {form:indx, want:type(ctxt), seld:abso(ヌ616C6C20ネ), from:
'obj {form:indx, want:type(cTXa), seld:1, from:
'obj {form:indx, want:type(docu), seld:1, from:'null'()}}}},
' data:[50, 100]"
Dim ae as AppleEvent
Dim obj as AppleEventObjectSpecifier
dim sendDesc as AppleEventDescList
sendDesc = New AppleEventDescList
ae = NewAppleEvent("core", "setd", "ART5")
obj = GetIndexedObjectDescriptor("docu",nil,1)
obj = GetIndexedObjectDescriptor("cTXa",obj,num)
obj = GetOrdinalObjectDescriptor("ctxt",obj,"all ")
obj = GetpropertyObjectDescriptor(obj,"pT08")
ae.ObjectSpecifierParam("----") = obj
sendDesc.appendstring(str(WS))//W
sendDesc.appendstring(str(HS))//H
ae.DescListParam("data") = sendDesc
if Not ae.send() then
else
end if
TOPへ
text/set_内容をセット
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item num
set contents to (Str as text)
end tell
end tell
end tell
10,9共通
TOPへ
text/set_内容をセット(範囲)
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell text art item num
set contents of characters Scha thru Echa to Str
end tell
end tell
end tell
10,9共通
TOPへ
text/text全部保存
set TexData to ""
set FileName to "Macintosh HD:test3"
tell application "Adobe Illustrator 10.0.3"
tell document 1
set boxnum to count text art item
repeat with N from 1 to boxnum
set TexData to TexData & contents of text art item N & return
end repeat
end tell
end tell
open for access file FileName with write permission
write TexData to file FileName
close access file FileName
10,9共通
TOPへ
text/クリップボードをペースト
tell application "Adobe Illustrator 10.0.3"
activate
tell document 1
tell text art item 1
set selected to true--オブジェクトを選択
set selection to text from character 1 to character -1--すべてを選択
paste
end tell
end tell
end tell
TOPへ
text/テキスト作成
set setStr to "サンプルテキスト"
set X to 10
set Y to 10
*)
set setStr to setStr as string
set X to X as real
set Y to Y as real
set pt to 2.83
set X to X * pt
set Y to Y * pt
tell application "Adobe Illustrator 10"
set placedRef to make new text art item in document 1 with properties {contents:setStr, position:{X, Y}}
set properties of every paragraph of text art item 1 in document 1 to {size:8.5, fill color:{class:CMYK color info, black:100, cyan:0, magenta:0, yellow:0}, font:"ShinGo-Bold-83pv-RKSJ-H"}
end tell
TOPへ
text/テキスト作成
set setStr to "サンプルテキスト"
set X to 10
set Y to 10
*)
set setStr to setStr as string
set X to X as real
set Y to Y as real
set pt to 2.83
set X to X * pt
set Y to Y * pt
with timeout of 1 second
try
tell application "Adobe Illustrator 10"
set placedRef to make new text art item in document 1 with properties {contents:setStr, position:{X, Y}}
set properties of every paragraph of text art item 1 in document 1 to {size:8.5, fill color:{class:CMYK color info, black:100, cyan:0, magenta:0, yellow:0}, font:"ShinGo-Bold-83pv-RKSJ-H"}
end tell
TOPへ
サンプル/画像をIllustratorに配置
--選択したフォルダ内の画像をIllustratorに配置する。
tell application "Finder"
set myFolder to choose folder with prompt "フォルダを選択してください"
repeat with myFile in myFolder
if file type obsolete of myFile = "EPSF" then
my SETAI(myFile as string)
end if
end repeat
end tell
--ドロップレットにする。
on open inputList
tell application "Finder"
repeat with myFile in inputList
if file type obsolete of myFile = "EPSF" then
my SETAI(myFile as string)
end if
end repeat
end tell
end open
on SETAI(filePath)
set X to 10
set Y to 10
set W to 50
set H to 50
tell application "Adobe Illustrator 10"
set placedRef to make new placed item in document 1 with properties {file path:alias filePath}
set properties of placedRef to {position:{X, Y}}
--set properties of placedRef to {position:{X, Y}, height:H, width:W}
end tell
end SETAI
--OS9で作成。
TOPへ
サンプル/画像をQuarkXPressに配置
--選択したフォルダ内の画像をIllustratorに配置する。
tell application "Finder"
set myFolder to choose folder with prompt "フォルダを選択してください"
repeat with myFile in myFolder
if file type obsolete of myFile = "EPSF" then
my SETQX(myFile as string)
end if
end repeat
end tell
--ドロップレットにする。
on open inputList
tell application "Finder"
repeat with myFile in inputList
if file type obsolete of myFile = "EPSF" then
my SETQX(myFile as string)
end if
end repeat
end tell
end open
on SETQX(filePath)
set X to 10
set Y to 10
set W to 50
set H to 50
tell document 1 of application "QuarkXPress(TM)3.31"
tell page 1
make picture box at beginning with properties {runaround:none runaround, bounds:{Y, X, Y + H, X + W}}
tell picture box 1
set image 1 to filePath --filePathは画像のフルパス
tell image 1
set bounds to exact fit
end tell
end tell
end tell
end tell
end SETQX
--OS9で作成。
TOPへ
マスク/アイテムを配置しRECTを作りマスクに
set Y to Y as real
set W to W as real
set H to H as real
set pageNum to pageNum as number
set inputFile to inputFile as text
set Lay to Lay as text
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell layer Lay
set groupRef to make new group item at beginning
make new rectangle at end of groupRef with properties {bounds:{X, Y, X + W, Y + H}, filled:false, stroke width:0}
make new placed item at end of groupRef with properties {file path:alias inputFile, position:[X - W, Y + H]}
set clipped of groupRef to true
end tell
end tell
end tell
TOPへ
マスク/グループをマスクに
tell application "Adobe Illustrator 9.0"
tell document 1
set clipped of group item 1 to true
end tell
end tell
グループにしないとマスクにできない。
グループにするには下記のようにする。
画像配置→グループ→クリッピングマスク
set fileRef to alias "CID-HD:403180"
tell application "Adobe Illustrator 9.0"
set groupRef to make new group item in document 1
tell document 1
make new placed item at end of groupRef with properties {file path:fileRef, position:itemPosition}
set groupRef to duplicate path item 1 to beginning
delete path item 2
set selected of path item 1 to true
end tell
set clipped of path item 1 to true
end tell
TOPへ
マスク/配置してクリッピング。センターにする
set X to 5 as real
set Y to 5 as real
set W to 100 as real
set H to 60 as real
set inputFile to "FW3GBHD:test.eps"
set Lay to "IMG" as text
tell application "Adobe Illustrator 10.0.3"
tell document 1
tell layer Lay
--boundsを作る場合原点は左下
--placeの場合は原点は左上そのためplaceItemの高さを足すと原点が左下になる。
set groupRef to make new group item at beginning
make new rectangle at end of groupRef with properties {bounds:{X, Y, X + W, Y + H}, filled:false, stroke width:0}
set EPSobj to make new placed item at end of groupRef with properties {file path:alias inputFile, position:[X, Y]}
set clipped of groupRef to true
set W2 to width of EPSobj as real
set H2 to height of EPSobj as real
set X2 to (W - W2) / 2 --Yの差の1/2
set Y2 to (H - H2) / 2 --Hの差の1/2
set properties of EPSobj to {position:{X + X2, Y + Y2 + H2}} --Y座標は原点をあわせるためにplaceItemのHをプラスする。
--set properties of EPSobj to {position:{X, Y + H}, height:H, width:W}
end tell
end tell
end tell
TOPへ
レイヤー/レイヤーを作成
tell application "Adobe Illustrator 9.0"
make new document with properties {color space:CMYK}
tell document 1
make new layer at beginning
end tell
end tell
TOPへ
選択された/boxのbounds
on run
with timeout of 5 seconds
try
tell application "Adobe Illustrator 10"
tell document 1
set SelIndex to every page item whose selected is true
set SelCount to number of SelIndex as integer
if SelCount is 1 then
set myB to geometric bounds of item 1 of SelIndex
set X to (item 1 of myB) as string
set Y to (item 2 of myB) as string
set W to (item 3 of myB) - X as string
set H to Y - (item 4 of myB) as string
set reStr to X & "," & Y & "," & W & "," & H
else
set reStr to "false"
end if
end tell
end tell
return reStr
on error
return "false"
end try
end timeout
end run
TOPへ