Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Select Note and apply Style

$
0
0

Hello, I need Help with this I need to combine These scripts

 

I need find and select a note through all the text boxes

01.jpg

if (app.documents.length > 0) {  var n = prompt('Type a note: ', 'note', 'Select note');  findNote(n);  function findNote(n) {  var doc = app.activeDocument;  var allMyArt = doc.pageItems;  var toSelect = Array();  for (var i = 0; i < allMyArt.length; i++) {  if (allMyArt[i].note == n) {  toSelect.push(allMyArt[i])  };  };  doc.selection = toSelect;  };  } else {  alert("No Docs");  }

 

then I need to find a word within the selected boxes and apply a text style

02.jpg

 

var frames = app.activeDocument.textFrames; 
for (var j = 0; j < frames.length; j++){ 
var text = frames[j].textRange; 
var italicStyle = app.activeDocument.characterStyles["Bold"]; 
var haystack = text.contents;
var needle = /World/gi;  /// "/[\(]([^\)\(\r]*)[\)]/gi;"
var match; 
while(match = needle.exec(haystack)){ 
var start = needle.lastIndex - match[0].length; 
var end = match[0].length; 
for (var i = 0; i< end; i++){ 
italicStyle.applyTo(text.characters[i + start]); 
} 
} 
} 

 

This is a example isnt real :

03.jpg

Thanks, sorry my bad english


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>