04)コマンドを送る

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

get propertiesでtext frameのプロパティをいろいろ変更できました。ではtext frameを作成するのにはどうすれば良いでしょう。これにはコマンドを使います。用語辞書のCore Suiteのコマンドにmakeがあります。

make: Make a new element
	make
		new  type class  -- the class of the new element.
		at  location reference  -- the location at which to insert the element
		[with data  anything]  -- the initial data for the element
		[with properties  record]  -- the initial values for the properties of the element
	Result:   reference  -- to the new object(s)

makeというコマンドの次の行にnew type classとありさらに次にat location referenceとあります。これは

make new 作りたいオブジェクトのクラス at 場所

という書き方になります。その後の[]でくくられている部分は省略可能です。Resultにreferenceとありますがこれは返り値で新しく出来たオブジェクトが返ってきます。では作りたいオブジェクトのクラスですが、先ほどget propertiesで調べたtext frameクラスを渡してみましょう。場所は最前面につくるのならbeginningでいいでしょう。

tell application "Adobe Illustrator"
	tell document 1
		make text frame at beginning
	end tell
end tell

ぽつんと小さなオブジェクトが出来ました。これがスクリプトから作成したtext frameです。さきほど省略したwith propertiesを使ってみましょう。with properties recordと書いてあるのでwith properties {○○:〜〜}という使い方になります。text frameのプロパティは先ほど調べました。その中でcontentsを使ってみましょう。

tell application "Adobe Illustrator"
	tell document 1
		make text frame at beginning with properties {contents:"あああ"}
	end tell
end tell

ほかにもコマンドには

close: --ドキュメントを閉じる
	close document 1 saving no--保存せずに
count  reference  -- オブジェクトの数を数える
	count taxt frames
delete: -- オブジェクトを消す
	delete text frame 1
duplicate: --複製する
	duplicate text frame 1 to end
exists: --オブジェクトが存在するか?
	if exists text frame 1 then〜end if
move: --オブジェクトを動かす
	move text frame 1 to end of layer 1
open: --ファイルを開く
	open alias "Macintosh HD:test.ai"
save: --ファイルを保存する
	save  document  1 in  file "Macintosh HD:test.ai" as Illustrator

などがあります。まだまだ他にもいろいろありますので後述します。

トラックバック(0)

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

Comments are nofollow setting

コメントする

エントリー一覧

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