LoginSignup
0
1

More than 5 years have passed since last update.

Illustratorで、選択画像のマスクサイズでオブジェクトを作るAppleScript

Last updated at Posted at 2017-02-23

要求を勘違いしてたけど、せっかく書いたので公開

表題の通り、Illustrator用のAppleScriptです。
選択した画像にマスクがあるなら、そのサイズでグレーの塗りのオブジェクトをつくります。
マスクがない場合はなにもしません。

回転には対応していません


tell application "Adobe Illustrator"

    tell document 1
        set selectList to selection

        if selectList is not 0 then
            repeat with theItem in selectList

                my getPathItem(theItem)

            end repeat
        end if
    end tell
end tell


on getPathItem(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 getPathItem(page item N of selObj)
            end repeat
        else if class of selObj is path item then

            my newRectangle(selObj)

        end if
    end tell
end getPathItem


on newRectangle(selObj)
    tell application "Adobe Illustrator"
        tell document 1

            tell selObj

                set geoBounds to geometric bounds

            end tell

            make new rectangle at beginning with properties {bounds:geoBounds, fill color:{cyan:0, magenta:0, yellow:0, black:30}}

        end tell
    end tell
end newRectangle

参考にしたサイトたけうちとおるのスクリプトノート

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1