I have a switch()
that needs to contain multiple conditions for it to be true.
The online community tells me I should separate them in two cases and then define it. like so:
function changeGrep(searchFor){
app.findGrepPreferences.findWhat = searchFor;
var myFound = myDoc.findGrep();
for(i=0; i<myFound.length; i++){
switch(searchFor){
case "^201\\d$":
case myFound[i].parent.fillColor == app.activeDocument.swatches.item(14):
myFound[i].parent.fillColor = app.activeDocument.swatches.item(3);
break;
case "^-?\\+?\\(?((\\d+,)?(\\d+,)?(\\d+)(\\.\\d+)?%?\\)?)$":
case myFound[i].parent.fillColor == app.activeDocument.swatches.item(14):
myFound[i].parent.fillColor = app.activeDocument.swatches.item(4);
break;
}
}
}
changeGrep("^-?\\+?\\(?((\\d+,)?(\\d+,)?(\\d+)(\\.\\d+)?%?\\)?)$");
changeGrep("^201\\d$");
To be complete at first the entire table is placed in a red color (14)
. If two conditiond are true it should change the color. However it does't care about the second case
.
Any ideas on how to do this in extendscript?