Copy link to clipboard
Copied
I'm looking for script where as I need to change full length month to short. I will try to depict my situation as simple as possible. Please don't mind at times I'm not so good at articulation, if my requirement is not clear please let me know.
Here we go....
January - Jan.
February - Feb.
August - Aug.
September - Sept.
October - Oct.
November - Nov.
December - Dec.
But the above months shouldn't be changed in all instances. For example when we have in the following format then we need to change January 31, 2020 - Jan. 31, 2020. But not when month is alone and even if month and year is together, for example January is alone or January 2020.
I hope I'm clear and if I'm missing something please let me know.
This will save lot of time instead of finding out these date formats manually.
Thank you!!
Hi Sunil,
Give the following snippet a shot
var fullName = ["January", "Februrary", "August", "September", "October", "November", "December"]
var shortName = ["Jan.", "Feb.", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."]
for(var i = 0; i < fullName.length; i++)
{
app.findGrepPreferences = NothingEnum.NOTHING;
app.changeGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.findWhat = fullName[i] + "( \\d{1,2}, \\d{4})";;
app.changeGrepPreferences.changeTo = shortName[i] + "$1";
var a
...
Copy link to clipboard
Copied
Hi Sunil,
Give the following snippet a shot
var fullName = ["January", "Februrary", "August", "September", "October", "November", "December"]
var shortName = ["Jan.", "Feb.", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."]
for(var i = 0; i < fullName.length; i++)
{
app.findGrepPreferences = NothingEnum.NOTHING;
app.changeGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.findWhat = fullName[i] + "( \\d{1,2}, \\d{4})";;
app.changeGrepPreferences.changeTo = shortName[i] + "$1";
var a = app.activeDocument.changeGrep();
}
app.findGrepPreferences = NothingEnum.NOTHING;
app.changeGrepPreferences = NothingEnum.NOTHING;
-Manan
Copy link to clipboard
Copied
Hi Manan,
what a prompt reply and your script works like a charm. Thanks a lot!!!