LoginSignup
0
1

More than 3 years have passed since last update.

最前面のテキストを塗り/線の色で1文字ずつ交互に塗るAppleScript

Last updated at Posted at 2020-07-13

せっかく塗りや線の設定があるのだからそれを利用できないかと思い書いてみました。

使い方

スクリーンショット 2020-07-13 23.33.18.png あらかじめ塗り分けたい色で塗りを設定します。

スクリーンショット 2020-07-13 23.33.09.png

このようなテキストがある場合、後から入力したテキストが対象になります。

スクリーンショット 2020-07-13 23.33.33.png

スクリプト実行後はこのように塗り分けられます。

コード

(*
    最前面のテキストに対し、塗り/線の色で1文字ずつ交互に塗るスクリプト
        1文字目から奇数番目を塗りの色
        2文字目から偶数番目を線の色

    2020-07-13
*)



tell application "Adobe Illustrator"
    tell document 1

        set fillColor to default fill color
        set strokeColor to default stroke color

        set celectText to every page item

        tell celectText's item 1
            repeat with i from 1 to count of (contents as string)

                tell character i
                    if i mod 2 is 1 then
                        set fill color to fillColor
                    else
                        set fill color to strokeColor
                    end if
                end tell

            end repeat
        end tell
    end tell
end tell


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