Answered
It's not allowed to be used like this? Regular expressions are replaced with variables.
Why is that, it says the findWhat property setting is invalid?
What it should say is that gre doesn't have any data
I originally got it right by writing it directly like this:
var res = getGrepSearch("@", app.activeDocument);
var res = getGrepSearch("@", app.activeDocument);
gre = new RegExp('@');
main(){
var res = getGrepSearch(gre, app.activeDocument);
}
. . . .. .
function getGrepSearch(fp, s) {
app.findGrepPreferences = app.changeGrepPreferences = app.findChangeGrepOptions = null;
app.findChangeGrepOptions.properties = { includeHiddenLayers: true, includeLockedLayersForFind: true, includeLockedStoriesForFind: true, includeMasterPages: true }
app.findGrepPreferences.findWhat = fp;
//return app.findGrep()
return s.findGrep()
}
