Last active
May 21, 2019 04:12
-
-
Save takawo/27d466c55cf60a6eead1bbee385d526b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var targetObj = []; | |
| var docObj = activeDocument; | |
| for (var i = 0; i < docObj.pageItems.length; i++) { | |
| typ = docObj.pageItems[i].typename; | |
| if (typ != "TextFrame") continue; | |
| targetObj.push(docObj.pageItems[i]); | |
| } | |
| for (var i = 0; i < targetObj.length; i++) { | |
| if (targetObj[i].contents.match(/山路を登りながら/)) { | |
| change_fillcolor(targetObj[i], getRandomInt(0, 255), getRandomInt(1, 255), getRandomInt(0, 255)); | |
| change_textSize(targetObj[i], getRandomInt(1, 5) * 100); | |
| targetObj[i].opacity = 100; | |
| targetObj[i].zOrder(ZOrderMethod.BRINGTOFRONT); | |
| } | |
| } | |
| function change_fillcolor(obj, r, g, b) { | |
| var my_color = new RGBColor(); | |
| my_color.red = r; | |
| my_color.green = g; | |
| my_color.blue = b; | |
| obj.textRange.characterAttributes.fillColor = my_color; // 塗りの色を指定 | |
| } | |
| function change_textSize(obj, size) { | |
| obj.textRange.characterAttributes.size = size; | |
| } | |
| function getRandomInt(min, max) { | |
| min = Math.ceil(min); | |
| max = Math.floor(max); | |
| return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment