Copy link to clipboard
Copied
Is there a way that I can search through the selected text items and if the text frame contains a dash push the entire contents of the text frame into an array?
If it doesn't contain a dash it would just skip it.
so for example:
The following text would be selected....
SNJ1-UP RYT245-587 WRX1-107 J:37
There would be 4 items in the selection...
and it would push the content to an array dashFrames[]; which would have 3 text frame items in it...
dashFrames[0] = SNJ1-UP
dashFrames[1] = RYT245-587
dashFrames[2] = WRX1-107
Do you mean something like this?
// 4 textFrames should be selected
var tF = app.activeDocument.selection;
if (tF.length == 4) {
var count = 0;
var dashFrames = new Array ();
for (i = 0; i < tF.length; i++) {
if (tF.typename == "TextFrame") {
if (tF.contents.match ("-")) {
dashFrames[count] = tF.contents;
count++;
}
}
}
}
// alert (dashFrames)
// result: RYT245-587,WRX1-107,SNJ1-UP
Have fun
Copy link to clipboard
Copied
Do you mean something like this?
// 4 textFrames should be selected
var tF = app.activeDocument.selection;
if (tF.length == 4) {
var count = 0;
var dashFrames = new Array ();
for (i = 0; i < tF.length; i++) {
if (tF.typename == "TextFrame") {
if (tF.contents.match ("-")) {
dashFrames[count] = tF.contents;
count++;
}
}
}
}
// alert (dashFrames)
// result: RYT245-587,WRX1-107,SNJ1-UP
Have fun
Copy link to clipboard
Copied
Yup works perfect! Only thing I modified was the specific length of 4. My specs changed and I need that to be more dynamic now. THANKS pixxxel schubser!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now