Copy link to clipboard
Copied
I am using the 'FindChangeByList.jsx' to format a series of text files.
I realise that I can map tags to styles using the 'Tags" palette.
But I wondered, if it is possible, if someone would be able to show me the syntax to include in my list (.txt file) to map xml tags to paragraph styles assigned in the list as it runs the script?
Steve
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks Shonky - your answer reminded me that I'd actually asked the wrong question. What I need is not a script but a text or GREP find/change method to assign tags to paragraph styles - sorry for that. I've been trying to reply for a couple of days but this forum seems a bit flaky at the moment for me.
Steve
Copy link to clipboard
Copied
If you want through find and change here below is a function for apply tag on paragraph style
var myDoc = app.activeDocument;
addtags("A Head", "Head");
addtags("Text", "P");
function addtags(stylename, tag)
{
if(myDoc.paragraphStyles.item(stylename) != null)
{
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = '.+';
app.findGrepPreferences.appliedParagraphStyle = stylename;
app.changeGrepPreferences.markupTag = tag;
myDoc.changeGrep();
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
}
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now