🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #215

paragraph styles in javascript

#215
From: adMjb
Date: Thu, 30 Apr 2009 14:04
88 lines
5003 bytes
Hi, I want to use this script or something similar:

This is to change one set of styles to another from an imported word
doc in indesign, I have done this which works, but if a style is not
there it errors,
also I am not sure if this its a bad way of doing it? as in using
loads of memory?

Again Any help would be great as I am so new to this its crazy!


// Numbered Paras styles
#target indesign;
app.findTextPreferences = app.changeTextPreferences = null;
app.findChangeTextOptions.includeFootnotes = true;
app.findChangeTextOptions.includeHiddenLayers = true;
app.findChangeTextOptions.includeMasterPages = true;
app.findTextPreferences.appliedParagraphStyle = "MainText Numbered";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Basic";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 1";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 1";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 2";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 2";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 3";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 3";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 4";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 4";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 5";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 5";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 6";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 6";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 7";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 7";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 8";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 8";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 9";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 9";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 10";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 10";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 11";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 11";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 12";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 12";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 13";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 13";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 14";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 14";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 15";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 15";
app.documents[0].changeText();
app.findTextPreferences.appliedParagraphStyle = "Number 16";
app.changeTextPreferences.appliedParagraphStyle = "56 - Numbered Para
Style 16";
app.documents[0].changeText();
/*Clear the find/change preferences after the search.*/
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing
Technical Details
Message-ID: <33909f94-3411-4f5d-b199-cf17c5b5019e@r31g2000prh.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!r31g2000prh.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: a938ebf930,6b07c0def62c81fb,start
X-Google-Attributes: gida938ebf930,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!r31g2000prh.googlegroups.com!not-for-mail
From: adMjb <adam.mjbarnes@gmail.com>
Newsgroups: adobe.scripting.indesign
Subject: paragraph styles in javascript
Date: Thu, 30 Apr 2009 07:04:09 -0700 (PDT)
Organization: http://groups.google.com
Lines: 88
Message-ID: <33909f94-3411-4f5d-b199-cf17c5b5019e@r31g2000prh.googlegroups.com>
NNTP-Posting-Host: 82.69.71.210
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1241100250 19535 127.0.0.1 (30 Apr 2009 14:04:10 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 30 Apr 2009 14:04:10 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: r31g2000prh.googlegroups.com; posting-host=82.69.71.210; 
 posting-account=zbwvkAoAAABO9xNJnEt9uR3D3zaFhIe0
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) 
 AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16,gzip(gfe),gzip(gfe)