Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Script to map xml tags to para styles

Community Beginner ,
Apr 13, 2010 Apr 13, 2010

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

TOPICS
Scripting
2.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 13, 2010 Apr 13, 2010

You can try Adobe Sample script MapTagsToStyles.jsx

See attached.

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 16, 2010 Apr 16, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 16, 2010 Apr 16, 2010
LATEST

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;

}

}

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines