I have a regexp that searches for 3 terms
(LEFT TRAVEL)
(RIGHT TRAVEL)
(BUCKET)
When it finds the terms it adds NOTE A to the textFrame it is found in.
Would it be possible to have NOTE A be Arial Bold without changing the other text in the frame?
And one more addition...would it be possible to create a new textFrame with NOTE A right below the position of the terms found?
Here is the current working code that adds the NOTE A to the text frame.
#target illustrator
var doc = app.activeDocument;
var allText = doc.textFrames;
// TEXT TO SEARCH FOR
var sensorSearch = /\(LEFT TRAVEL\)|\(RIGHT TRAVEL\)|\(BUCKET\)/gi;
// NOTE TO ADD
var addNoteA = "NOTE A", result;
// SEARCH AND CHANGE LOOP
for (var i = 0; i < allText.length; i++) {
// SKIP THESE BECAUSE THEY ARE IN THE COLOR TABLE
if (allText.contents == "LEFT TRAVEL CONTROL CIRCUIT" || allText.contents == "RIGHT TRAVEL CONTROL CIRCUIT"){
// SKIP THESE BECAUSE THEY ARE IN THE COLOR TABLE
}
else{
while (result = sensorSearch.exec(allText.contents)) {
try {
aCon = allText.characters[result.index];
//alert(allText.position);
aCon.length = result[0].length;
aCon.contents = aCon.contents + "\r" + addNoteA;
} catch (e) {};
}
}
}
Any help would be appreciated!