Article View: adobe.scripting.indesign
Article #1658Script Poster
From: Dave_Saunders
Date: Mon, 02 Feb 2009 12:58
Date: Mon, 02 Feb 2009 12:58
39 lines
1759 bytes
1759 bytes
We used to have a topic that held a script for posting scripts here, but it must have scrolled off into the ether. Here's the script I use. You can see that it was written by "Peter" -- that's Peter Kahrel, who had posted it here in that previous topic.
Just select your script and then run this script -- it's for either CS3 or CS4.
//DESCRIPTION: Peter's script poster
with( app.documents.add() )
{
textPreferences.typographersQuotes = false;
with( app.activeDocument.textFrames.add() )
{
geometricBounds = [0,0,'700pt','500pt'];
insertionPoints[0].select();
}
}
app.paste();
app.findTextPreferences = app.changeTextPreferences = null;
s = app.documents[0].stories[0];
search(s, '&', '&');
search(s, '<', '<');
search(s, '^t', ' ');
search(s, '^[', "'" );
search(s, '^]', "'" );
search(s, '^}', '"' );
search(s, '^{', '"' );
s.insertionPoints[0].contents = '<pre>';
s.insertionPoints[-1].contents = '</pre>';
app.select(s.texts[0]);
app.copy();
function search(s, from, to) {
app.findTextPreferences.findWhat = from;
app.changeTextPreferences.changeTo = to;
s.changeText();
}
Thanks Peter.
Dave
Technical Details
Message-ID:
<59b7c17d.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,b01c2efbaa957bf8,start X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Script Poster Message-ID: <59b7c17d.-1@webcrossing.la2eafNXanI> Date: Mon, 2 Feb 2009 04:58:55 -0800 Lines: 39 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit