Article View: adobe.scripting.indesign
Article #8902Re: find & replace fonts
From: Y._F._T
Date: Fri, 22 Sep 2006 10:36
Date: Fri, 22 Sep 2006 10:36
5 lines
16257 bytes
16257 bytes
Well, with the following script, it works. I had problem with "set find preferences to nothing" when put in the middle of the script, so I specified the position "normal" :<DIV><BR class="khtml-block-placeholder"></DIV><DIV style="text-indent: -41px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 41.6px; "><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>tell</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">application</FONT><FONT class="Apple-style-span" face="Verdana"> "Adobe InDesign CS2"</FONT></DIV><DIV style="text-indent: -83px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 83.2px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>set</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">find preferences</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>to</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">nothing</FONT></DIV><DIV style="text-indent: -83px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 83.2px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>set</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">change preferences</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>to</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">nothing</FONT></DIV><DIV style="text-indent: -83px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 83.2px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>tell</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">active document</FONT></DIV><DIV style="text-indent: -124px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 124.8px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>set</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#408000" face="Verdana">myCharacterStyle</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>to</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">character style</FONT><FONT class="Apple-style-span" face="Verdana"> "exposant"</FONT></DIV><DIV style="text-indent: -124px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 124.8px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana">search</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">with find attributes</FONT><FONT class="Apple-style-span" face="Verdana"> {</FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">position</FONT><FONT class="Apple-style-span" face="Verdana">:</FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">superscript</FONT><FONT class="Apple-style-span" face="Verdana">} </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">with change attributes</FONT><FONT class="Apple-style-span" face="Verdana"> {</FONT><FONT class="Apple-style-span" color="#0000FF" fac="Verdana">applied character style</FONT><FONT class="Apple-style-span" face="Verdana">:"exposant"}</FONT></DIV><DIV style="text-indent: -124px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 124.8px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>set</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#408000" face="Verdana">myCharacterStyle</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>to</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">character style</FONT><FONT class="Apple-style-span" face="Verdana"> "italique"</FONT></DIV><DIV style="text-indent: -124px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 124.8px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana">search</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">with find attributes</FONT><FONT class="Apple-style-span" face="Verdana"> {</FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">position</FONT><FONT class="Apple-style-span" face="Verdana">:</FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">normal</FONT><FONT class="Apple-style-span" face="Verdana">, </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">font style</FONT><FONT class="Apple-style-span" face="Verdana">:"Oblique"} </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">with change attributes</FONT><FONT class="Apple-style-span" face="Verdana"> {</FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">applied character style</FONT><FONT class="Apple-style-span" face="Verdana">:"italique"}</FONT></DIV><DIV style="text-indent: -124px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 124.8px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>set</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#408000" face="Verdana">myCharacterStyle</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>to</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">character style</FONT><FONT class="Apple-style-span" face="Verdana"> "bold"</FONT></DIV><DIV style="text-indent: -124px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 124.8px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana">search</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">with find attributes</FONT><FONT class="Apple-style-span" face="Verdana"> {</FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">font style</FONT><FONT class="Apple-style-span" face="Verdana">:"Bold"} </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">with change attributes</FONT><FONT class="Apple-style-span" face="Verdana"> {</FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">applied character style</FONT><FONT class="Apple-style-span" face="Verdana">:"bold"}</FONT></DIV><DIV style="text-indent: -83px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 83.2px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdaa"><B>end</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>tell</B></FONT></DIV><DIV style="text-indent: -83px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 83.2px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>set</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">find preferences</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>to</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">nothing</FONT></DIV><DIV style="text-indent: -83px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 83.2px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>set</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">change preferences</FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>to</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana">nothing</FONT></DIV><DIV style="text-indent: -41px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 41.6px; "><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>end</B></FONT><FONT class="Apple-style-span" face="Verdana"> </FONT><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B>tell</B></FONT></DIV><DIV style="text-indent: -41px;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 41.6px; "><FONT class="Apple-style-span" color="#0000FF" face="Verdana"><B><BR class="khtml-block-placeholder"></B></FONT></DIV><DIV>The next step is to add commands to replace the XPress styles by new Indesign styles :<BR></DIV><DIV>1. Delete a character style and replace it by "None" ([Aucun] in french)</DIV><DIV>2. Replace some paragraph styles by others</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Olivier, I didn't understand the lines :</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">search with find attributes {applied character style:CharStyle_X} � �</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>with change attributes {applied character style:CharStyle_Y} �</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Do I have to write for example :</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">search with find attributes {applied character style:CharStyle "Normal(e)"} ���</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>with change attributes {applied character style:CharStyle "[Aucun]"}��</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Aren't there any "delete" or "replace with" comands for paragraph styles ?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I'm going to work on that� Thanks a lot ! If you have suggestions�</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV style="text-indent: -41px;"><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Yann F�lix Thouault</DIV><DIV>Le Bureau d'�dition</DIV><DIV><A href="mailto:le.bureau.dedition@cegetel.net">le.bureau.dedition@cegetel.net</A></DIV><DIV>06.61.35.60.29</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR><DIV><DIV>Le 22 sept. 06 � 10:00, Olivier Berquin a �crit :</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">A new message was posted by Olivier Berquin in <BR><BR> <B>InDesign Scripting</B> --<BR> ��find & replace fonts<BR><BR> YFT, <BR><BR><PRE> <BLOCKQUOTE><TT> [...] because I need to delete all the find attributes to search for superscript characters, but don't know how to. </TT></BLOCKQUOTE></PRE><TT> ��</TT><BR><BR>Insert these lines *between* your search/replace commands: <PRE> set find preferences to nothing
set change preferences to nothing
</PRE> But... don't know if it's work! In a few months, it was a bug. Anybody can confirm this? <BR><BR><PRE> <BLOCKQUOTE><TT> Moreover, how can we replace a paragraph style by another ? Is there a command "replace paragraph style "X" with paragraph style "Y" ? </TT></BLOCKQUOTE></PRE><TT> ��</TT><BR><BR>Yes you can. Use something like this: <PRE> search with find attributes {applied character style:CharStyle_X} �
with change attributes {applied character style:CharStyle_Y}
</PRE> <BR><BR>Oli. <BR><BR> <HR width="200" align="left">View/reply at <A href="http://www.adobeforums.com/cgi-bin/webx?13@@.3bc1af77/15">find & replace fonts</A><BR> Replies by email are OK.<BR> Use the <A href="http://www.adobeforums.com/cgi-bin/webx?280@@.3bc1af77!folder=.eea52bc">unsubscribe</A> form to cancel your email subscription.<BR><BR></BLOCKQUOTE></DIV><BR></DIV>
Technical Details
Message-ID:
<196AB475-D6FB-45EE-92ED-99E9B4669A75@cegetel.net>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.germany.com!news.isoc.lu!webcrossingReferences:
<3bc1af77.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,fa001c3c40e04d3b X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII From: Y._F._T@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.germany.com!news.isoc.lu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: find & replace fonts Message-ID: <196AB475-D6FB-45EE-92ED-99E9B4669A75@cegetel.net> Date: Fri, 22 Sep 2006 03:36:52 -0700 References: <3bc1af77.-1@webcrossing.la2eafNXanI> Lines: 217 X-Mailer: Apple Mail (2.749) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit