tag:blogger.com,1999:blog-63354600193165762812024-03-19T13:01:06.284+09:00Mac For TranslatorsA blog for translators working on macOSJean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comBlogger132125tag:blogger.com,1999:blog-6335460019316576281.post-63072415499171080832023-04-14T14:34:00.004+09:002023-05-06T09:35:00.373+09:00Convertir un fichier TMX en TBX avec une transformation XSLT<p style="color: #82006f; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"><?</span><span style="color: blue; font-kerning: none;">xml</span><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;">version</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">'1.0'</span><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;">encoding</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"UTF-8"</span><span style="color: #161616; font-kerning: none;">?></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #82006f; font-kerning: none;"><br />
</span><span style="font-kerning: none;"><!--</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>Ce document est une tentative pour créer une transformation XSL (XSLT) simple entre un fichier TMX (mémoire de traduction) et un fichier TBX (glossaire).</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Il permet d’utiliser la TMX créée à partir de la traduction d’un fichier des chaînes de l’interface utilisateur d’un logiciel et d’utiliser le contenu en tant que glossaire pour vérifier que les chaînes de l’IU sont bien traduites dans les documents qui la décrivent (manuels, etc.)</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>Il est possible d'utiliser ce document en l'enregistrant dans un fichier texte, et en l'associant à une liste de documents dans </i><b><i>Rainbow</i></b><i> ou avec un processeur XSLT tel que </i><b><i>xsltproc</i></b><i>, à la ligne de commande :</i></span></p><p style="font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Courier; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">xsltproc -o monFuturFichierTBX.tbx cetteTransformationXSLT.xsl monFichierTMX.tmx</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>La transformation a été écrite par Sirine Ben Hadj Khalifa et moi-même lors du stage de fin d’études de M2 de madame Ben Hadj Khalifa.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Les explications sont écrites par moi et correspondent à mon niveau de compréhension des standards à la date de leur écriture.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Le document peut être utilisé en l’état car les explications sont toutes à l'intérieur de commentaires XML et ne gênent en aucun cas le traitement du document.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Le document est un logiciel libre qui est utilisable et modifiable selon les termes de la licence GPL 3.0 (ou plus).</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>Copyright Sirine Ben Hadj Khalifa, Jean-Christophe Helary</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Références :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– TMX = Translation Memory eXchange (format d’échange de mémoire de traduction)</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.gala-global.org/tmx-14b</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– Rappel sur la structure d’une mémoire TMX :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> une TMX est constituée de balises « </i><b><i>tu</i></b><i> » (« translation unit ») qui contiennent des « </i><b><i>tuv</i></b><i> » (« translation unit variant »). Chaque « </i><b><i>tuv</i></b><i> » a un attribut « </i><b><i>xml-lang</i></b><i> » qui spécifie la langue de son contenu, et contient, quand elle contient quelque chose, une balise « </i><b><i>seg</i></b><i> » (« segment ») qui elle contiendra le texte.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">tu</span><span style="color: #1d1d1d; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">note</span><span style="font-kerning: none;">>UI</</span><span style="color: #730062; font-kerning: none;">note</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">tuv</span><span style="font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xml</span><span style="font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">lang</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"en"</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">seg</span><span style="font-kerning: none;">>OmegaT options :</</span><span style="color: #730062; font-kerning: none;">seg</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">tuv</span><span style="font-kerning: none;">></span></p><p style="color: #135003; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">tuv</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xml</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">lang</span><span style="color: #161616; font-kerning: none;">=</span><span style="font-kerning: none;">"fr"</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">creationid</span><span style="color: #161616; font-kerning: none;">=</span><span style="font-kerning: none;">"OmegaT Aligner"</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">creationdate</span><span style="color: #161616; font-kerning: none;">=</span><span style="font-kerning: none;">"20230401T121435Z"</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">seg</span><span style="font-kerning: none;">>Options OmegaT :</</span><span style="color: #730062; font-kerning: none;">seg</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">tuv</span><span style="font-kerning: none;">></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">tu</span><span style="font-kerning: none;">></span></p><p style="font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– TBX = TermBase eXchange (format d’échange de base terminologique)</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.iso.org/schema/isosts/v0.6/doc/tbx/</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– Rappel sur la structure d’un glossaire TBX (simple) :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> un TBX est constitué de balises « </i><b><i>termEntry</i></b><i> » qui contiennent des « </i><b><i>langSet</i></b><i> » dans lesquels on trouve des « </i><b><i>tig</i></b><i> » (« term information group ») qui à leur tour contiennent les « </i><b><i>term</i></b><i> ».</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #135003; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">termEntry</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">id</span><span style="color: #161616; font-kerning: none;">=</span><span style="font-kerning: none;">"OmegaT options:"</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">note</span><span style="font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xml</span><span style="font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">lang</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"en"</span><span style="font-kerning: none;">>UI</</span><span style="color: #730062; font-kerning: none;">note</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">langSet</span><span style="font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xml</span><span style="font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">lang</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"en"</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">tig</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">term</span><span style="font-kerning: none;">>OmegaT options :</</span><span style="color: #730062; font-kerning: none;">term</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">tig</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">langSet</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">langSet</span><span style="font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xml</span><span style="font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">lang</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"fr"</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">tig</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">term</span><span style="font-kerning: none;">>Options OmegaT :</</span><span style="color: #730062; font-kerning: none;">term</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">tig</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">langSet</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">termEntry</span><span style="font-kerning: none;">></span></p><p style="font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>On remarque que les deux hiérarchies ont une structure extrêmement similaire.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– Rainbow</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.okapiframework.org</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– xsltproc (disponible sur Linux, macOS, Cygwin pour Windows)</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"> </span><span style="font-kerning: none; text-decoration: underline;">https://gitlab.gnome.org/GNOME/libxslt/-/wikis/home</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– Qu'est-ce que le logiciel libre</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.gnu.org/philosophy/free-sw.fr.html</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– La licence GPL 3.0</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.gnu.org/licenses/quick-guide-gplv3.fr.html</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">--></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"><</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">stylesheet</span></p><p style="color: #82006f; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;">version</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"1.0"</span></p><p style="color: #135003; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xmlns</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">=</span><span style="font-kerning: none;">"http://www.w3.org/1999/XSL/Transform"</span></p><p style="color: #135003; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xmlns</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">local</span><span style="color: #161616; font-kerning: none;">=</span><span style="font-kerning: none;">"http://www.w3.org/2005/xquery-local-functions"</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #135003; font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;"><!--</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <i>La syntaxe d’un document XML est très claire, mais les ajouts de crochets et autres décorations rendent sa lecture difficile à un être humain. C’est pour ceci que lorsqu’on publie des documents XML il est préférable d’utiliser des fonctions automatiques de mise en retrait des lignes en fonction de leur niveau d’emboîtement, et donc d’utiliser correctement l’emboîtement (les sauts de ligne) pour correctement identifier les rapports entre balises (pour lesquelles on utilise la métaphore familiale : parent, enfant, ancêtre, descendant, etc.) et leurs attributs.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>On peut diviser la structure d’une balise en 3 éléments, et ce sont ces éléments sur lesquels notre attention doit porter pour comprendre la structure, et dans le cas d’une feuille XSL le fonctionnement, du document.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Une balise dans une langue conforme à la norme XML est en général composée ainsi:</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– le nom de la balise</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– les attributs de la balise (avec pour chaque attribut son nom et sa valeur)</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– le contenu de la balise</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>La plupart des langues XML autorisent des balises au contenu vide, et des valeurs d’attributs par défaut, etc.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Certaines langues autorisent le mélange à l’intérieur du document de balises provenant de langues externes. Pour s’assurer que la distinction est faite entre leurs propres balises et les balises « externes », elles vont systématiquement ajouter un préfixe à leurs propres balises. Ainsi, la lectrice saura toujours que les balises préfixées sont à interpréter dans le cadre de la langue du document alors que les balises non préfixées sont externes et à interpréter, éventuellement, dans le cadre de la langue externe.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>C’est le cas de XSLT qui va décrire la manière dont la transformation doit s’opérer avec ses propres balises et qui va utiliser les balises externes (ici les balises TBX) pour créer le fichier TBX. Les balises XSLT vont toutes être préfixées avec « xsl: » pour indiquer que seules ces balises sont à interpréter dans le cadre de la langue XSLT.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Références :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– Stylesheet element</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/1999/REC-xslt-19991116#stylesheet-element</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– XML = eXtensible Markup Language, donc « langue extensible de balisage »</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> XML est un ensemble de règles qui permet de définir des langues de balisage de document</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/REC-xml/</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– XSL = eXtensible Stylesheet Language, donc « langue extensible de feuille de style »</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> XSL est un ensemble de recommandations pour définir des transformations et des présentations pour documents XML</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/Style/XSL/</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– XSL est composé de :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – XSLT = XSL Transformations, qui est utilisée pour définir les règles de transformation d’un document XML</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – XPATH = XML Path Language, qui est utilisé pour trouver son chemin dans un document XML et éventuellement identifier les éléments qui seront la cible d’une transformation</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – XSL-FO = XSL Formatting Objects, qui est utilisé principalement pour produire des documents PDF</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Il faut noter que la complexité de XSL-FO et l’évolution des technologies du Web font que XSL-FO a tendance à être remplacé par CSS pour produire des documents lisibles dans un navigateur.</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/NOTE-XSL-and-CSS</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>– CSS = Cascading Stylesheet Language (langue de feuilles de style en cascade)</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/CSS/</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> --></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><br />
</span><span style="font-kerning: none;"> </span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">output</span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">method</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"xml"</span></p><p style="color: #82006f; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;">encoding</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"UTF-8"</span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">indent</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"yes"</span></p><p style="color: #135003; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">doctype-public</span><span style="color: #161616; font-kerning: none;">=</span><span style="font-kerning: none;">"ISO 12200:1999A//DTD MARTIF core (DXFcdV04)//EN"</span></p><p style="color: #82006f; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;">doctype-system</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"TBXcdv04.dtd"</span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> /></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"><br />
</span><span style="font-kerning: none;"><!--</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <i>Ici, on va produire (« output ») un fichier qui sera</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – du XML, de version 1.0 par défaut</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – en encodage UTF-8, déclaré dans le document.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – Ses lignes de la sortie seront mises en retrait en fonction de leur emboîtement</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – Son « </i><b><i>doctype</i></b><i> » public et le « </i><b><i>doctype</i></b><i> » local sont également définis ici, et ils spécifient que le document sera un document TBX.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Références :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– Output</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/1999/REC-xslt-19991116#output</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> --></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><br />
</span><span style="font-kerning: none;"> </span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">match</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"/"</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">martif</span><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">type</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"TBX"</span><span style="font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xml</span><span style="font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">lang</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"en"</span><span style="font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="font-kerning: none;">martifHeader</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">fileDesc</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">sourceDesc</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">p</span><span style="font-kerning: none;">>tmx2tbx</</span><span style="color: #730062; font-kerning: none;">p</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">sourceDesc</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">fileDesc</span><span style="font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </</span><span style="font-kerning: none;">martifHeader</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">text</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">body</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">apply-templates</span><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">select</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"tmx/body/tu"</span><span style="font-kerning: none;">/></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">body</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">text</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">martif</span><span style="font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #730062; font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;"><!--</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <i>Une feuille de transformation fonctionne en gros de la manière suivante :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – on définit une « template » (un modèle) qui s’applique à certains éléments du fichier d’origine (ici, des parties du fichier TMX que nous cherchons à transformer en fichier TBX)</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i> – on définit dans ce « modèle » les manières de transformer ces éléments (pour produire ici des parties du fichier TBX final).</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Notre premier modèle va s’appliquer à la totalité du document d’origine (TMX) car le symbole « </i><b><i>/</i></b><i> » dans le contexte d’une arborescence de document XML correspond à l’origine du document. Pour en savoir plus, il est nécessaire de consulter des tutoriels XPATH.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Puis on inscrit à l’intérieur de la définition du modèle la manière de modifier ce contenu auquel il s’applique.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Tout ce qui se trouve entre le </i></span><span style="color: #161616; font-kerning: none;"><</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">match</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"/"</span><span style="color: #161616; font-kerning: none;">></span><span style="font-kerning: none;"><i> et le </i></span><span style="color: #161616; font-kerning: none;"></</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;">></span><span style="font-kerning: none;"><i> de notre premier modèle est le contenu qui va être mis à la place de la totalité du document d’origine. Toutes les balises qui n’y sont pas préfixées par « </i></span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;"><i> » sont des éléments qui seront reproduits tels quels dans le document final. En ce qui nous concerne, ces parties sont donc des éléments du fichier TBX final.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Toutes les balises préfixées par « </i></span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;"><i> » sont des directives de transformation qui ne se retrouveront pas telles quelles dans le document final. Seulement le résultat de ces directives s’y retrouvera.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>À l’intérieur des balises TBX de notre premier modèle, on trouve une nouvelle directive XSL :</i></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"><</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">apply-templates</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">select</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"tmx/body/tu"</span><span style="color: #161616; font-kerning: none;">/></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Cette nouvelle directive nous indique qu’ici on va maintenant faire autre chose que d’ajouter des balises prédéfinies et qu’on va aller chercher des données à l’intérieur des « </i><b><i>tu</i></b><i> » du fichier TMX d’origine, qui se trouvent à l’intérieur de </i><b><i>tmx/body</i></b><i>. Cette notation avec des « </i><b><i>/</i></b><i> » indique la hiérarchie entre les éléments :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<b><i>/</i></b><i> est l’origine du document</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><b><i>tmx</i></b><i> est la balise racine du document (tout document XML a une balise racine, pour un fichier TMX c’est la balise </i><b><i>tmx</i></b><i>, pour un fichier TBX c’est la balise </i><b><i>martif</i></b><i>).</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><b><i>tmx/body</i></b><i> est une balise body qui est directement incluse dans la balise </i><b><i>tmx</i></b></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><b><i>tmx/body/tu</i></b><i> est une balise </i><b><i>tu</i></b><i> qui est directement incluse dans la balise </i><b><i>body</i></b><i>, etc.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>La directive nous demande donc d’appliquer un autre modèle, à l’intérieur du modèle principal, celle qui correspond aux éléments « </i><b><i>tu</i></b><i> » de la TMX.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Références :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– Defining Template Rules</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/1999/REC-xslt-19991116#section-Defining-Template-Rules</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>– Applying Template Rules</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/1999/REC-xslt-19991116#section-Applying-Template-Rules</i></span><span style="color: #54554c; font-kerning: none;"> </span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> --></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><br />
</span><span style="font-kerning: none;"> </span></p><p style="color: #135003; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">match</span><span style="color: #161616; font-kerning: none;">=</span><span style="font-kerning: none;">"tmx/body/tu"</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="font-kerning: none;">termEntry</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">attribute</span><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">name</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"id"</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">value-of</span><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">select</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"tuv[1]/seg"</span><span style="font-kerning: none;">/></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">attribute</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">note</span><span style="font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xml</span><span style="font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">lang</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"en"</span><span style="font-kerning: none;">>UI</</span><span style="color: #730062; font-kerning: none;">note</span><span style="font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">apply-templates</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">select</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"tuv"</span><span style="color: #161616; font-kerning: none;">/></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </</span><span style="font-kerning: none;">termEntry</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #730062; font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;"><!--</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <i>On retrouve ici la même structure que le premier modèle : on cherche des éléments auxquels on va appliquer une transformation.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Ici, les éléments sont les « </i><b><i>tu</i></b><i> » du document TMX d’origine.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>De la même manière que le premier modèle remplaçait la totalité du document d’origine avec des balises de type TBX, ici on va remplacer les « </i><b><i>tu</i></b><i> » de la TMX d’origine par la balise TBX « </i><b><i>termEntry</i></b><i> ».</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>On va ajouter un attribut à cette balise. Le nom de l’attribut sera « </i><b><i>id</i></b><i> » et sa valeur est définie de la manière suivante :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"><</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">value-of</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">select</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"tuv[1]/seg"</span><span style="color: #161616; font-kerning: none;">/></span><span style="font-kerning: none;"><i> qui nous indique qu’on doit prendre la valeur de l’élément sélectionné à droite : « </i></span><span style="color: #135003; font-kerning: none;">tuv[1]/seg</span><span style="font-kerning: none;"><i> »</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Nous nous trouvons dans le contexte d’une « </i><b><i>tu</i></b><i> » puisque c’est ce à quoi le modèle que nous considérons s’applique (</i></span><span style="color: #82006f; font-kerning: none;">match</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"tmx/body/tu"</span><span style="font-kerning: none;"><i>) et dans ce contexte, « </i></span><span style="color: #135003; font-kerning: none;">tuv[1]/seg</span><span style="font-kerning: none;"><i> » veut dire la balise « </i><b><i>seg</i></b><i> » qui se trouve dans la première balise « </i><b><i>tuv</i></b><i> » de la balise « tu</i><b><i> </i></b><i>» considérée. Sachant que la transformation va s’appliquer à toutes les balises qui correspondent à la spécification « </i><b><i>match</i></b><i> ».</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>La directive « </i><b><i>select</i></b><i> » nous indique que nous allons prendre le contenu (ici textuel) qui se trouve entre la balise ouvrante « </i><b><i><seg></i></b><i> » et la balise fermante « </i><b><i></seg></i></b><i> » qui constituent les éléments de base d’une TMX (cf. le rappel plus haut).</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Ce que nous avons défini ici c’est une balise </i><b><i><termEntry></i></b><i> dont l’attribut « </i><b><i>id</i></b><i> » aura pour contenu, le texte de la balise « </i><b><i>seg</i></b><i> » de la première « </i><b><i>tuv</i></b><i> » de notre « </i><b><i>tu</i></b><i> ». Vous pouvez trouver le résultat dans l’exemple donné dans le rappel plus haut.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>À l’intérieur d’une « </i><b><i>tu</i></b><i> » on a potentiellement une « </i><b><i>tuv</i></b><i> » au minimum, et parfois plus. Ici, je décide que la valeur que doit prendre le nouvel attribut « </i><b><i>id</i></b><i> » d’un </i><b><i>termEntry</i></b><i> est le contenu de la balise « </i><b><i>seg</i></b><i> » qui est elle-même contenue dans le premier TUV (dans notre TMX nous en avons 2 par « </i><b><i>tu</i></b><i> »).</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>La syntaxe est le contenu de la balise « </i><b><i>seg</i></b><i> » à l’intérieur du premier « </i><b><i>tuv</i></b><i> » : « </i></span><span style="color: #135003; font-kerning: none;">tuv[1]/seg</span><span style="font-kerning: none;"><i> ».</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Une fois l’attribut « i</i><b><i>d</i></b><i> » de </i><b><i>termEntry</i></b><i> défini, la directive </i></span><span style="color: #161616; font-kerning: none;"><</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">attribute</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">name</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"id"</span><span style="color: #161616; font-kerning: none;">></span><span style="font-kerning: none;"><i> se ferme avec </i></span><span style="color: #161616; font-kerning: none;"></</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">attribute</span><span style="color: #161616; font-kerning: none;">></span><span style="font-kerning: none;"><i> et on passe à l’ajout d’un contenu écrit en toutes lettres, qui est :</i></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><br />
<i> </i></span><span style="font-kerning: none;"><</span><span style="color: #730062; font-kerning: none;">note</span><span style="font-kerning: none;"> </span><span style="color: #0b22c4; font-kerning: none;">xml</span><span style="font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">lang</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"en"</span><span style="font-kerning: none;">>UI</</span><span style="color: #730062; font-kerning: none;">note</span><span style="font-kerning: none;">></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Cette note sera la même pour tous les « </i><b><i>termEntry</i></b><i> » de notre TBX, mais on pourrait imaginer un modèle qui y mettrait un contenu qui dépend d’un élément présent dans la TMX.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Après cette note, on trouve un autre appel à un modèle, qui va cette fois travailler sur le contenu des « </i><b><i>tuv</i></b><i> » de notre TMX.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Références :</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>- Creating Attributes with xsl:attribute</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/1999/REC-xslt-19991116#creating-attributes</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>- Generating Text with xsl:value-of</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><i> </i></span><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/1999/REC-xslt-19991116#value-of</i></span><span style="color: #54554c; font-kerning: none;"> </span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> --></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">match</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"tuv"</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="font-kerning: none;">langSet</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">attribute</span><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">name</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"xml:lang"</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">value-of</span><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">select</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"@xml:lang"</span><span style="font-kerning: none;">/></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">attribute</span><span style="font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">apply-templates</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">select</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"seg"</span><span style="color: #161616; font-kerning: none;">/></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">langSet</span><span style="font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #730062; font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;"><!--</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <i>Comme on l’a vu plus haut avec « </i><b><i>termEntry</i></b><i> », on ajoute ici une balise TBX « </i><b><i>langSet</i></b><i> » à laquelle on va associer un attribut.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Cette fois-ci, la définition de l’attribut utilise une autre syntaxe, mais elle va toujours sélectionner le contenu textuel d’un élément.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><i>Cet élément est spécifié avec la notation « </i><b><i>@ </i></b><i>», ce qui signifie qu’il s’agit non pas d’une balise descendante de « </i><b><i>tuv</i></b><i> » mais d’un attribut de « </i><b><i>tuv</i></b><i> », dont le nom est « </i><b><i>xml-lang</i></b><i> », c’est-à-dire le code qui identifie la langue naturelle du contenu du segment. C’est le même code langue qui sera utilisé dans l’attribut « </i><b><i>xml-lang</i></b><i> » qui, par un heureux hasard, a exactement le même nom dans TMX et dans TBX, mais ça n’est pas exactement un hasard, puisque c’est la méthode recommandée dans la norme XML pour identifier des langages :</i></span></p><p style="color: #0000e9; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/REC-xml/#sec-lang-tag</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Une fois l’attribut créé, on trouve un nouvel appel à un modèle, cette fois-ci pour traiter les balises « </i><b><i>seg</i></b><i> », probablement pour associer leur contenu au contenu d’un « </i><b><i>term</i></b><i> » dans le fichier TBX final.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> --></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px; min-height: 17px;"><span style="font-kerning: none;"></span><br /></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #54554c; font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">match</span><span style="color: #161616; font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"seg"</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">tig</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #730062; font-kerning: none;">term</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="font-kerning: none;">:</span><span style="color: #730062; font-kerning: none;">value-of</span><span style="font-kerning: none;"> </span><span style="color: #82006f; font-kerning: none;">select</span><span style="font-kerning: none;">=</span><span style="color: #135003; font-kerning: none;">"."</span><span style="font-kerning: none;">/></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">term</span><span style="font-kerning: none;">></span></p><p style="color: #161616; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> </</span><span style="color: #730062; font-kerning: none;">tig</span><span style="font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"> </</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">template</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #730062; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #161616; font-kerning: none;"></</span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="font-kerning: none;">stylesheet</span><span style="color: #161616; font-kerning: none;">></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="color: #730062; font-kerning: none;"><br />
</span><span style="color: #161616; font-kerning: none;"> </span><span style="font-kerning: none;"><!--</span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> <i>Ce dernier modèle va mettre entre les balises </i><b><i><term></i></b><i> et </i><b><i></term></i></b><i> la valeur textuelle du contenu de « </i><b><i>.</i></b><i> » qui est, dans la syntaxe d’un cheminement XML le lieu même du contexte, ici notre balise « </i><b><i>seg</i></b><i> ».</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Nous allons donc aller chercher le contenu textuel de nos segments et les copier (sans conserver d’éventuelles balises XML puisque « </i></span><span style="color: #730062; font-kerning: none;">value-of</span><span style="font-kerning: none;"><i> » ne conserve que le contenu textuel) à l’intérieur des balises « </i><b><i>term</i></b><i> » de notre TBX, et avec ce dernier modèle nous avons fini notre transformation.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br />
<i>Il faut remarquer que tous les modèles s’appliquent à tous les éléments correspondants à la spécification « </i></span><span style="color: #82006f; font-kerning: none;">match</span><span style="font-kerning: none;"><i> », il n’est donc pas nécessaire dans notre transformation d’utiliser de boucles de traitement (</i></span><span style="color: #0b22c4; font-kerning: none;">xsl</span><span style="color: #161616; font-kerning: none;">:</span><span style="color: #82006f; font-kerning: none;">for-each</span><span style="font-kerning: none;"><i>, </i></span><span style="color: #0000e9; font-kerning: none; text-decoration: underline;"><i>https://www.w3.org/TR/1999/REC-xslt-19991116#for-each</i></span><span style="font-kerning: none;"><i>) qu’on utiliserait dans un langage de programmation.</i></span></p><p style="color: #54554c; font-family: Helvetica; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"> --></span></p>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-62981941488559899012023-04-13T20:52:00.003+09:002023-05-06T09:20:51.355+09:00Launch files in Emacs.app<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">I'll eventually find the time to combine this script with the one that I describe in <a href="https://mac4translators.blogspot.com/2022/11/an-even-newer-version-of-my-capture-app.html" rel="nofollow" target="_blank">An even newer version of my Capture app</a>. For now, I call this script by saving it as an AppleScript application that I named ">Emacs.app".</p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">####################################</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>use</b> </span><span style="color: #6c05d3; text-decoration: underline;">AppleScript</span><span style="color: black;"> </span><span style="color: blue;">version</span><span style="color: black;"> "2.4" </span>-- Yosemite (10.10) or later</p>
<p style="color: blue; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>use</b> </span><i>scripting additions</i></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># This is standard AppleScript with no extra.<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># No need to declare anything more than the scripting additions.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>property</b> <span style="color: #408000;">myEmacs</span> : "/Users/suzume/Documents/Repositories/emacs/nextstep/Emacs.app"</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>property</b> <span style="color: #408000;">myEmacsclient</span> : "/Users/suzume/Documents/Repositories/emacs/nextstep/Emacs.app/Contents/MacOS/bin/emacsclient"</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>property</b> <span style="color: #408000;">myEmacsFront</span> : <span style="color: #6c05d3; text-decoration: underline;"><i>false</i></span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># I decided to use properties instead of variables in this script.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: blue; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>tell</b> </span><i>application</i><span style="color: black;"> </span><span style="color: #408000;">myEmacs</span></p>
<p style="color: blue; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>end</b> <b>tell</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Here, I activate Emacs, which has the effect to either put it at the front</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># or to launch it.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>repeat</b> <b>while</b> <span style="color: #408000;">myEmacsFront</span> = <span style="color: #6c05d3; text-decoration: underline;"><i>false</i></span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>try</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: blue;"><i>application</i></span> "System Events" <b>to</b> <b>tell</b> <span style="color: blue;"><i>process</i></span> "Emacs" <b>to</b> <b>set</b> <span style="color: #6c05d3; text-decoration: underline;">frontmost</span> <b>to</b> <span style="color: #6c05d3; text-decoration: underline;"><i>true</i></span></p>
<p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span>myEmacsFront<span style="color: black;"> <b>to</b> </span><span style="color: #6c05d3; text-decoration: underline;"><i>true</i></span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>on</b> <b>error</b></p>
<p style="color: blue; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>delay</b></span><span style="color: black;"> 1</span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>try</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>end</b> <b>repeat</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># If Emacs is not launched, it may take some time to start it.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># In which case the script will error because Emacs won't be here</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># when the script needs it.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># So I loop every second on the myEmacsFront property that</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#<span class="Apple-converted-space"> </span>will eventually be set to true once Emacs is set to the front.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>tell</b> <span style="color: blue;"><i>application</i></span> "Finder"</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">fileSelection</span> <b>to</b> <span style="color: #6c05d3; text-decoration: underline;">selection</span> <b>as</b> <span style="color: blue;"><i>alias list</i></span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>end</b> <b>tell</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># The Finder gives us the list of selected files.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>try</b></p>
<p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>repeat</b> <b>with</b> </span>selectedFile<span style="color: black;"> <b>in</b> </span>fileSelection</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">myEditCommand</span> <b>to</b> <span style="color: #408000;">myEmacsclient</span> & " -e \"(find-file \\\"" & (<span style="color: #6c05d3; text-decoration: underline;">POSIX path</span> <b>of</b> <span style="color: #408000;">selectedFile</span>) & "\\\")\" -n"</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><b>try</b></p>
<p style="color: #0016b0; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>do shell script</b></span><span style="color: black;"> </span><span style="color: #408000;">myEditCommand</span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><b>on</b> <b>error</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #0016b0; text-decoration: underline;"><b>display alert</b></span> "Emacs can't open the file"</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>try</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>repeat</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>on</b> <b>error</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #0016b0; text-decoration: underline;"><b>display alert</b></span> "The script can't find the file"</p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>end</b> <b>try</b></p>
<p style="color: black; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># This is the core of the script. It asks emacsclient to evaluate</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># (find-file "file path").</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># The error messages try to describe the error location.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># The only difficult part in this script was the escape sequences</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># needed to create myEditCommand.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-1433180666353165322022-11-16T11:59:00.002+09:002023-04-14T14:34:48.974+09:00Automator: Finder → Launch Application<p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px 0px 16px;"><span style="font-kerning: none;">I don’t know why it never occurred to me, but there is an Automator action from Finder that’s called </span><span style="font-family: Courier; font-kerning: none; font-stretch: normal; line-height: normal;">Launch Application</span><span style="font-kerning: none;"> and that you can use to:</span></p><ul>
<li style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">register an Applescript (or any other) application in the Services menu,</span></li>
<li style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">assign a shortcut to it,</span></li>
<li style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">launch it without having to call it with Spotlight.</span></li>
</ul><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">That saves the necessity to separately manage your AppleScript code, plus debugging from Automator is really not fun. . .</span></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br /></span></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio7oPwRILRSieHPpx8ex_xtEmYhero7-u53q_7521KdbFjJUI2OUTNi21kjrej2khAg9x8cfHH-fwWjE8ReCAu19kV4hQJG3gWXN2rqufN6q_7U2ZJahchRahY3ekUPBv2chf7Jf4NK6Eqc8_-4zvjjDvcJNHkGzyXzeyxGLidBNqpN_3aA9ZGJNWOAw/s1024/Screen%20Shot%202022-11-16%20at%2011.54.02.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="440" data-original-width="1024" height="138" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio7oPwRILRSieHPpx8ex_xtEmYhero7-u53q_7521KdbFjJUI2OUTNi21kjrej2khAg9x8cfHH-fwWjE8ReCAu19kV4hQJG3gWXN2rqufN6q_7U2ZJahchRahY3ekUPBv2chf7Jf4NK6Eqc8_-4zvjjDvcJNHkGzyXzeyxGLidBNqpN_3aA9ZGJNWOAw/s320/Screen%20Shot%202022-11-16%20at%2011.54.02.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><p></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px; min-height: 19px;"><span style="font-kerning: none;"></span><br /></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">And it also gives you the ability to automatically call the application instead of using either Spotlight or the running application navigator (I don’t know what it is called, the thing that you trigger when you hit Command+Tab).</span></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px; min-height: 19px;"><span style="font-kerning: none;"></span><br /></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">Anyway, now I have my Emacs Capture app from this weekend directly available with a shortcut, the only problem now being to make sure that the shortcut is particular enough that it does not conflict with existing application shortcuts. . .</span></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;"><br /></span></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2wplJ4pX-h2Ogh_Y2hHNt6-Y0NtMPZ4vGXesFVNACGwe9dmMewfAcsS-Iw-a40h4c5l9RGMeDdtRdk2YKUgJXL7bwpaYFvNTnDILKAZ91Rp94YiJwPQ_EPDD0zUYnuIiU9B0mcCehpzftScfK31hIGMcR-N5U8oiNDNS88YZa1qMv61HlQPY982zQpg/s584/Screen%20Shot%202022-11-16%20at%2011.54.21.png" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="266" data-original-width="584" height="146" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2wplJ4pX-h2Ogh_Y2hHNt6-Y0NtMPZ4vGXesFVNACGwe9dmMewfAcsS-Iw-a40h4c5l9RGMeDdtRdk2YKUgJXL7bwpaYFvNTnDILKAZ91Rp94YiJwPQ_EPDD0zUYnuIiU9B0mcCehpzftScfK31hIGMcR-N5U8oiNDNS88YZa1qMv61HlQPY982zQpg/s320/Screen%20Shot%202022-11-16%20at%2011.54.21.png" width="320" /></a></div><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px; text-align: left;"><span style="font-kerning: none;"></span></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px; min-height: 19px;"><span style="font-kerning: none;"></span><br /></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px; min-height: 19px;">Haha! That shortcut seems to work anywhere <i>but</i> in text fields, where it calls the spellchecker dialog...</p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px; min-height: 19px;"><br /></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">Et voilà!</span></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px; min-height: 19px;"><span style="font-kerning: none;"></span><br /></p><p style="font-family: Verdana; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">ps: Shortcuts has something similar, but it looks like it won’t accept applications that are not installed in </span><span style="font-family: Courier; font-kerning: none; font-stretch: normal; line-height: normal;">/Applications</span><span style="font-kerning: none;">, which is a pity.</span></p><p></p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-4236161482689341742022-11-15T15:40:00.006+09:002022-11-16T15:15:54.475+09:00An even newer version of my Capture app<p style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px 0px 16px;"><span style="font-kerning: none;">This is a newer version of what I wrote on Sunday.</span></p><p style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px 0px 16px;"><span style="font-kerning: none;">I figured a number of things.</span></p><ul>
<li style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">I’m not going to call this app at random, so I could just as well action something in Emacs when I dismiss the dialog.</span></li>
<li style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="font-kerning: none;">My default does not have to be selected. If it is not selected, I can use the fact that nothing is selected as the default.</span></li>
</ul><p style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px 0px 16px;"><span style="font-kerning: none;">So, I decided that dismissing the script would bring Emacs to the front, so that I can just write something without anything captured.</span></p><p style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px 0px 16px;"><span style="font-kerning: none;">Also, I added an option to display the Capture interactive selector in Emacs, in case I want to capture something that’s not in the list (i.e., something that I would not capture that often).</span></p><p style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px 0px 16px;"><span style="font-kerning: none;">I also put handlers, to kind of prettify the code.</span></p><p style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px 0px 16px; min-height: 19px;"><span style="font-kerning: none;"></span><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOtej8b0cLzdPatxqJ3ZofmRXmhvKRnNMIj3qsoAmc8ZxWr95OcmQGElBaueh0BqzlJJcaLJoZgogXjlkU2Xzdtx_H7cJeFXhiNxgg4dNcgwg9CD5p2TKFhZAdKdULx9iYFhMV9MBvZ79h8ek1ZlNgXuxbBHnYWKWngoDQyHPyqWZP_wOWZFG6awKOuw/s904/Screen%20Shot%202022-11-16%20at%2015.13.29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="722" data-original-width="904" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOtej8b0cLzdPatxqJ3ZofmRXmhvKRnNMIj3qsoAmc8ZxWr95OcmQGElBaueh0BqzlJJcaLJoZgogXjlkU2Xzdtx_H7cJeFXhiNxgg4dNcgwg9CD5p2TKFhZAdKdULx9iYFhMV9MBvZ79h8ek1ZlNgXuxbBHnYWKWngoDQyHPyqWZP_wOWZFG6awKOuw/s320/Screen%20Shot%202022-11-16%20at%2015.13.29.png" width="320" /></a></div><br /><p style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px 0px 16px;"><span style="font-kerning: none;">The next step, as written in the script, is to combine that code with the “Open with Emacs” code that I have and check whether Finder is front, in which case I either open the selection or the enclosing folder.</span></p><p style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal; margin: 0px 0px 16px;"><span style="font-kerning: none;">I’ll try to not scratch that itch before I’m done with urgent work. . .</span></p><div><span style="font-kerning: none;"><br /></span></div>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">####################################</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>use</b> </span><span style="color: #6c05d3; text-decoration: underline;">AppleScript</span><span style="color: black;"> </span><span style="color: blue;">version</span><span style="color: black;"> "2.4" </span>-- Yosemite (10.10) or later</p><p style="color: blue; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>use</b> </span><i>scripting additions</i></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>use</b> <span style="color: blue;"><i>framework</i></span> "Foundation"</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># First, I'll be using the Foundation framework because otherwise it </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># would be non-trivial to find "the index of a given item in my list". </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># And for that I'll just need to use NSArrays. I did not figure that out </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># by myself, I found the hint on stackoverflow.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># reference: https://stackoverflow.com/a/65690139/5511978</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>property</b> <span style="color: #408000;">NSArray</span> : <span style="color: blue;"><i>class</i></span> "NSArray"</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Then, I'm setting my paths to Emacs and emacsclient.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myEmacs</span> <b>to</b> "/.../Emacs.app"</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myEmacsclient</span> <b>to</b> "/.../Emacs.app/Contents/MacOS/bin/emacsclient"</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Here, I create the list of template items I want to quickly access. I </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># have many more, but the others are more about long-form writing, so I </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># figured I'd be facing Emacs when I need to access them.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># This list is basically "capture", "todo", "done", "dictionary", "notes" and "drafts".</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Then I transform that into a Foundation array</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># "capture" allows me to display the interactive template chooser.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myList</span> <b>to</b> {"capture", "à faire", "fait", "dictionnaire", "notes", "brouillon"}</p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>set</b> </span>myArray<span style="color: black;"> <b>to</b> </span>NSArray's<span style="color: black;"> </span><span style="color: red;">arrayWithArray</span><span style="color: black;">:</span>myList</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Here are the template keys that I use in my Emacs interactive capture </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># template.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Their order corresponds to the order of the above list items.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myKeys</span> <b>to</b> {"c", "a", "f", "d", "n", "b"}</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Now comes the interactive item selection window. That's the thing </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># that's apparently called when I call the app. All the rest takes place </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># behind the scenes.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I can just hit Enter without selecting anything.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I'll use that to call the default template, which is "fait".</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I can hit the first letter of any item for it to be selected, then I </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># hit Enter to simulate clicking on OK.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># The "capture" (c) key is special since it allows me to display the </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Emacs interactive template selection dialog.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I can dismiss the dialog with either hitting Escape or clicking on </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Cancel. But since I'm not calling the dialog by mistake, I use that </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># action to just bring Emacs to the front.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I'll probably use that in a future version to call Emacs on selected </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># file and folders to open them or open dired.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Then I'll need to move all that into a macOS service that I call with </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># a simple shortcut so that I don't have to:</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># - call Spotlight (Cmd+Space)</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># - call the app (>C)</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>try</b></p><p style="color: #0016b0; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="color: #408000;">captureChoice</span><span style="color: black;"> <b>to</b> (</span><span style="text-decoration: underline;"><b>choose from list</b></span><span style="color: black;"> </span><span style="color: #408000;">myList</span><span style="color: black;"> </span>with title<span style="color: black;"> "Emacs" </span>with prompt<span style="color: black;"> "Défaut = \"fait\"" <b>with</b> </span>empty selection allowed<span style="color: black;">)</span></p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span>captureChoice<span style="color: black;"> <b>to</b> </span><span style="color: blue;"><i>item</i></span><span style="color: black;"> 1 <b>of</b> </span>captureChoice</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>on</b> <b>error</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>if</b> <span style="color: #408000;">captureChoice</span> <b>is</b> <span style="color: #6c05d3; text-decoration: underline;"><i>false</i></span> <b>then</b></p><p style="color: red; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>myEmacsComesForward<span style="color: black;">()</span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>return</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>if</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>if</b> <span style="color: #6c05d3; text-decoration: underline;">length</span> <b>of</b> <span style="color: #408000;">captureChoice</span> <b>is</b> 0 <b>then</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">captureChoice</span> <b>to</b> "fait"</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>if</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>end</b> <b>try</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Here comes the place where I need Foundation's arrays.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Basically, the line says "You just selected something, find its index in the </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># list where it belongs, and get me the letter that has the same index </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># in the myKeys list."</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I'm adding a few parameters to see whether I'll use the contents of </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># the clipboard or not, and if I want to automatically send the template </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># key or let Emacs propose me the interactive selection dialog.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>set</b> </span>myTemplateKey<span style="color: black;"> <b>to</b> </span><span style="color: blue;"><i>item</i></span><span style="color: black;"> ((</span>myArray's<span style="color: black;"> </span><span style="color: red;">indexOfObject</span><span style="color: black;">:</span>captureChoice<span style="color: black;">) + 1) <b>of</b> </span>myKeys</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>if</b> <span style="color: #408000;">myTemplateKey</span> <b>is</b> <b>in</b> {"d", "n"} <b>then</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">useBody</span> <b>to</b> <span style="color: #6c05d3; text-decoration: underline;"><i>true</i></span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>else</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">useBody</span> <b>to</b> <span style="color: #6c05d3; text-decoration: underline;"><i>false</i></span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>end</b> <b>if</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>if</b> <span style="color: #408000;">myTemplateKey</span> <b>is</b> <b>in</b> {"c"} <b>then</b></p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span>interactiveCapture<span style="color: black;"> <b>to</b> </span><span style="color: #6c05d3; text-decoration: underline;"><i>true</i></span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>else</b></p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span>interactiveCapture<span style="color: black;"> <b>to</b> </span><span style="color: #6c05d3; text-decoration: underline;"><i>false</i></span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>end</b> <b>if</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># For 2 items, "dictionnaire" and "notes", I'm thinking that I'll </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># probably have found something in a document that I'm reading, I'll need</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># to copy it for use later on in the capture buffer.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># In the case of "dictionary", it's a word that I want to check, and I'll </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># use that as the title of the captured item.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># In the case of "notes", it's probably a sentence, or a paragraph that </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I want to keep in the body of a captured item.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I won't use the selection for the other items.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># For that, I'll put the selection (the clipboard) into the &body part of</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># the org-protocol command.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>if</b> <span style="color: #408000;">useBody</span> <b>is</b> <span style="color: #6c05d3; text-decoration: underline;"><i>true</i></span> <b>then</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">myTemplateBody</span> <b>to</b> "&body=" & (<span style="color: #0016b0; text-decoration: underline;"><b>the clipboard</b></span>)</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>else</b> <b>if</b> <span style="color: #408000;">useBody</span> <b>is</b> <span style="color: #6c05d3; text-decoration: underline;"><i>false</i></span> <b>then</b></p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span>myTemplateBody<span style="color: black;"> <b>to</b> ""</span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>end</b> <b>if</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># The &body part, though, is not super clearly explained in the </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># org-mode manual:</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># <span class="Apple-tab-span" style="white-space: pre;"> </span>%i The selected text</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Basically, the value of &body is the contents of %i in the capture template.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I don't know why the manual mentions "the selected text" since you can put</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># whatever you want in &body.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># In my templates, I've used it this way:</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span>("n" "choses à noter</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="font-family: "Lucida Grande"; font-stretch: normal; line-height: normal;">→</span> notes | à lire | code | inspiration" entry (file "~/org/memo.org")</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span>"* [%u] %?\n%i" :empty-lines 0 :unnarrowed nil)</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Here, %i, the contents of the clipboard, will be inserted in the body </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># of the capture buffer, under the headline (notice the "\n"). And the cursor</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># (%?) is waiting for me inside the headline.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># or:</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span>("d" "Dictionnaire" entry (file+datetree "/Users/suzume/org/dico.org")</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span>"* [%<%H:%M>] %i\n%?" :empty-lines 0 :unnarrowed nil)</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># where %i will be inside the headline and the body of the capture </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># (supposedly the term definition) will come after the line-break, where</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># the cursor is waiting for my input (%?).</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Et voilà !</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># The org-protocol command can be built, and sent to emacsclient:</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>if</b> </span>interactiveCapture<span style="color: black;"> <b>is</b> </span><span style="color: #6c05d3; text-decoration: underline;"><i>true</i></span><span style="color: black;"> <b>then</b></span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">myCaptureCommand</span> <b>to</b> <span style="color: #408000;">myEmacsclient</span> & " -e \"(org-capture)\" -n"</p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>else</b> <b>if</b> </span>interactiveCapture<span style="color: black;"> <b>is</b> </span><span style="color: #6c05d3; text-decoration: underline;"><i>false</i></span><span style="color: black;"> <b>then</b></span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">myCaptureCommand</span> <b>to</b> <span style="color: #408000;">myEmacsclient</span> & " \"org-protocol://capture?template=" & <span style="color: #408000;">myTemplateKey</span> & <span style="color: #408000;">myTemplateBody</span> & "\""</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><b>end</b> <b>if</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># Here, I make sure that Emacs is in front of me.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># If Emacs is not launched, it is now launched, which is important, </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># because my setting also starts emacs-server, without which I could not </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># use emacsclient.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: red; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">myEmacsComesForward<span style="color: black;">()</span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># And last but not least, the org-protocol command is sent to the </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># shell, and with Emacs at the front with the cursor waiting for me,</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"># I can start working right away in my capture buffer.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: red; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">myEmacsDoesSomething<span style="color: black;">(</span><span style="color: #408000;">myCaptureCommand</span><span style="color: black;">)</span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;">#############################################</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: red; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>on</b> </span>myEmacsComesForward<span style="color: black;">()</span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>try</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: blue;"><i>application</i></span> "System Events" <b>to</b> <b>tell</b> <span style="color: blue;"><i>process</i></span> "Emacs" <b>to</b> <b>set</b> <span style="color: #6c05d3; text-decoration: underline;">frontmost</span> <b>to</b> <span style="color: #6c05d3; text-decoration: underline;"><i>true</i></span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>on</b> <b>error</b></p><p style="color: blue; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> </span><i>application</i><span style="color: black;"> </span><span style="color: #408000;">myEmacs</span></p><p style="color: blue; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>try</b></p><p style="color: red; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>end</b> </span>myEmacsComesForward</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: red; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>on</b> </span>myEmacsDoesSomething<span style="color: black;">(</span><span style="color: #408000;">myCaptureCommand</span><span style="color: black;">)</span></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>try</b></p><p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0016b0; text-decoration: underline;"><b>do shell script</b></span><span style="color: black;"> </span>myCaptureCommand</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>on</b> <b>error</b></p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue; text-decoration: underline;"><b>log</b></span> "Emacs au premier plan"</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>try</b></p><p style="color: red; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; margin: 0px;"><span style="color: black;"><b>end</b> </span>myEmacsDoesSomething</p><div><br /></div>
<p></p><p></p><p></p><p></p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-50400978148744712682022-11-13T18:07:00.005+09:002022-11-13T18:44:57.484+09:00New Capture app, with org-protocol this time.<div>
<p style="font-family: verdana;">Just about 5 years ago, I wrote a <a href="https://mac4translators.blogspot.com/2017/11/capture-really-everywhere.html">Capture (really) everywhere</a> article where I described a simple AppleScript application that could be launched from Spotlight and that would call <i>org-capture</i> in a running instance of Emacs.</p>
<p style="font-family: verdana;">I had a really nice time with that app, until sandboxing became stricter, and it became difficult to reliably control applications with keystrokes sent from System Events.</p>
<p style="font-family: verdana;">I eventually rewrote the application, and it basically became a simple call to emacsclient:</p><p style="font-family: verdana;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myCaptureCommand</span> <b>to</b> <span style="color: #408000;">myEmacsclient</span> & " -e \"(org-capture)\" -n"</p>
<p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: #0016b0; text-decoration: underline;"><b>do shell script</b></span><span style="color: black;"> </span>myCaptureCommand</p><p style="font-family: verdana;"><br /></p><p style="font-family: verdana;">Here again, the app worked well, and I could enjoy spending time crafting org-capture templates, like everyone else does when not capturing things.</p>
<p style="font-family: verdana;">Then, it occurred to me that instead of</p>
<ul style="font-family: verdana;">
<li>calling Spotlight,</li>
<li>calling >Capture.app,</li>
<li>hitting the template key in Emacs,</li>
<li>capture my things,</li>
</ul>
<p style="font-family: verdana;">I could create specialized little apps that would call a given template that I often use. Like the "fait" (<i>done</i>) template that I use a number of times during the day to write down what I've accomplished so far.</p><p style="font-family: verdana;"><br /></p><p style="font-family: verdana;">I started investigating in that direction, trying to use various org-capture options, but I could not make it work. Then I found a number of interesting articles that helped me figure out my new solution: </p>
<ul style="font-family: verdana;">
<li><a href="https://sleeplessbeastie.eu/2016/04/22/how-to-use-org-capture-from-system-tray/">How to use org-capture from system tray</a> (2016)</li>
<li><a href="https://www.lazymalloc.com/posts/2022/some-uses-for-org-protocol/">Some Uses for Org-Protocol</a> (2022)</li>
<li><a href="https://orgmode.org/manual/The-capture-protocol.html">The capture protocol</a> (the org-mode manual)</li>
</ul>
<p style="font-family: verdana;">When I read that I could use the org-protocol to set the template key, I immediately thought that I could implement a little interactive template selector in AppleScript that would automatically put me in the right capture buffer.</p>
<p style="font-family: verdana;">And that's what I've been doing today, and I'll properly document that in my daily log, with that application, when I'm done with this article...</p><p style="font-family: verdana;"><br /></p><p style="font-family: verdana;">So, first, here is the app. It's just out of the oven, it works, I've not tested it extensively, so there might be glitches here and there, but it looks OK.</p><p style="font-family: verdana;">The main difference is that I'm using emacsclient to work with <i>org-protocol</i> here, instead of having it evaluate a call to <span style="font-family: Verdana;"><i>(org-capture)</i>.</span></p><p style="font-family: verdana;"><span style="font-family: Verdana;">When I call it, it displays the following list item selector:</span></p><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Verdana;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9z4Nxx2aqXzutjj_0m0DyO1bGZOvT-vLfGWoU6TkdRByIqHwJkhTCVUVhfQUxC-TZG2ysg8EcPTDRLHHhlyVJRZsUbdSWiNAIgb8nDflLskqqcys3nq1Ul8TpnYYrhBHUfI11-wdnaZGrchXBqkIJyQcjvfDq8UhPfgQBLXbwWpEe04VErOVG_LQstA/s904/Screen%20Shot%202022-11-13%20at%2018.10.08.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="684" data-original-width="904" height="242" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9z4Nxx2aqXzutjj_0m0DyO1bGZOvT-vLfGWoU6TkdRByIqHwJkhTCVUVhfQUxC-TZG2ysg8EcPTDRLHHhlyVJRZsUbdSWiNAIgb8nDflLskqqcys3nq1Ul8TpnYYrhBHUfI11-wdnaZGrchXBqkIJyQcjvfDq8UhPfgQBLXbwWpEe04VErOVG_LQstA/s320/Screen%20Shot%202022-11-13%20at%2018.10.08.png" width="320" /></a></span></div><p></p><p style="font-family: verdana;"><span style="font-family: Verdana;">If I have copied something from a document on my machine, the copied contents will be used in the headline for "dictionnaire":</span></p><p></p><div class="separator" style="clear: both; font-family: verdana; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvRvNZwDGHAzqG62-8H7Ex05DXdDAS5PdzUzJ4EbvqHptOyQe4pEJrZ0U1rp4izoGodBQgF7PTmnuZp23XepjRUgMV72HKPg5siYs9zcShC2Wome8ILmqP9ohEImAYvstErK5xhXHsij3w_6UybwUVvzhicJ0Yrbzv1SB6DjfMeEECEfNTrfNbJ2-nBA/s434/Screen%20Shot%202022-11-13%20at%2018.21.09.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="188" data-original-width="434" height="139" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvRvNZwDGHAzqG62-8H7Ex05DXdDAS5PdzUzJ4EbvqHptOyQe4pEJrZ0U1rp4izoGodBQgF7PTmnuZp23XepjRUgMV72HKPg5siYs9zcShC2Wome8ILmqP9ohEImAYvstErK5xhXHsij3w_6UybwUVvzhicJ0Yrbzv1SB6DjfMeEECEfNTrfNbJ2-nBA/s320/Screen%20Shot%202022-11-13%20at%2018.21.09.png" width="320" /></a></div><span style="font-family: Verdana;">Here, I had copied "統一教会" from an article I was reading, to gather notes about the organisation.</span><p></p><p><span style="font-family: Verdana;">And the copied contents will be used in the body of the capture buffer if I selected "notes":</span></p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpbh3Mn2uF5ZDNTM-SK9OH5Kgv8oPuphrBnZwNmOOToYr2ONCUcD5w0MF_5SAgUPbi5bQ3V1sc3AiCupUbNMlUwDqv2FbrNu9MOOslyhCkh-iYZTtaKcpnx9QAWkK4PWZMoZL-l95_Z-iAOdGY1ktppz1_cxMHUi6Z78ybpoBmCj7RFfRVIU8NbTpyZA/s604/Screen%20Shot%202022-11-13%20at%2018.31.21.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="298" data-original-width="604" height="158" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpbh3Mn2uF5ZDNTM-SK9OH5Kgv8oPuphrBnZwNmOOToYr2ONCUcD5w0MF_5SAgUPbi5bQ3V1sc3AiCupUbNMlUwDqv2FbrNu9MOOslyhCkh-iYZTtaKcpnx9QAWkK4PWZMoZL-l95_Z-iAOdGY1ktppz1_cxMHUi6Z78ybpoBmCj7RFfRVIU8NbTpyZA/s320/Screen%20Shot%202022-11-13%20at%2018.31.21.png" width="320" /></a></div><p style="font-family: verdana;"><span style="font-family: Verdana;">Here, it is a short article about 伊藤詩織 and her recent win in court. Now I just have to put a title and eventually write more about the item.</span></p><p style="font-family: verdana;"><span style="font-family: Verdana;"><br /></span></p><p style="font-family: verdana;"><span style="font-family: Verdana;">As usual, the explanations come as comments in the AppleScript code so that you can just copy-paste the thing and test it. Although in this case, there are many things that depend on my setup that I doubt it would work out of the box.</span></p><p style="font-family: verdana;"><span style="font-family: Verdana;"><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e;">#########</span></span><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e; font-family: Verdana;">#########</span><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e; font-family: Verdana;">#########</span><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e; font-family: Verdana;">#########</span></p>
</div>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>use</b> </span><span style="color: #6c05d3; text-decoration: underline;">AppleScript</span><span style="color: black;"> </span><span style="color: blue;">version</span><span style="color: black;"> "2.4" </span>-- Yosemite (10.10) or later</p>
<p style="color: blue; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>use</b> </span><i>scripting additions</i></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>use</b> <span style="color: blue;"><i>framework</i></span> "Foundation"</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># First, I'll be using the Foundation framework because otherwise it<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># would be non-trivial to find "the index of a given item in my list".<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># And for that I'll just need to use NSArrays. I did not figure that out<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># by myself, I found the hint on stackoverflow.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># reference: https://stackoverflow.com/a/65690139/5511978</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>property</b> <span style="color: #408000;">NSArray</span> : <span style="color: blue;"><i>class</i></span> "NSArray"</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Then, I'm setting my paths to Emacs and emacsclient.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Change the values to something that works for you.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myEmacs</span> <b>to</b> "/path/to/Emacs.app"</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myEmacsclient</span> <b>to</b> "/path/Emacs.app/Contents/MacOS/bin/emacsclient"</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Here, I create the list of template items I want to quickly access. I<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># have many more, but the others are more about long-form writing, so I<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># figured I'd be facing Emacs when I need to access them.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># </p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># This list is basically "todo", "done", "dictionary", "notes" and<span class="Apple-converted-space"> </span>"drafts".</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># </p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Then I transform that into a Foundation array</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myList</span> <b>to</b> {"à faire", "fait", "dictionnaire", "notes", "brouillon"}</p>
<p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>set</b> </span>myArray<span style="color: black;"> <b>to</b> </span>NSArray's<span style="color: black;"> </span><span style="color: red;">arrayWithArray</span><span style="color: black;">:</span>myList</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Here are the template keys that I use in my Emacs interactive capture<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># template.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Their order corresponds to the order of the above list items.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myKeys</span> <b>to</b> {"a", "f", "d", "n", "b"}</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Now comes the interactive item selection window. That's the thing<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># that's apparently called when I call the app. All the rest takes place<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># behind the scenes.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># That's the thing that you see above in the first screenshot.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># </p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># I can hit the first letter of any item for it to be selected, then I<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># hit Enter to simulate clicking on OK.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #0016b0; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>set</b> </span><span style="color: #408000;">captureChoice</span><span style="color: black;"> <b>to</b> </span><span style="color: blue;"><i>item</i></span><span style="color: black;"> 1 <b>of</b> (</span><span style="text-decoration: underline;"><b>choose from list</b></span><span style="color: black;"> </span><span style="color: #408000;">myList</span><span style="color: black;"> </span>with title<span style="color: black;"> "Capture" </span>default items<span style="color: black;"> "fait" </span>with prompt<span style="color: black;"> "Choix")</span></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Here comes the place where I need Foundation's arrays.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># </p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Basically, the line says "You just selected something, find its index in the<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># list where it belongs, and get me the letter that has the same index<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># in the <span style="caret-color: rgb(64, 128, 0); color: #408000;">myKeys</span> list."</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>set</b> </span>myTemplateKey<span style="color: black;"> <b>to</b> </span><span style="color: blue;"><i>item</i></span><span style="color: black;"> ((</span>myArray's<span style="color: black;"> </span><span style="color: red;">indexOfObject</span><span style="color: black;">:</span>captureChoice<span style="color: black;">) + 1) <b>of</b> </span>myKeys</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># For 2 items, "dictionnaire" and "notes", I'm thinking that I'll<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># probably have found something in a document that I'm reading, I'll need</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># to copy<span class="Apple-converted-space"> </span>it for use later on in the capture buffer.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># </p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># In the case of "dictionary", it's a word that I want to check, and I'll<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># use that as the title of the captured item.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># </p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># In the case of "notes", it's probably a sentence, or a paragraph that<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># I want to keep in the body of a captured item.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># I won't use the selection for the other items.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># For that, I'll put the selection (<span style="color: #0016b0; text-decoration: underline;"><b>the clipboard</b></span>) into the &body part of</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># the org-protocol command.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><b>set</b> </span><span style="color: #408000;">myTemplateBody</span><span style="color: black;"> <b>to</b> ""</span></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>if</b> <span style="color: #408000;">myTemplateKey</span> <b>is</b> <b>in</b> {"d", "n"} <b>then</b></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">myTemplateBody</span> <b>to</b> "&body=" & (<span style="color: #0016b0; text-decoration: underline;"><b>the clipboard</b></span>)</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>end</b> <b>if</b></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># The &body part, though, is not super clearly explained in the </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># org-mode manual:</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># <span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>%i <span class="Apple-converted-space"> </span>The selected text</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Basically, the value of &body is the contents of %i in the capture template.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># I don't know why the manual mentions "the selected text" since you can put</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># whatever you want in &body.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># In my templates, I've used it this way:</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>("n" "choses à noter</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="font-family: "Lucida Grande"; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px 'Lucida Grande'; line-height: normal;">→</span> notes | à lire | code | inspiration" entry (file "~/org/memo.org")</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>"* [%u] <span class="Apple-converted-space"> </span>%?\n<b>%i</b>" :empty-lines 0 :unnarrowed nil)</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Here, <b>%i</b>, the contents of the clipboard, will be inserted in the body </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># of the capture buffer, under the headline (notice the "<b>\n</b>"). And the cursor</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># (<b>%?</b>) is waiting for me inside the headline.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># or:</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>("d" "Dictionnaire" entry (file+datetree "/Users/suzume/org/dico.org")</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>"* [%<%H:%M>] <b>%i</b>\n%?" :empty-lines 0 :unnarrowed nil)</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># where <b>%i</b> will be inside the headline and the body of the capture </p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># (supposedly the term definition) will come after the line-break, where</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># the cursor is waiting for my input (<b>%?</b>).</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p><p style="font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Et voilà !</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># The org-protocol command can be built, and sent to emacsclient:</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>set</b> <span style="color: #408000;">myOrgProtocolCommand</span> <b>to</b> <span style="color: #408000;">myEmacsclient</span> & " \"org-protocol://capture?template=" & <span style="color: #408000;">myTemplateKey</span> & <span style="color: #408000;">myTemplateBody</span> & "\""</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># Here, I make sure that Emacs is in front of me.</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># </p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># If Emacs is not launched yet, it is now launched, which is important,<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># because my setting also starts emacs-server, without which I could not<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># use emacsclient.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>try</b></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: blue;"><i>application</i></span> "System Events" <b>to</b> <b>tell</b> <span style="color: blue;"><i>process</i></span> "Emacs" <b>to</b> <b>set</b> <span style="color: #6c05d3; text-decoration: underline;">frontmost</span> <b>to</b> <span style="color: #6c05d3; text-decoration: underline;"><i>true</i></span></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>on</b> <b>error</b></p>
<p style="color: blue; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> </span><i>application</i><span style="color: black;"> </span><span style="color: #408000;">myEmacs</span></p>
<p style="color: blue; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>end</b> <b>try</b></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># And last but not least, the org-protocol command is sent to the<span class="Apple-converted-space"> </span></p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># shell, and with Emacs at the front with the cursor waiting for me,</p><p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"># I can start working right away in my capture buffer.</p>
<p style="color: #1d1e1e; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;">#########</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px; min-height: 17px;"><br /></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>try</b></p>
<p style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0016b0; text-decoration: underline;"><b>do shell script</b></span><span style="color: black;"> </span>myOrgProtocolCommand</p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>on</b> <b>error</b></p>
<p style="color: #0016b0; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>display alert</b></span><span style="color: black;"> "ooops"</span></p>
<p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b>end</b> <b>try</b></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><b><br /></b></p><p style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; font-style: normal; font-variant-caps: normal; font-weight: normal; font: 14.0px Verdana; line-height: normal; margin: 0px;"><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e;">#########</span><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e;">#########</span><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e;">#########</span><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e;">#########</span><span style="caret-color: rgb(29, 30, 30); color: #1d1e1e;">#########</span></p>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-29820804592046845392021-12-19T16:43:00.005+09:002023-04-14T16:26:42.835+09:00TextEdit to TMX!!!<p><span style="font-family: helvetica;">April 14 2023: the script has been updated to fasten the array process by using Shane Stanley's Bridgeplus.</span></p><hr /><p><span style="font-family: helvetica;">I've just adapted my 'Excel to TMX' script so that it works with a number of files opened in TextEdit windows instead.</span></p>
<p><a href="https://github.com/brandelune/OmegaT-things"><span style="font-family: helvetica;">https://github.com/brandelune/OmegaT-things</span></a></p>
<h3><span style="font-family: helvetica; font-size: small;">Use case:</span></h3>
<ul>
<li><span style="font-family: helvetica;">you have contents in a number of languages, and the contents are aligned (i.e. each line is a language variation of the lines at the same position in the other files)</span></li>
<li><span style="font-family: helvetica;">you want to use all that in OmegaT, or any other TMX supporting tool</span></li>
<li><span style="font-family: helvetica;">so you want to glue all that into a nice and simple TMX</span></li>
<li><span style="font-family: helvetica;">but you also don't want to use Excel, because it's too cumbersome, or because the data has quotation marks that Excel interprets as </span></li>
</ul>
<h3><span style="font-family: helvetica; font-size: small;">Solution:</span></h3>
<ol>
<li><span style="font-family: helvetica;">Copy one language content in a file, the other language in another file (in a different window), etc. The documents do not have to be saved or named. Just create new windows as necessary and paste your contents.</span></li>
<li><span style="font-family: helvetica;">Run the script</span></li>
<li><span style="font-family: helvetica;">It will ask you for the language of the contents in the first window, then in the second window, etc.</span><div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhWQgsbK6J0agQdFuCB0fYaFjt_cJCgqDLlwjIDeta-gsWuikdVu2f2UjqmEfztG_Q1BlXptKOgkjIeoAwfof5otT2D3MCBgCDI7LwH2Il8P_zwJGIPAuJ_C-PdJz6lZBDmSyoPIgzzyIdbIZEGiwhtKJsebpSWNOpKsfEDE1uV2lRBp6ZcGJuyoOYBqA=s1064" style="display: block; padding: 1em 0px; text-align: center;"><span style="font-family: helvetica;"><img alt="" border="0" data-original-height="552" data-original-width="1064" src="https://blogger.googleusercontent.com/img/a/AVvXsEhWQgsbK6J0agQdFuCB0fYaFjt_cJCgqDLlwjIDeta-gsWuikdVu2f2UjqmEfztG_Q1BlXptKOgkjIeoAwfof5otT2D3MCBgCDI7LwH2Il8P_zwJGIPAuJ_C-PdJz6lZBDmSyoPIgzzyIdbIZEGiwhtKJsebpSWNOpKsfEDE1uV2lRBp6ZcGJuyoOYBqA=s320" width="320" /></span></a></div></li>
<li><span style="font-family: helvetica;">Use valid TMX language codes there, because the strings you enter will be the ones used in the TMX</span></li>
<li><span style="font-family: helvetica;">The script displays a progression dialog, </span><div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgrlw8jwZU8OKyzwl7D2B26F2ZaCDCe8-RtsK2_IqxowKHD-yNLZUN8kVusuKmoT5QUMwRY6kKQ0FngwRQiE6i9aK-TjOgQj04kr3sZmmKoJgTgMm6V66yydMVfYWo1Gj1SJPuwQHcOO2-89UQKgmF06KaME6WDStSUAsO67hq_TaDtNuJ-1C18F1992Q=s944" style="display: block; padding: 1em 0px; text-align: center;"><span style="font-family: helvetica;"><img alt="" border="0" data-original-height="398" data-original-width="944" src="https://blogger.googleusercontent.com/img/a/AVvXsEgrlw8jwZU8OKyzwl7D2B26F2ZaCDCe8-RtsK2_IqxowKHD-yNLZUN8kVusuKmoT5QUMwRY6kKQ0FngwRQiE6i9aK-TjOgQj04kr3sZmmKoJgTgMm6V66yydMVfYWo1Gj1SJPuwQHcOO2-89UQKgmF06KaME6WDStSUAsO67hq_TaDtNuJ-1C18F1992Q=s320" width="320" /></span></a></div><span style="font-family: helvetica;">and at the end, boom, the TMX is created on your Desktop with a timely name like this: TextEdit2tmx_20211219T071214Z.tmx</span><div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhqm5BCTsvCvMC5iJqAkcqShW-la1qfWRSJ9b8uRVaGErFq3QzldoDBmoM7Ri6tAsdiyRRXTcAm0CluzzpyL6BZXsbalg5rBQDuv9zUx2h0qAwR8oIdOrSlqC444fJRmvYNrZiXVaqshWcPqpmkeFZnefweGHSw0JKgwWw7aNGSzGUHqvHp9J59MJfoRg=s542" style="display: block; padding: 1em 0px; text-align: center;"><span style="font-family: helvetica;"><img alt="" border="0" data-original-height="524" data-original-width="542" src="https://blogger.googleusercontent.com/img/a/AVvXsEhqm5BCTsvCvMC5iJqAkcqShW-la1qfWRSJ9b8uRVaGErFq3QzldoDBmoM7Ri6tAsdiyRRXTcAm0CluzzpyL6BZXsbalg5rBQDuv9zUx2h0qAwR8oIdOrSlqC444fJRmvYNrZiXVaqshWcPqpmkeFZnefweGHSw0JKgwWw7aNGSzGUHqvHp9J59MJfoRg=s320" width="320" /></span></a></div></li>
</ol>
<p><span style="font-family: helvetica;">I've run it with ~ 500 segments in 2 windows (2 languages) and it took me about 5 seconds to create the TMX. It does not really seem to matter how many characters there are in the documents. What seems to matter is the number of lines (segments), and windows.</span></p>
<p><span style="font-family: helvetica;">Also, the segmentation is exactly one segment per line. So you just create a TMX from contents that's segmented and you know is aligned.</span></p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-46597029383620748682021-10-02T11:30:00.003+09:002023-05-06T09:22:11.486+09:00"OmegaT Code Reading Sessions", Part 4 !<span style="font-family: helvetica;">Are you scared of being bored today ?
</span><p><span style="font-family: helvetica;">The "OmegaT Code Reading Sessions" offer an exciting opportunity to spend one hour of your life trying to make sense of OmegaT's Java code…
</span></p><p><span style="font-family: helvetica;">Today is the 4th session. It will take place somewhere on a Jitsi instance, at 9pm Tokyo Time.
</span></p><p><span style="font-family: helvetica;">It's nicer (but not required) if:
</span></p><ul>
<li><span style="font-family: helvetica;">you're interested in OmegaT
</span></li><li><span style="font-family: helvetica;">you're not scared of reading code, even if that does not make any sense to your current self
</span></li></ul>
<p><span style="font-family: helvetica;">You still want to join ?
</span></p><ul>
<li><span style="font-family: helvetica;">Take a look at this document:
<br /> <a href="https://sr.ht/~brandelune/omegat-as-a-book/">https://sr.ht/~brandelune/omegat-as-a-book/</a>
</span></li><li><span style="font-family: helvetica;">Take a look at what we've done so far:
<br /> <a href="https://man.sr.ht/~brandelune/omegat-as-a-book/#omegat-as-a-book">https://man.sr.ht/~brandelune/omegat-as-a-book/#omegat-as-a-book</a>
</span></li><li><span style="font-family: helvetica;">Subscribe to the (super low traffic) mailing list where I'll post the link:
<br /> <a href="https://lists.sr.ht/~brandelune/omegat-as-a-book">https://lists.sr.ht/~brandelune/omegat-as-a-book</a></span>
</li></ul><p></p><p></p><p></p><p></p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-68739272315111994782021-09-16T17:06:00.002+09:002023-05-06T09:24:42.530+09:00Export your Numbers file to a PDF in the same folder <style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; color: #000000}
font.f1 {color: #000000}
font.f2 {color: #6c05d3}
font.f3 {color: #0000ff}
font.f4 {color: #1d1e1e}
font.f5 {color: #408000}
font.f6 {color: #0016b0}
font.f7 {color: #4415b0}
</style>
<p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><b>use</b> </span><span style="color: #6c05d3; font-variant-ligatures: no-common-ligatures; text-decoration: underline;">AppleScript</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;">version</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> "2.4" </span><span style="font-variant-ligatures: no-common-ligatures;">-- Yosemite (10.10) or later</span></p><p style="color: blue; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><b>use</b> </span><span style="font-variant-ligatures: no-common-ligatures;"><i>scripting additions</i></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>property</b> </span><span style="color: #408000; font-variant-ligatures: no-common-ligatures;">alert_exists</span><span style="font-variant-ligatures: no-common-ligatures;"> : "The PDF already exists. Continue?"</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>property</b> </span><span style="color: #408000; font-variant-ligatures: no-common-ligatures;">dialog_yes</span><span style="font-variant-ligatures: no-common-ligatures;"> : "Yes"</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>property</b> </span><span style="color: #408000; font-variant-ligatures: no-common-ligatures;">dialog_no</span><span style="font-variant-ligatures: no-common-ligatures;"> : "No"</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>property</b> </span><span style="color: #408000; font-variant-ligatures: no-common-ligatures;">export_complete</span><span style="font-variant-ligatures: no-common-ligatures;"> : "The PDF has been exported"</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># this script exports a PDF of the frontmost Numbers file</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># the Numbers file is saved before export to make sure that it exists</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># the PDF file is exported to the same folder as the original file</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># if the name of the original is myName.numbers, the PDF name is myName.pdf</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># if the PDF already exists it is possible to cancel the export</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># once the export is completed, Numbers displays an alert</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># and Finder opens the enclosing folder</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>tell</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "Numbers"</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures;"># this script exports a PDF of the frontmost Numbers file</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="color: #408000; font-variant-ligatures: no-common-ligatures;">myDocument</span><span style="font-variant-ligatures: no-common-ligatures;"> <b>to</b> (</span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>item</i></span><span style="font-variant-ligatures: no-common-ligatures;"> 1 <b>of</b> (</span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>document</i></span><span style="font-variant-ligatures: no-common-ligatures;"> <b>of</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>windows</i></span><span style="font-variant-ligatures: no-common-ligatures;"> <b>whose</b> </span><span style="color: #6c05d3; font-variant-ligatures: no-common-ligatures; text-decoration: underline;">index</span><span style="font-variant-ligatures: no-common-ligatures;"> <b>is</b> 1))</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures;"># the file is saved before export to make sure that it exists</span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: blue; font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>save</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocument</span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocumentName</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>to</b> </span><span style="color: #6c05d3; font-variant-ligatures: no-common-ligatures; text-decoration: underline;">name</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>of</b> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocument</span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocumentPath</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>to</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>file</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>of</b> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocument</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>as</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>text</i></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>end</b> <b>tell</b></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>tell</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "Finder"</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures;"># the PDF file is exported to the same folder as the original file</span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocumentContainer</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>to</b> (</span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>container</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>of</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>file</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocumentPath</span><span style="color: black; font-variant-ligatures: no-common-ligatures;">) <b>as</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>text</i></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>end</b> <b>tell</b></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># if the name of the original is myName.numbers, the PDF name is myName.pdf</span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><b>set</b> </span><span style="font-variant-ligatures: no-common-ligatures;">myExportedPDF</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>to</b> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocumentContainer</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> & </span><span style="font-variant-ligatures: no-common-ligatures;">myDocumentName</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> & ".pdf"</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>tell</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "System Events"</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures;"># if the PDF already exists it is possible to cancel the export</span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>if</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>exists</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>file</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">myExportedPDF</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>then</b></span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 145.7px; text-indent: -145.7px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0016b0; font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>display alert</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">alert_exists</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="color: #0016b0; font-variant-ligatures: no-common-ligatures;">as</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="color: #4415b0; font-variant-ligatures: no-common-ligatures;"><i>warning</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="color: #0016b0; font-variant-ligatures: no-common-ligatures;">buttons</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> {</span><span style="font-variant-ligatures: no-common-ligatures;">dialog_yes</span><span style="color: black; font-variant-ligatures: no-common-ligatures;">, </span><span style="font-variant-ligatures: no-common-ligatures;">dialog_no</span><span style="color: black; font-variant-ligatures: no-common-ligatures;">} </span><span style="color: #0016b0; font-variant-ligatures: no-common-ligatures;">cancel button</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">dialog_no</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>if</b></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>end</b> <b>tell</b></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>tell</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "Numbers"</span></p><p style="color: #0016b0; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span>(</span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>close access</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> (</span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>open for access</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> (</span><span style="color: #408000; font-variant-ligatures: no-common-ligatures;">myExportedPDF</span><span style="color: black; font-variant-ligatures: no-common-ligatures;">)))</span></p><p style="color: blue; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>export</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="color: #408000; font-variant-ligatures: no-common-ligatures;">myDocument</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">to</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;"><i>file</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="color: #408000; font-variant-ligatures: no-common-ligatures;">myExportedPDF</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">as</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="color: #6c05d3; font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><i>PDF</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">with properties</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> {</span><span style="color: #6c05d3; font-variant-ligatures: no-common-ligatures; text-decoration: underline;">image quality</span><span style="color: black; font-variant-ligatures: no-common-ligatures;">:</span><span style="color: #6c05d3; font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><i>Best</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;">}</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures;"># once the export is completed, Numbers displays an alert</span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0016b0; font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>display alert</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">export_complete</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>end</b> <b>tell</b></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>tell</b> </span><span style="color: blue; font-variant-ligatures: no-common-ligatures;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "Finder"</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures;"># and Finder opens the enclosing folder</span></p><p style="color: blue; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>activate</b></span></p><p style="color: #408000; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 97.1px; text-indent: -97.2px;"><span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: blue; font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>open</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures;">myDocumentContainer</span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"><b>end</b> <b>tell</b></span></p><p style="font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"></span><br /></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># here again, save this script as an Application, with a funny name</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># so that you can easily call with with Spotlight</span></p><p style="color: #1d1e1e; font-family: Verdana; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; text-indent: -48.6px;"><span style="font-variant-ligatures: no-common-ligatures;"># I chose "> Numbers </span><span style="font-family: "Lucida Grande"; font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: no-common-ligatures; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal;">→</span><span style="font-variant-ligatures: no-common-ligatures;"> PDF"</span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><p style="font-feature-settings: normal; font-kerning: auto; font-optical-sizing: auto; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant-alternates: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-position: normal; font-variation-settings: normal; line-height: normal; margin: 0px 0px 0px 48.5px; min-height: 17px; text-indent: -48.6px;"><span style="font-family: verdana;"><span style="font-variant-ligatures: no-common-ligatures;"></span></span></p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-74825751970471913372021-09-07T12:11:00.041+09:002023-05-06T09:26:53.265+09:00Building "vanilla" emacs on macOS, with brew, and more...<style>
code {
color:rgb(28,6,13);
background-color:rgba(0,0,0,0.1);
border-radius: 5px;
padding: 2px;
}
p.toc {
color: green;
text-align: right;
}
</style>
<hr />
<h2 id="toc">Table of contents</h2>
<ol>
<li>Free software = build your software yourself <a href="#fs1"> → </a></li>
<li>Required dependencies for building emacs on macOS <a href="#deps1"> → </a></li>
<li>Extra dependencies that will add features to your emacs <a href="#deps2"> → </a></li>
<li>8 lines of instructions <a href="#8l"> → </a></li>
<li>emacs documentation <a href="#docs"> → </a></li>
<li>To use emacs from the command line <a href="#cl"> → </a></li>
<li>Updating the code requires 2 instructions <a href="#updates"> → </a></li>
<li>Free Software = you can write code and contribute <a href="#fs2"> → </a></li>
<li>References <a href="#refs"> → </a></li>
</ol>
<hr />
<h2 id="fs1">This is <em>Free Software</em>!</h2>
<p>Lots of people seem to wonder, "what is the best emacs for macOS"?</p>
<p>Their criteria for "best" being not always clear, the answer I systematically give is: "<quote>Clone the repository and build it yourself. This is <em><a href="https://www.gnu.org/philosophy/free-sw.html">free software</a></em>!</quote>"</p>
<p>Since I always forget the dependencies and the steps, this page is a memo for myself, and for curious people who want to try themselves.</p>
<p><strong>Note</strong>: I am not a programmer. I just follow instructions. There is nothing magic in the 8 instruction lines that follow. Before, or after you've cloned emacs, you can read the <code><a href="https://git.savannah.gnu.org/cgit/emacs.git/tree/INSTALL.REPO">INSTALL.REPO</a></code> file where basically everything I write here is found, along with the <code><a href="https://git.savannah.gnu.org/cgit/emacs.git/tree/README">README</a></code> and the <code><a href="https://git.savannah.gnu.org/cgit/emacs.git/tree/INSTALL">INSTALL</a></code> files where you'll find additional or redundant information. It's basically all there. I am not making this up.</p>
<p class="toc"><a href="#toc"> ToC </a></p>
<h2 id="deps1">Required dependencies</h2>
<p>The dependencies below are the minimum emacs requires, and you can find them by running <code>./autogen.sh</code> first and then <code>./configure</code> yourself <em>before</em> using brew to install them: the two scripts will just choke every time they don't find the required libraries.</p>
<p>What I did to come up with that list is just add dependencies until the scripts ran their course without error.</p>
<p>If this is your first "development" attempt, you will need the XCode command line tools, basically because you'll need <code>gcc</code> and <code>git</code> for the whole process.</p>
<p><code>brew</code> will prompt you about that during its install process, and even if that does not happen, the first time you run <code>git</code>, for example to clone emacs, macOS will tell you that you need to install them and prompt you with a nice dialog.</p>
<p>The required dependencies are the following:</p>
<ul>
<li><code><a href="https://www.gnu.org/software/autoconf/" title="Autoconf">Autoconf</a></code><br />
"Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages."</li>
<li><code><a href="https://www.gnu.org/software/texinfo/" title="texinfo">texinfo</a></code><br />
"Texinfo is the official documentation format of the GNU project."</li>
<li><code><a href="https://mailutils.org" title="mailutils">GNU Mailutils</a></code><br />
"Mailutils is a swiss army knife of electronic mail handling. It offers a rich set of utilities and daemons for processing e-mail."</li>
<li><code><a href="https://gnutls.org" title="gnutls">GnuTLS</a></code><br />
"GnuTLS is a secure communications library implementing the SSL, TLS and DTLS protocols and technologies around them."</li>
</ul>
<p class="toc"><a href="#toc"> ToC </a></p>
<h2 id="deps2">Extra dependencies</h2>
<p>I sent the link to this article to the <code>emacs-devel</code> mailing list for verification and Pankaj Jangid was nice enough to tell me about his own experiences and suggested a list of non-required but recommended packages that emacs would notice during the configuration process. Alan Third, the ns-port maintainer, also chimed in to indicate that some of Pankaj proposed libraries were in fact ignored since the image types they correspond to are handled by macOS proper.</p>
<p>The recomended dependencies are the following:</p>
<ul>
<li><code><a href="https://github.com/GNOME/librsvg" title="librsvg">librsvg</a></code><br />
"This is librsvg - A small library to render Scalable Vector Graphics (SVG), associated with the GNOME Project."</li>
<li><code><a href="https://github.com/winlibs/libxpm" title="libxpm">libxpm</a></code><br />
"X11 pixmap library"</li>
<li><code><a href="https://www.littlecms.com/tags/lcms2/" title="lcms2">lcms2</a></code><br />
"Little CMS intends to be a small-footprint color management engine, with special focus on accuracy and performance."</li>
<li><code><a href="https://digip.org/jansson/" title="jansson">jansson</a></code><br />
"Jansson is a C library for encoding, decoding and manipulating JSON data."</li>
</ul>
<p>If you want to install the above recommended dependencies, you'll need to add a <code>brew install</code> instruction as shown below.</p>
<p class="toc"><a href="#toc"> ToC </a></p>
<h2 id="8l">The instructions</h2>
<pre># install brew
# URL: https://brew.sh
<code>/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"</code>
# install required dependencies
# or jump to "configure, etc." below and install them one by one
<code>brew install autoconf texinfo gnutls mailutils</code>
# install recommended dependencies, but only after you've checked what they do by following the links above...
<code>brew install librsvg libxpm lcms2 jansson</code>
# clone emacs
# URL: https://savannah.gnu.org/projects/emacs
<code>git clone -b master git://git.sv.gnu.org/emacs.git</code>
# configure, build and install emacs
<code>cd emacs
./autogen.sh
./configure
make install
</code>
</pre>
<p>Et voilà! <code>Emacs.app</code> now resides in <code>emacs/nextstep/Emacs.app</code>.</p>
<p class="toc"><a href="#toc"> ToC </a></p>
<h2 id="docs">Documentation</h2>
<p>I don't suppose you'd want to install emacs from scratch without knowing how to use it, but if that's the case, and that's totally OK, emacs comes with thousands of pages of manuals that are just a <code>ctrl-h i</code> away.</p>
<p>That shortcut means hit the <code>control</code> key, hold it pressed, hit the <code>h</code> key, release both, and hit the <code>i</code> key. That shortcut calls the <code>info</code> function, which bring up the list of manuals included in emacs.</p>
<p>You can also start a tutorial with <code>ctrl-h t</code>, which means hit the <code>control</code> key, hold it pressed, hit the <code>h</code> key, release both, and hit the <code>t</code> key. That shortcut calls the <code>help-with-tutorial</code> function.
</p><p>The manuals are online, if you feel more confortable reading in a web browser: <a href="https://www.gnu.org/software/emacs/manual/" title="all the emacs related manuals">GNU Emacs Manuals Online</a></p>
<p class="toc"><a href="#toc"> ToC </a></p>
<h2 id="cl">A few extra settings</h2>
<p>If you need to use <code>emacs</code> from the command line you may need to update your <code>.profile</code> file with aliases like this:</p>
<pre><code>alias emacs='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/Emacs'
alias emacsclient='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/bin/emacsclient'
alias ctags='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/bin/ctags'
alias ebrowse='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/bin/ebrowse'
alias etags='path/to/emacs/nextstep/Emacs.app/Contents/MacOS/bin/etags'
</code>
</pre>
<p>and that's basically it.</p>
<p class="toc"><a href="#toc"> ToC </a></p>
<h2 id="updates">Updating the thing</h2>
<p>The first time you build emacs, along with installing all the dependencies, etc. might take some time, maybe a good 30 minutes, maybe more. But then, you end up with a configuration where you just need to update the code once in a while, and <code>make install</code> the thing again to have the latest version running.</p>
<p>Basically, all is needed is to run this:</p>
<pre># inside the cloned emacs directory
# update the code
<code>git pull</code>
# build and install the new version
<code>make install</code>
</pre>
<p>And the next time to start emacs, you run the lastest <code>master</code> branch code.</p>
<p class="toc"><a href="#toc"> ToC </a></p>
<h2 id="fs2">This it <em>Free Software</em>! 2</h2>
<p>The whole point of <em>Free Software</em> is that is gives you the tools necessary to understand what is going on, to learn how to do things yourself and to control your environement.</p>
<p>So, yes, emacs is free software, and now you're all set to play with the code and do your own thing, that will eventually lead to first contribute small things, and then bigger and bigger things to emacs proper.</p>
<p>For that, you just need to create your own development branch and code there:</p>
<pre># inside the cloned emacs directory
# update the code, just to have the latest one
<code>git pull</code>
# create your development/test branch, for example "myEmacs"
<code>git checkout -b myEmacs</code>
# open that new branch in Finder
<code>open .</code>
</pre>
<p>Everything you do there will never impact the <code>master</code> branch from which you have built emacs. You can always <code>git checkout master</code> back to go back to a clean slate (<code>git</code> will eventually ask you to <code>git stash</code> away your modifications before switching to <code>master</code>, so just follow the instructions).</p>
<p class="toc"><a href="#toc"> ToC </a></p>
<h2 id="refs">References</h2>
<p>Now, you may want to know a bit more about Emacs Lisp, about <code>git</code>, about how to contribute to emacs, so here are some references:</p>
<ul>
<li>The "Introduction to Programming in Emacs Lisp" is the entry point for Emacs Lisp development. It is available from inside emacs (type <code>ctrl-h i</code> to find the list of manuals available right at your finger tips) and also online: <br />
<a href="https://www.gnu.org/software/emacs/manual/eintr.html" title="your first steps in Emacs Lisp"></a>An Introduction to Programming in Emacs Lisp</li>
<li><code>git</code> comes with excellent documentation, and a free book too: <br />
<a href="https://git-scm.com/doc" title="the git documentation">Git Documentation</a></li>
<li>If you want to practice your Emacs Lisp skills, the "Exercism" site has a track for you: <br />
<a href="https://exercism.org/tracks/emacs-lisp" title="emacs lisp on exercism">Emacs Lisp on Exercism</a></li>
<li>You will quickly find that you need to have a good Emacs Lisp reference to go further. emacs provides you with an excellent reference for pretty much everything you need to know, here again, just a <code>ctrl-h i</code> away, but it is also online: <br />
<a href="https://www.gnu.org/software/emacs/manual/elisp.html" title="the emacs lisp reference, online"></a>GNU Emacs Lisp Reference Manual</li>
<li>If you need general help, there is a <code>help-gnu-emacs</code> list and for development help there is the <code>emacs-devel</code> list, along with a lot of other emacs related lists, hosted on the emacs development site: <br />
<a href="https://savannah.gnu.org/mail/?group=emacs" title="emacs related mailing lists">emacs - Mailing Lists</a></li>
<li>And here is a tutorial about the procedure to follow if you want to propose your code for inclusion into emacs, by Colin Woodbury: <br />
<a href="https://www.fosskers.ca/en/blog/contributing-to-emacs" title="contribution procedure tutorial">Contributing to Emacs</a></li>
</ul>
<p class="toc"><a href="#toc"> ToC </a></p><p></p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-65423005659086812182021-09-05T12:02:00.011+09:002023-05-06T09:29:00.388+09:00Everything you wanted to know about modifying application shortcuts, and more...<style>
code {
color:rgb(28,6,13);
background-color:rgba(0,0,0,0.1);
border-radius: 5px;
padding: 2px;
}
</style>
<h2><span style="font-size: small;">Modifying application shortcuts</span></h2>
<p>Or, how to spend two hours on your machine on a Sunday morning, when you could go take a walk instead...
</p><p>Here I talk about an itch I felt the need to scratch this morning, and about 2 applications: CheatSheet, and customShortcuts, and I put a lot of references at the end, so have fun reading!
</p><hr />
<p>You can change shortcuts in <code>System Preferences > Keyboard > Shortcuts > App Shortcuts</code>
</p><p>Most of the things you'll ever need to do can be done there.
</p><p>But then, some can't.
</p><p>This morning, I realized that in Mail.app, moving from <code>Delete</code> (<code>Cmd+Del</code>) to <code>Mark as Read</code> (<code>Shift+Cmd+U</code>) when I read and sort my mail, was not what I wanted.
</p><p>When I read my mail, there are obvious deletes, but a lot of my casual mail can just be <em>not read</em> (discussion lists, where only a few threads are interesting), or specifically marked for later reference. But moving from <code>Cmd+Del</code> to <code>Shift+Cmd+U</code> involves a lot of friction and I want to get rid of that.
</p><p>I want to have something like:
</p><ul>
<li><code>Cmd+Del</code> = <code>Mark as Read</code> (or <code>Mark as Unread</code>, depending on context)</li>
<li><code>Shift+Cmd+Del</code> = <code>Delete</code><br />
and since that one is taken by "<code>Erase Deleted Items > In All Accounts...</code>", which I never use, I'd move that item to
</li><li><code>Alt+Shift+Cmd+Del</code> = <code>Erase Deleted Items > In All Accounts...</code></li>
</ul>
<p>That way, I have my morning "mail discussion parsing" workflow all centered on <code>Del</code>, which is a Good Thing™.
</p><p>The problem is that the System Preference panel has its ideas on what can and cannot be done, and won't allow us to assign <code>Cmd+Del</code> to anything but <code>Delete</code>...
</p><p>I know there are solutions that give you access to key bindings data, things that are really interesting and let you dive into the intricacies of the OS, but I was not really in that mood this morning (I put all the references at the bottom, there is plenty to read and play with, when you have time).
</p><p>I remembered that there was an app that gives you all the shortcuts available in any given app (at least apps that live into the macOS GUI system, i.e. basically <em>anything</em> that has a real macOS menu at the top of the window, including Java apps like <a href="https://omegat.org">OmegaT</a>, Electron apps like <a href="https://www.maxprograms.com/products/tmxeditor.html">TMXEditor</a>, etc.), the app is "CheatSheet" and can be found here:
</p><p><a href="https://www.mediaatelier.com/CheatSheet/" title="www.mediaatelier.com">https://www.mediaatelier.com/CheatSheet/</a>
</p><p>Just out of renewed curiosity, I decided to take a peek, just in case...
</p><p>And there, behold! There is a link to that companion app: "CustomShortcuts" that (also) "works hand in hand with CheatSheet" by allowing you to edit shortcuts directly in the CheatSheet interface, which is pretty neat...
</p><p><a href="https://www.houdah.com/customShortcuts/" title="www.houdah.com">https://www.houdah.com/customShortcuts/</a>
</p><p>After a quick download and a few authorizations, I can now do what I wanted to do (assign <code>Cmd+Del</code> to <code>Mark as Read</code>, etc.), plus customShortcuts has autocompletion of menu item names, so you don't have to actually check the target application interface and worry about whether "<code>...</code>" is three dots, or an ellipsis… (← this thing).
</p><p>Et voilà, I've got my workflow fixed now, I can spend the rest of my Sunday with my heart at ease, and here are the references I promised:
</p><hr />
<h2><span style="font-size: small;">References</span></h2>
<ul>
<li>This URL seems to be a good summary of what you ought to know about what macOS gives you easy access to:<br />
<a href="https://www.howtogeek.com/209725/how-to-customize-your-os-x-keyboard-and-add-shortcuts/" title="www.howtogeek.com">https://www.howtogeek.com/209725/how-to-customize-your-os-x-keyboard-and-add-shortcuts/</a></li>
<li>This thread on reddit gives further advice for more involved modifications, like Automator, etc.:<br />
<a href="https://www.reddit.com/r/MacOS/comments/pfjae3/anyone_else_find_the_keybindings_lacking/" title="www.reddit.com">https://www.reddit.com/r/MacOS/comments/pfjae3/anyone_else_find_the_keybindings_lacking/</a></li>
<li>I love Xahlee's work in general and have bought his emacs and emacs lisp reference because it is so useful. His work on Mac keyboards is just as interesting:<br />
<a href="http://xahlee.info/kbd/Mac_OS_X_keymapping_keybinding_tools.html" title="xahlee.info">http://xahlee.info/kbd/Mac_OS_X_keymapping_keybinding_tools.html</a></li>
<li>ss64 is a site that I have known for a while, but that I mostly remembered for the keybindings reference it gives. The whole site is very interesting:<br />
<a href="https://ss64.com/osx/syntax-keybindings.html" title="ss64.com">https://ss64.com/osx/syntax-keybindings.html</a><br />
<a href="https://ss64.com/osx/syntax-keyboard.html" title="ss64.com">https://ss64.com/osx/syntax-keyboard.html</a></li>
<li>And there is this 2006 reference to customizing the Cocoa text system here, that "hard core reference" I mentioned above, that is also extremely interesting:<br />
<a href="https://www.hcs.harvard.edu/~jrus/Site/Cocoa%20Text%20System.html" title="www.hcs.harvard.edu">https://www.hcs.harvard.edu/~jrus/Site/Cocoa%20Text%20System.html</a></li>
<li>Last but not least, the two links below come from Apple's developer documentation:<br />
<a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html" title="developer.apple.com">https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html</a><br />
<a href="https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding?language=objc" title="developer.apple.com">https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding?language=objc</a></li>
</ul>
<h2><span style="font-size: small;">Post scriptum</span></h2>
<p>You may want to give CheatSheet a "longish" delay before appearing when you hit <code>Cmd</code>, because it gets tiring real quick to have it pop up while you think about the shortcut you actually want to hit while holding <code>Cmd</code>, which really happens all the time...
</p><p>In 2009, I had put together a similar thing on how to play with keybindings in the shell. It is here:<br />
<a href="https://mac4translators.blogspot.com/2009/03/bash-command-line-shortcuts.html">Bash (command line) shortcuts</a></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-46910565672872821402021-08-17T23:41:00.001+09:002021-08-18T00:40:52.557+09:00Finder selected files, or a scratchpad, in Emacs<font face="Verdana" color="#1d1e1e"># This script a huge improvement on my original script that appeared here<br />
<font face="Verdana" color="#1d1e1e"># about 3 years ago: <a href="https://mac4translators.blogspot.com/2018/07/open-file-in-your-editor-of-choice.html">Open a file in your editor of choice</a>.<br />
<br />
<font face="Verdana" color="#1d1e1e"># This script is a way to either</font><br />
<font face="Verdana" color="#1d1e1e"># • open in Emacs the files selected in Finder</font><br />
<font face="Verdana" color="#1d1e1e"># or</font><br />
<font face="Verdana" color="#1d1e1e"># • open a scratchpad in Emacs when you need to jot down information.</font><br />
<br />
<font face="Verdana" color="#1d1e1e"># The script can be adapted to work with any text editor.</font><br />
<br />
<font face="Verdana" color="#1d1e1e"># It tests whether Finder was front when the script was launched *and*</font><br />
<font face="Verdana" color="#1d1e1e"># whether it had selected files.</font><br />
<font face="Verdana" color="#1d1e1e"># If either is negative, it opens a scratchpad with a name that's set here.</font><br />
<font face="Verdana" color="#1d1e1e"># Otherwise is opens the files selected in Finder.</font><br />
<br />
<font face="Verdana" color="#1d1e1e"># Personal settings:</font><br />
<font face="Verdana" color="#1d1e1e"># Obviously, your Emacs.app file is located in a different place:</font><br />
<font face="Verdana" color="#000000"><b>set</b> </font><font face="Verdana" color="#408000">myEmacsAppPath</font><font face="Verdana" color="#000000"> <b>to</b> "/Users/******/Documents/Repositories/emacs/nextstep/"</font><br />
<font face="Verdana" color="#1d1e1e"># This is the name of the empty default Emacs buffer you want to open:</font><br />
<font face="Verdana" color="#000000"><b>set</b> </font><font face="Verdana" color="#408000">myScratchBufferName</font><font face="Verdana" color="#000000"> <b>to</b> "turlututu"</font><br />
<br />
<font face="Verdana" color="#1d1e1e"># This part is unlikely to change, it assumes that you use the emacsclient</font><br />
<font face="Verdana" color="#1d1e1e"># that corresponds to the selected Emacs.app. And that you run Emacs as a server.</font><br />
<font face="Verdana" color="#000000"><b>set</b> </font><font face="Verdana" color="#408000">myEmacsclient</font><font face="Verdana" color="#000000"> <b>to</b> </font><font face="Verdana" color="#408000">myEmacsAppPath</font><font face="Verdana" color="#000000"> & "Emacs.app/Contents/MacOS/bin/emacsclient"</font><br />
<font face="Verdana" color="#000000"><b>set</b> </font><font face="Verdana" color="#408000">myEmacsApp</font><font face="Verdana" color="#000000"> <b>to</b> </font><font face="Verdana" color="#408000">myEmacsAppPath</font><font face="Verdana" color="#000000"> & "Emacs.app"</font><br />
<br />
<font face="Verdana" color="#1d1e1e"># saved by: https://forum.latenightsw.com/t/how-an-applescript-applet-can-get-the-frontmost-application-other-than-itself/2482/7</font><br />
<font face="Verdana" color="#1d1e1e"># This makes sure that this script is not mistaken for the frontmost application.</font><br />
<font face="Verdana" color="#1d1e1e"># The delay works at 0.2 on my machine, 0.1 is not enough.</font><br /><br />
<font face="Verdana" color="#000000"><b>tell</b> </font><font face="Verdana" color="#0000ff"><i>application</i></font><font face="Verdana" color="#000000"> "System Events"</font><br />
<font face="Verdana" color="#000000"> <b>tell</b> (<b>first</b> </font><font face="Verdana" color="#0000ff"><i>application process</i></font><font face="Verdana" color="#000000"> <b>whose</b> </font><font face="Verdana" color="#6c05d3"><u>frontmost</u></font><font face="Verdana" color="#000000"> <b>is</b> </font><font face="Verdana" color="#6c05d3"><u><i>true</i></u></font><font face="Verdana" color="#000000">)</font><br />
<font face="Verdana" color="#000000"> <b>set</b> </font><font face="Verdana" color="#6c05d3"><u>frontmost</u></font><font face="Verdana" color="#000000"> <b>to</b> </font><font face="Verdana" color="#6c05d3"><u><i>false</i></u></font><br />
<font face="Verdana" color="#000000"> <b>set</b> </font><font face="Verdana" color="#6c05d3"><u>visible</u></font><font face="Verdana" color="#000000"> <b>of</b> <b>it</b> <b>to</b> </font><font face="Verdana" color="#6c05d3"><u><i>false</i></u></font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#0000ff"><u><b>delay</b></u></font><font face="Verdana" color="#000000"> 0.2</font><br />
<font face="Verdana" color="#000000"> <b>end</b> <b>tell</b></font><br />
<font face="Verdana" color="#000000"> <b>set</b> </font><font face="Verdana" color="#408000">previously_active_app</font><font face="Verdana" color="#000000"> <b>to</b> </font><font face="Verdana" color="#0000ff"><i>item</i></font><font face="Verdana" color="#000000"> 1 <b>of</b> (<b>get</b> </font><font face="Verdana" color="#6c05d3"><u>name</u></font><font face="Verdana" color="#000000"> <b>of</b> </font><font face="Verdana" color="#0000ff"><i>processes</i></font><font face="Verdana" color="#000000"> <b>whose</b> </font><font face="Verdana" color="#6c05d3"><u>frontmost</u></font><font face="Verdana" color="#000000"> <b>is</b> </font><font face="Verdana" color="#6c05d3"><u><i>true</i></u></font><font face="Verdana" color="#000000"> <b>and</b> </font><font face="Verdana" color="#6c05d3"><u>visible</u></font><font face="Verdana" color="#000000"> <b>is</b> </font><font face="Verdana" color="#6c05d3"><u><i>true</i></u></font><font face="Verdana" color="#000000">)</font><br />
<font face="Verdana" color="#000000"><b>end</b> <b>tell</b></font><br />
<br />
<font face="Verdana" color="#1d1e1e"># Now that we know whether Finder was previously front or not, we can put Emacs to the front.</font><br /><br />
<font face="Verdana" color="#000000"><b>try</b></font><br />
<font face="Verdana" color="#000000"> <b>tell</b> </font><font face="Verdana" color="#0000ff"><i>application</i></font><font face="Verdana" color="#000000"> "System Events" <b>to</b> <b>tell</b> </font><font face="Verdana" color="#0000ff"><i>process</i></font><font face="Verdana" color="#000000"> "Emacs" <b>to</b> <b>set</b> </font><font face="Verdana" color="#6c05d3"><u>frontmost</u></font><font face="Verdana" color="#000000"> <b>to</b> </font><font face="Verdana" color="#6c05d3"><u><i>true</i></u></font><br />
<font face="Verdana" color="#000000"><b>on</b> <b>error</b></font><br />
<font face="Verdana" color="#000000"> <b>tell</b> </font><font face="Verdana" color="#0000ff"><i>application</i></font><font face="Verdana" color="#000000"> </font><font face="Verdana" color="#408000">myEmacsApp</font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#0000ff"><u><b>activate</b></u></font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#0000ff"><u><b>delay</b></u></font><font face="Verdana" color="#000000"> 1</font><br />
<font face="Verdana" color="#000000"> <b>end</b> <b>tell</b></font><br />
<font face="Verdana" color="#000000"><b>end</b> <b>try</b></font><br />
<br />
<font face="Verdana" color="#1d1e1e"># The script's main logic is here.</font><br /><br />
<font face="Verdana" color="#000000"><b>if</b> </font><font face="Verdana" color="#408000">previously_active_app</font><font face="Verdana" color="#000000"> <b>is</b> "Finder" <b>then</b></font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># If Finder is the active application when the script is launched, either there is</font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># or there is no selection.</font><br />
<font face="Verdana" color="#000000"> <b>try</b></font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># This is the weird part. There are cases when there is no selection but the assignment</font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># is not considered an error, hence I test whether item 1 of the selection exists.</font><br />
<font face="Verdana" color="#000000"> <b>tell</b> </font><font face="Verdana" color="#0000ff"><i>application</i></font><font face="Verdana" color="#000000"> "Finder" <b>to</b> <b>set</b> </font><font face="Verdana" color="#408000">fileSelection</font><font face="Verdana" color="#000000"> <b>to</b> <b>its</b> </font><font face="Verdana" color="#6c05d3"><u>selection</u></font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#0000ff"><i>item</i></font><font face="Verdana" color="#000000"> 1 <b>of</b> </font><font face="Verdana" color="#408000">fileSelection</font><font face="Verdana" color="#000000"> </font><font face="Verdana" color="#0000ff"><u><b>exists</b></u></font><br />
<font face="Verdana" color="#000000"> <b>on</b> <b>error</b></font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># If item 1 of selection does not exist, there is no selection and the error branches out here.</font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># A scratchpad is opened in Emacs.</font><br />
<font face="Verdana" color="#000000"> <b>set</b> </font><font face="Verdana" color="#408000">myCommand</font><font face="Verdana" color="#000000"> <b>to</b> </font><font face="Verdana" color="#408000">myEmacsclient</font><font face="Verdana" color="#000000"> & " -n -e \"(switch-to-buffer \\\"" & </font><font face="Verdana" color="#408000">myScratchBufferName</font><font face="Verdana" color="#000000"> & "\\\")\""</font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#0016b0"><u><b>do shell script</b></u></font><font face="Verdana" color="#000000"> </font><font face="Verdana" color="#408000">myCommand</font><br />
<font face="Verdana" color="#000000"> <b>return</b></font><br />
<font face="Verdana" color="#000000"> <b>end</b> <b>try</b></font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># Now that we have checked for that non-selection error, we can work on the selection.</font><br />
<font face="Verdana" color="#000000"> <b>repeat</b> <b>with</b> </font><font face="Verdana" color="#408000">selectedFile</font><font face="Verdana" color="#000000"> <b>in</b> </font><font face="Verdana" color="#408000">fileSelection</font><br />
<font face="Verdana" color="#000000"> <b>set</b> </font><font face="Verdana" color="#408000">selectedFile</font><font face="Verdana" color="#000000"> <b>to</b> (</font><font face="Verdana" color="#6c05d3"><u>POSIX path</u></font><font face="Verdana" color="#000000"> <b>of</b> (</font><font face="Verdana" color="#408000">selectedFile</font><font face="Verdana" color="#000000"> <b>as</b> </font><font face="Verdana" color="#0000ff"><i>alias</i></font><font face="Verdana" color="#000000">))</font><br />
<font face="Verdana" color="#000000"> <b>set</b> </font><font face="Verdana" color="#408000">myCommand</font><font face="Verdana" color="#000000"> <b>to</b> </font><font face="Verdana" color="#408000">myEmacsclient</font><font face="Verdana" color="#000000"> & " -n -e \"(find-file " & "\\\"" & </font><font face="Verdana" color="#408000">selectedFile</font><font face="Verdana" color="#000000"> & "\\\"" & ")\""</font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#0016b0"><u><b>do shell script</b></u></font><font face="Verdana" color="#000000"> </font><font face="Verdana" color="#408000">myCommand</font><br />
<font face="Verdana" color="#000000"> <b>end</b> <b>repeat</b></font><br />
<font face="Verdana" color="#000000"> <b>return</b></font><br />
<font face="Verdana" color="#000000"><b>else</b></font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># And if Finder was not frontmost when the script was launched, then we just intended to</font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#1d1e1e"># open a scratchpad in Emacs.</font><br />
<font face="Verdana" color="#000000"> <b>set</b> </font><font face="Verdana" color="#408000">myCommand</font><font face="Verdana" color="#000000"> <b>to</b> </font><font face="Verdana" color="#408000">myEmacsclient</font><font face="Verdana" color="#000000"> & " -n -e \"(switch-to-buffer \\\"" & </font><font face="Verdana" color="#408000">myScratchBufferName</font><font face="Verdana" color="#000000"> & "\\\")\""</font><br />
<font face="Verdana" color="#000000"> </font><font face="Verdana" color="#0016b0"><u><b>do shell script</b></u></font><font face="Verdana" color="#000000"> </font><font face="Verdana" color="#408000">myCommand</font><br />
<font face="Verdana" color="#000000"> <b>return</b></font><br />
<font face="Verdana" color="#000000"><b>end</b> <b>if</b></font><br />
<br />
<font face="Verdana" color="#1d1e1e"># Et voilà.</font><br />
<font face="Verdana" color="#1d1e1e"># Now, save the script in the format that corresponds to the way you usually launch scripts.</font><br />
<font face="Verdana" color="#1d1e1e"># I prefer the "myAppScript.app" way so that I can launch my script by calling it from Spotlight.</font><br />
<font face="Verdana" color="#1d1e1e"># I call this one ">Emacs.app".</font><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-4357234447750673392021-06-05T14:20:00.012+09:002023-05-06T09:33:33.290+09:00emacs regex with emacs lisp<h3><span style="font-size: small;">June 28 update: using <code>\#1</code> instead of <code>(string-to-number \1)</code></span></h3>
<p>A reader on <a href="https://www.reddit.com/r/emacs/comments/o8x709/smarter_search_and_replace_already_builtin/">reddit</a> mentionned that the manual also had the "<code>\#d</code>" construct to replace the often used <code>(string-to-number \d)</code> function.</p>
<p>That regex-replace improvement was mentionned in Stevve Yegge's <a href="https://steve-yegge.blogspot.com/2006/06/">emacs 22</a> introduction, back in 2006.</p>
<p>Last but not least, I noticed that the whole post was originally written with <code>(string-as-number ...)</code> when the correct function name is <code>(string-to-number ...)</code></p>
<hr />
<p>Not strictly related to translation but here is what's happening...</p>
<p>I've resumed studies last year, trying to finish an MA in Japan Studies I started 25 years ago.</p>
<p>For the first year, I only have to write a 30ish pages dissertation on my subject (representation of women in kendo magazines in Japan) and I decided to go the <em>emacs + org-mode</em> way, with the easy export to ODF function that's packaged with the thing.</p>
<p>So I decided to write each chapter in a different org file, and send them one by one to my director. But then, for the final delivery I needed to put all that in one big file and was faced with the fact that all my footnotes would need to be re-indexed manually because each file had notes starting at <code>1</code>...</p>
<p>I usually use BBedit for any serious regex work. Mostly because the interface is clearer than emacs, and the regexp feels more modern (<code>\d</code> vs <code>[:digit:]</code>)</p>
<p>But one thing you can't do in BBEdit is to send commands to the replace string. For ex, in my case, add <code>21</code> to the matching number, which seems pretty trivial, when you think of it, but doing that will involve other technologies, like using perl or some other command line thing.</p>
<p>In emacs, however, everything can be interpreted as an expression, hence you can insert code wherever you want and get the result from that code right in the document.</p>
<p>The org-mode footnotes all look like <code>[fn:12]</code>, where "<code>12</code>" is the note number that I need to replace with an incremented number. Since there are no instances of <code>fn:\d+</code> without the brackets that are not footnotes, I figured I could just be searching for that string:</p>
<p><code>fn:\([:digit:]+\)</code></p>
<p>Notice that in emacs, "<code>(</code>" and "<code>)</code>" need to be escaped, also I could have used the <code>[0-9]</code> class.</p>
<p>In BBedit I'd just need:</p>
<p><code>fn:(\d+)</code></p>
<p>And now I need to replace that with the expression that will add <code>21</code> to the number.</p>
<p>In BBEdit, I'd be stuck here. I just can't add anything to a match. In emacs, I can replace the match with that:</p>
<p><code>fn:\,(+ 21 (string-to-number \1))</code></p>
<p>The emacs lisp expression is "<code>(+ 21 (string-to-number \1))</code>", which means "convert the <code>\1</code> match that is a string into its numerical value and add <code>21</code> to it".</p>
<p>But, wasn't <code>\1</code> supposed to match <code>[0-9]+</code>, which is a number? Well, yes, but really it's just digits, hence strings, that have no numerical value whatsoever, so first, we need the expression to convert them to a numerical value before adding <code>21</code> to them.</p>
<p>Now, the trick is to have the expression be handled as an operation and not as an arbitrary string, and that's where the "<code>\,</code>" prefix comes into play.</p>
<p>"<code>\,</code>" tells the replace engine that the string that follows must be interpreted as an emacs lisp expression and not as a mere string. With it, the regexp replaces properly adds <code>21</code> to my note numbers, and I get two dozen footnotes updated in one fell swoop...</p>
<p>I love BBEdit and its people, but emacs is really a gift that keeps on giving.</p>
<hr />
<h2><span style="font-size: small;">Here are some handy references:</span></h2>
<dl>
<dt>the emacs <code>regexp-replace</code> function</dt>
<dd><a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Replace.html" target="blank">Regexp Replacement</a></dd>
<dt>the emacs regexp syntax</dt>
<dd><a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexps.html" target="blank">Syntax of Regular Expressions</a></dd>
<dt>the emacs-lisp <code>string-to-number</code> function</dt>
<dd><a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/String-Conversion.html" target="blank">Conversion of Characters and Strings</a></dd>
</dl>
<h2><span style="font-size: small;">And here is a really super short introduction to lisp syntax</span></h2>
<p>There is no real need to have a very deep understanding of emacs lisp to use this <code>regexp-replace</code> function. Just remember that a lisp expression generally looks like this:</p>
<p><code>(operator operands)</code></p>
<p>Where the <code>operator</code> is a generally a function, like <code>+</code> or <code>string-to-number</code> above, and the <code>operands</code> can be any expression that is accepted by the <code>operator</code>. So, here:</p>
<p><code>(+ 21 (string-to-number \1))</code></p>
<p>means:</p>
<p><code>add 21</code> to the result of the expression <code>(string-to-number \1)</code></p>
<p>with (string-to-number \1) meaning:</p>
<p><code>convert the string matched by \1 to its numeric value</code></p>
<p>Obviously, if <code>\1</code> is not a string, the conversion will fail and the addition won't work. And without that conversion, if we had just added <code>\1</code> as a string, the addition that expects numbers as operands would have failed.</p>
<p>I just realized that this is my first emacs lisp related post ever ! I'd like to thank that person I met in Tokyo about 15 years ago who showed me the way. It's an egg that definitely took some time to hatch...</p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-75881044411287163572021-04-18T12:22:00.059+09:002023-04-15T16:30:33.748+09:00Maxprograms is back, take 2. <h2 id="free-software-mostly">Free software by a world class XLIFF expert</h2>
<p>I first wrote about Maxprograms in 2007. That was after Rodolfo M. Raya left Heartsome to pursue his activity as the Maxprograms software company. I’ve been meaning to write about his work for a long time now, especially since he decided to put all his products on Github, thus allowing translators to get the code, build the things, get the updates and run them on their side, for free.</p>
<p>Maxprograms also offers a lot of technical articles on the subjects of DITA, XLIFF and XML in localization. Check the page <a href="https://www.maxprograms.com/articles/index.html">here</a> if you are interested.</p>
<p>Rodolfo M. Raya is an editor of the <a href="https://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html">XLIFF 2.0 specification</a> and is a member of the OASIS XLIFF technical committee. He is also co-author of <a href="https://xmlpress.net/publications/xliff/">A Practical Guide to XLIFF 2.0</a>.</p>
<h3>April 15, 2023 update: Rodolfo has updated the build requirements.</h3><div><ul style="text-align: left;"><li>JDK 17 or newer is required for compiling and building</li><li>Apache Ant 1.10.12 or newer</li><li>Node.js 18.15.0 LTS or newer</li><li>TypeScript 5.0.0 or newer</li></ul>I've updated the version numbers below. Make sure you check the various requirements on the respective repository pages.</div><h3>July 4, 2021 update: all of Maxprograms products are now available under an OSI approved Open Source license</h3>
<p>Most of Maxprograms' products come with an easy-to-use installer and only the packages listed in <em>italics</em> below do not, because in their case an installer is not relevant.</p>
<p>If you check the repository list at <a href="https://github.com/rmraya?tab=repositories">https://github.com/rmraya?tab=repositories</a> you will see the following software packages (among others). I added the product page on Maxprograms' site (the "..." links) to make it easier for you to find extra information:</p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Eclipse_Public_License">Eclipse Public License 1.0</a> (OSI approved)
<ul>
<li>Fluenta (DITA translation manager)
<a href="https://www.maxprograms.com/products/fluenta.html">...</a></li>
<li>Swordfish (standards based XLIFF CAT, supports Trados Studio packages)
<a href="https://www.maxprograms.com/products/swordfish.html">...</a></li>
<li>TMXEditor (TMX editor, as the name suggests)
<a href="https://www.maxprograms.com/products/tmxeditor.html">...</a></li>
<li>Stingray (document aligner)
<a href="https://www.maxprograms.com/products/stingray.html">...</a></li>
<li>XLIFFManager (GUI for OpenXLIFF)
<a href="https://www.maxprograms.com/products/xliffmanager.html">...</a></li>
<li>OpenXLIFF (command line utility to create, merge, validate XLIFF files)
<a href="https://www.maxprograms.com/products/openxliff.html">...</a></li>
<li>TMXValidator (validator/cleaner for TMX files)
<a href="https://www.maxprograms.com/products/tmxvalidator.html">...</a></li>
<li>TMEngine (translation memory engine)
<a href="https://www.maxprograms.com/products/tmengine.html">...</a></li>
<li>SRXEditor (SRX editor)
<a href="https://www.maxprograms.com/products/srxeditor.html">...</a></li>
<li>MVDServer (simple web server)
<a href="https://www.mvdsoftware.com/tools/mvdserver.html">...</a></li>
<li><em>XLIFFValidation (web-based XLIFF validation tool)</em>
<a href="https://dev.maxprograms.com/Validation/">...</a></li>
<li><em>RemoteTM (remote TM server)</em>
<a href="https://www.maxprograms.com/products/remotetm.html">...</a></li>
</ul></li>
<li><a href="https://en.wikipedia.org/wiki/MIT_License">MIT</a> (FSF and OSI approved)
<ul>
<li>Conversa (DITA publisher)
<a href="https://www.maxprograms.com/products/conversa.html">...</a></li>
<li>KeysAnalyzer (DITA keys analyzer)
<a href="https://www.maxprograms.com/products/keysanalyzer.html">...</a></li>
</ul></li>
</ul>
<p>A "normal" freelance translator would use Swordfish as an XLIFF translation editor/project manager. With eventually TMXEditor to work on client TMX, Stingray to align file sets, and TMXValidator to check and clean TMX files.</p>
<p>More advanced users, or PMs would use XLIFFManager or OpenXLIFF, along with XLIFFValidation and SRXEditor.</p>
<p>DITA specialists would use Fluenta, Conversa and KeyzAnalyzers.</p>
<p>Users who want to self-host services would use XLIFFValidation, MVDServer, RemoteTM.</p>
<p>Maxprograms' packages offer pretty much anything a translator would need, in very cleanly packaged solutions, with excellent user support, either community-based (on <a href="https://groups.io/g/maxprograms/">groups.io</a>), or directly from Maxprograms if you are a subscriber.</p>
<p>And if your main translation editor in not Swordfish, you can still benefit from all the other packages depending on your needs.</p>
<h2 id="diy-software">DIY software</h2>
<p>Fluenta, Swordfish, TMXEditor and Stingray are subscription-based, but allow translators to run the software for free from the source code (RemoteTM is proposed as a "software as a service" hosted by Maxprograms, but you can host it on your own server if you want).</p>
<p>What that means is that the packaged installer comes as a subscription, but if you don’t mind using Terminal to run your software, which is, let’s be honest, not much of a hurdle, you can use the software, access its updates, eventually make modifications for your own use, etc. for free.</p>
<p>The requirements to download, build and run the software are all given on each product’s Github repository, but here is the gist:</p>
<ul>
<li>JDK 17 or newer for compiling and building (<a href="https://adoptopenjdk.net">https://adoptopenjdk.net</a>)</li>
<li>Apache Ant 1.10.12 or newer (<a href="https://ant.apache.org/">https://ant.apache.org/</a>)</li>
<li>Node.js 18.15.0 LTS or newer (<a href="https://nodejs.org/">https://nodejs.org/</a>)</li><li>TypeScript 5.0.0 or newer (<a href="https://www.typescriptlang.org/">https://www.typescriptlang.org/</a>)</li>
</ul>
<p>Ant, Node.js and Typescript are also available from Homebrew (<a href="https://brew.sh">https://brew.sh</a>).</p>
<p>To build the software you’ll need to checkout (clone) the repositories. You also need to make sure that Ant uses Java 17 to build the package.</p>
<p>Rodolfo gives all the steps for building (for ex. Stingray):</p>
<pre><code> $ git clone https://github.com/rmraya/Stingray.git
$ cd Stingray
$ ant
$ npm install
$ npm start</code></pre>
<h2>Java ?</h2>
<p>Maxprograms' applications used to be multiplatform Java only applications. Now they use a combination of Java and Javascript (even if the names are close, the two languages are totally unrelated) see <a href="#electron" id="tech">below</a> for Rodolfo's explanations.</p>
<p>Apple used to ship Java when macOS was young. It was in fact one of its selling points. Apple has stopped distributing Java a long time ago and now suggests that users install Oracle Java. Changes in the Oracle license and the availability of free Java distributions have allowed users to still benefit from Java without having to pay for a commercial user license.</p>
<p>Even after installing Adoptium's JDK, your machine will still prefer to use an older Java version if you have one installed on your machine.</p>
<p>Which means that if you run:</p>
<code>$ echo $JAVA_HOME</code>
<p>in Terminal and it won’t point to Java 17, you won’t be able to build the software.</p>
<p>On my machine, the above command gives</p>
<p><span style="font-family: monospace;">/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home</span></p>
<p>A short investigation shows that the newly installed Java 17 is here:</p>
<p><code>/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/</code></p>
<p>The way to have <code>ant</code> use Java 17 instead of Java 11 for the build process is simply to give <code>ant</code> the right pointer:</p>
<p><code>$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/; ant</code></p>
<p>Once you’re done with the process, you can <code>export</code> your <code>Java_Home</code> back to its original value, just to be on the safe side. You’ll need to point to Java 17 only to build the software after a code update (<code>$ git pull</code>).</p>
<h2>Back to the command line</h2>
<p>Once you’ve run</p>
<code>$ npm install</code>
<p>you’re free to launch the application any time you want with</p>
<code>$ npm start</code>
<p>That’s it. This procedure works for Swordfish, Stingray, TMXEditor.</p>
<p>You can also create an Applescript that packages the whole process into a nice application that you can use to launch the various packages as you'd launch standard macOS applications.</p>
<p>A simple Applescript to do that could be:</p>
<p style="white-space: pre;"><font color="#000000" face="Verdana"><b>use</b> </font><font color="#6c05d3" face="Verdana"><u>AppleScript</u></font><font color="#000000" face="Verdana"> </font><font color="#0000ff" face="Verdana">version</font><font color="#000000" face="Verdana"> "2.4" </font><font color="#1d1e1e" face="Verdana">-- Yosemite (10.10) or later</font>
<font color="#000000" face="Verdana"><b>use</b> </font><font color="#0000ff" face="Verdana"><i>scripting additions</i></font>
<font color="#000000" face="Verdana"><b>set</b> </font><font color="#408000" face="Verdana">SwordfishPath</font><font color="#000000" face="Verdana"> <b>to</b> "/path/to/Swordfish/local/repository"</font>
<font color="#000000" face="Verdana"><b>set</b> </font><font color="#408000" face="Verdana">myCommand</font><font color="#000000" face="Verdana"> <b>to</b> "cd " & </font><font color="#408000" face="Verdana">SwordfishPath</font><font color="#000000" face="Verdana"> & "; npm start"</font>
<font color="#000000" face="Verdana"><b>tell</b> </font><font color="#0000ff" face="Verdana"><i>application</i></font><font color="#000000" face="Verdana"> "Terminal"'s <b>front</b> </font><font color="#0000ff" face="Verdana"><i>window</i></font>
<font color="#000000" face="Verdana"> </font><font color="#0000ff" face="Verdana"><u><b>delay</b></u></font><font color="#000000" face="Verdana"> 0.1</font>
<font color="#000000" face="Verdana"> </font><font color="#0000ff" face="Verdana"><u><b>do script</b></u></font><font color="#000000" face="Verdana"> </font><font color="#408000" face="Verdana">myCommand</font><font color="#000000" face="Verdana"> </font><font color="#0000ff" face="Verdana">in</font><font color="#000000" face="Verdana"> <b>its</b> <b>last</b> </font><font color="#0000ff" face="Verdana"><i>tab</i></font>
<font color="#000000" face="Verdana"><b>end</b> <b>tell</b></font></p>
<h2><a href="#tech" id="electron">↑</a> Electron ?</h2>
<p>Maxprograms' applications used to be Java only applications. But Oracle (Java's main caretaker) neglect of GUI libraries led to a not very satisfactory situation for Java GUI application developers. Here is Rodolfo's rationale for his move away from Java-based GUI libraries:</p>
<blockquote><p>I use HTML + JavaScript + CSS for the UI and Java for core libraries. In essence, my apps are web pages running on a Java server.</p>
<p>NodeJS provides access to Chrome's V8 JavaScript Engine. Electron is a bridge that provides native windowing environment for JavaScript pages displayed on top of Chrome.</p>
<p>JavaScript is a powerful language, but it is dangerously sloppy. Instead of coding directly on JavaScript, I use TypeScript (which is a safer language) and "transpile" my code to JavaScript for deployment.</p>
<p>I have not switched completely to TypeScript because there aren't good XML libraries for JavaScript. All translation standards are defined using XML and Java is still the best option for handling them. The good news is that JLIFF (a JSON-based version of XLIFF) is currently in development.</p>
<p>Why switch to HTML + CSS for the UI if Java is a cross-platform tool?, you may ask. The answer is simple: Java dropped its major UI libraries. </p>
<p>Initially, Java shipped with AWT, a horrible toolkit with poor design and feature lacking. AWT was so bad that two options replaced it: Swing (originally developed by Sun and currently used by OmegaT) and SWT (the one I used in Swordfish, developed by Eclipse Foundation).</p>
<p>Oracle deprecated Swing in Java 8 and replaced it with JavaFX. When Java 9 was released, JavaFX was abandoned and development moved to its own open-source project, away from Oracle.</p>
<p>The Eclipse Foundation, which developed and maintained SWT for years, stopped improving SWT when JavaFX appeared. It did not fully embrace JavaFX and SWT is languishing since then.</p>
<p>With SWT dying, I looked at JavaFX. It tries to mimic HTML + CSS without success. Not good enough. The real alternative: adopt HTML and CSS.</p></blockquote>
<h2>Et voilà!</h2>
<p>I'm not even scratching the surface of what Maxprograms has offered to translators since Heartsome disappeared. Each software package deserves a whole article.</p>
<p>Maxprograms' packages are yet another proof that working on macOS as translators, project managers or localization engineers is possible. And we're lucky that most of the multiplatform packages that allow us to work on macOS are backed by very talented people and communities who do their best to keep us from having to change of platform.</p>
<p>Disclaimer: I am not affiliated in <em>any</em> way to Maxprograms. Just so that you know...</p><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-54892187635689415602020-04-24T15:40:00.000+09:002020-04-24T15:42:17.875+09:00Restore hidden files from Time Machine<h2>About backups</h2>
<p>A working backup is like a stock of 10 billion masks waiting for a pandemic. You only use it when things go bad and since you never know when things go bad your backup needs to work flawlessly all the time.</p>
<p>Time Machine makes it extremely easy to restore anything that's on the backup disk to your machine. If you have not yet installed an external drive for your Time Machine backups, do it NOW. There is nothing more important than having a reliable backup of all your important files.</p>
<p>Time Machine has an optional setting (System Preferences > Time Machine > [Options...] button) where you decide what <em>not</em> to backup. <em>Anything</em> that is not there is basically copied to the Time Machine disk.</p>
<h2>Hidden files are also hidden in Time Machine</h2>
<p>This is not a Time Machine tutorial, so I'll stop here. But, what matters is that when you click on the "Enter Time Machine" menu item, macos shows a nice time based display of the contents of the current window, but it only shows what is <strong>visible</strong>. Not hidden files that are used in Unix applications as preference files and that are routinely created at the root of your home folder.</p>
<p>Yesterday I messed with one such file and since it was hidden, I could not restore it from the Time Machine display.</p>
<h2>The easy way, for moderately experienced people</h2>
<p>Time Machine can be accessed from the command line with the <code>tmutil</code> command.</p>
<p><code>$ man tmutil</code></p>
<pre>
TMUTIL(8) BSD System Manager's Manual TMUTIL(8)
NAME
tmutil -- Time Machine utility
SYNOPSIS
tmutil verb [options]
DESCRIPTION
tmutil provides methods of controlling and interacting with Time Machine,
as well as examining and manipulating Time Machine backups.
Common abilities include restoring data from backups, editing exclusions,
and comparing backups.
</pre>
<p>The "verb" we're looking for is <code>restore</code> and its syntax is:</p>
<pre>
restore [-v] src ... dst
Restore the item src, which is inside a snapshot, to the location dst.
The dst argument mimics the destination path semantics of the cp tool.
You may provide multiple source paths to restore. The last path
argument must be a destination.
</pre>
<p>The <code>src</code> is where the restore date/time can be chosen since the backups have their own folders based on date/time.</p>
<p>So what I needed was:</p>
<p><code>$ tmutil restore /Time/Machine/path/to/.hidden.file ~/.hidden.file.test</code></p>
<p>I restored to a <code>.test</code> file just to make sure that really was the file I wanted.</p>
<h2>The longer road, a half command-line, half GUI approach</h2>
<p>Another solution is to make hidden files visible in Finder, start Time Machine, restore from the graphical interface and re-hide the files (they're hidden to avoid messing with them by accident).</p>
<p>There is no visible Finder setting that allows for that, so to get the job done one still has to use the command line to modify some non-GUI Finder setting from Terminal. This has been documented for years but I keep forgetting about it.</p>
<p>In Terminal, enter the following command:</p>
<p><code>$ defaults write com.apple.finder AppleShowAllFiles TRUE</code></p>
<h2>What does all that mean ?</h2>
<p>In Terminal, enter the following comment:</p>
<p><code>$ man defaults</code></p>
<p>To display the "<code>defaults</code>" command "<code>man</code>"ual. You should see:</p>
<pre>
DEFAULTS(1) BSD General Commands Manual DEFAULTS(1)
NAME
defaults -- access the Mac OS X user defaults system
SYNOPSIS
defaults [-currentHost | -host hostname] read [domain [key]]
defaults [-currentHost | -host hostname] read-type domain key
defaults [-currentHost | -host hostname] write domain { 'plist' | key 'value' }
defaults [-currentHost | -host hostname] rename domain old_key new_key
defaults [-currentHost | -host hostname] delete [domain [key]]
defaults [-currentHost | -host hostname] { domains | find word | help }
</pre>
<p>(etc.)</p>
<p>Do you see the "<code>defaults [-currentHost | -host hostname] write domain { 'plist' | key 'value' }</code>" line ?</p>
<p>What that means is that the command syntax is:</p>
<p><code>defaults</code> + <em>optionally</em> either "<code>-currentHost</code>" or "<code>-host hostname</code>" + <code>write</code> + the "domain" to which belongs the preference + a compulsory settings value.</p>
<p>In our case, the "domain" is "<code>com.apple.finder</code>", the "key" is "<code>AppleShowAllFiles</code>" and the "value" is "<code>TRUE</code>".</p>
<p>which means "Please, write down somewhere that Finder is now required to show <em>all</em> the files."</p>
<h2>Next step</h2>
<p>When you're done with your un-hiding hidden files, you can enter Time Machine, restore the file you want and then re-hide the hidden files with:</p>
<p><code>$ defaults write com.apple.finder AppleShowAllFiles FALSE</code></p>
<p>Et voilà !</p>
<p>Now, Finder doesn't know about that change of settings until you actually relaunch it. You can do that from Finder itself, or, since you're already in Terminal, you can do it from there by using the following command:</p>
<p><code>$ killall Finder</code></p>
<p>where "<code>man killall</code>" gives you:</p>
<pre>
KILLALL(1) BSD General Commands Manual KILLALL(1)
NAME
killall -- kill processes by name
...
</pre>
<p><code>$ killall Finder</code></p>
<p>will actually kill and restart Finder.</p>
<p>To do the un-hidding and killalling in one fell swoop just tell Terminal that the two commands should be followed in order:</p>
<p><code>$ defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder</code></p>
<p>And the same for hidding them again when you're done with Time Machine:</p>
<p><code>$ defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder</code></p>
<h2>Knowing about the command line is a must</h2>
<p>Knowing about the command line and Terminal in a must. You can't pretend that system does not exist and trying to make sense of all that will drastically increase the amount of stuff you can do on your machine. There are plenty of tutorials on the web. One day I'll eventually write one for "us" translators, with commands that are relevant to our work...</p>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-39385731786022247622020-04-21T18:59:00.002+09:002022-02-01T18:45:38.236+09:00OmegaT and the Okapi Framework plugin for OmegaT<h3>
Introducing the Okapi Framework plugin for OmegaT</h3>
<div>
<br /></div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal;">
<i><u>This is a summary for people who want a "shortcut".</u></i></div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal; min-height: 22px;">
<br /></div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal;">[Updated Feb. 1st 2022 with link and version updates]</div><div style="font-family: Verdana; font-stretch: normal; line-height: normal;"><br /></div><div style="font-family: Verdana; font-stretch: normal; line-height: normal;">
The Okapi Framework is "a cross-platform and free open-source set of components and applications that offer extensive support for localizing and translating documentation and software."</div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal; min-height: 22px;">
<br /></div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal;">
<a href="https://okapiframework.org/">https://okapiframework.org</a></div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal; min-height: 22px;">
<br /></div>
<div style="font-stretch: normal; line-height: normal;">
<span face=""verdana" , sans-serif">From very early on the people behind the Okapi Framework have helped OmegaT users with a number of facilities, among which the "Filters Plugin for OmegaT", which brings transparent support for file formats such as:</span></div>
<div style="font-stretch: normal; line-height: normal; min-height: 22px;">
<span face=""verdana" , sans-serif"><br /></span></div>
<div style="font-stretch: normal; line-height: normal;">
</div>
<ul>
<li><span face=""verdana" , sans-serif">Doxygen-commented files</span></li>
<li><span face=""verdana" , sans-serif">HTML files</span></li>
<li><span face=""verdana" , sans-serif">InDesign IDML files</span></li>
<li><span face=""verdana" , sans-serif">JSON files</span></li>
<li><span face=""verdana" , sans-serif">Markdown projects.</span></li>
<li><span face=""verdana" , sans-serif">Transifex projects.</span></li>
<li><span face=""verdana" , sans-serif">TS files</span></li>
<li><span face=""verdana" , sans-serif">Trados TagEditor TTX files</span></li>
<li><span face=""verdana" , sans-serif">Wordfast pro TXML files</span></li>
<li><span face=""verdana" , sans-serif">XLIFF 1.2 files</span></li>
<li><span face=""verdana" , sans-serif">XLIFF 2.x files</span></li>
<li><span face=""verdana" , sans-serif">XML files (with or without ITS support)</span></li>
<li><span face=""verdana" , sans-serif">YAML files</span></li>
</ul>
<div style="font-stretch: normal; line-height: normal;">
<a href="https://okapiframework.org/wiki/index.php?title=Okapi_Filters_Plugin_for_OmegaT"><span face=""verdana" , sans-serif">https://okapiframework.org/wiki/index.php?title=Okapi_Filters_Plugin_for_OmegaT</span></a></div>
<div style="font-stretch: normal; line-height: normal; min-height: 22px;">
<span face=""verdana" , sans-serif"><br /></span></div>
<h3>
<span face=""verdana" , sans-serif">Basic requirement</span></h3>
<span face=""verdana" , sans-serif">Make sure you have a recent version of OmegaT (use version 4 and above).</span><br />
<div style="font-stretch: normal; line-height: normal; min-height: 22px;">
<span face=""verdana" , sans-serif"><a href="https://omegat.org/download">https://omegat.org/download</a></span></div>
<div style="font-stretch: normal; line-height: normal; min-height: 22px;">
<br /></div>
<h3>
To use the plugin in OmegaT</h3>
<div style="font-stretch: normal; line-height: normal;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<ol>
<li><span face=""verdana" , sans-serif">Enter your OmegaT configuration folder by using the </span><span style="font-family: "courier new" , "courier" , monospace;">Options > Access Configuration Folder</span><span face=""verdana" , sans-serif"> menu in OmegaT</span></li>
<li><span face=""verdana" , sans-serif">If there is no "</span><span style="font-family: "courier new" , "courier" , monospace;">plugins</span><span face=""verdana" , sans-serif">" folder in that configuration folder, create one<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxK4XlPsBd4IQRQ7hDTpCWje1Ng73ktADLwxj3d4En-eblYmRLO4RJXa3nzNO2SZI5HZ9CK4dEQoa8nITJApH28mozqANZ5sR-2B9EAtvG2fMBmbYQ-XfqVbYkiLKZdRm5Big_u_nQqzOL/s1600/Screen+Shot+2020-04-21+at+18.41.31.png" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img alt="Create a "plugins" folder in the OmegaT configuration folder if it is not already there." border="0" data-original-height="1028" data-original-width="1014" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxK4XlPsBd4IQRQ7hDTpCWje1Ng73ktADLwxj3d4En-eblYmRLO4RJXa3nzNO2SZI5HZ9CK4dEQoa8nITJApH28mozqANZ5sR-2B9EAtvG2fMBmbYQ-XfqVbYkiLKZdRm5Big_u_nQqzOL/s400/Screen+Shot+2020-04-21+at+18.41.31.png" title="OmegaT configuration folder" width="393" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Create the "plugins" folder if it is not already there.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
</span></li>
<li><span face=""verdana" , sans-serif">Download the plugin from the distribution site (1.9-1.41 at the time of this writing): <a href="https://okapiframework.org/wiki/index.php?title=Okapi_Filters_Plugin_for_OmegaT#Download_and_Installation">https://okapiframework.org/wiki/index.php?title=Okapi_Filters_Plugin_for_OmegaT#Download_and_Installation</a> </span></li>
<li><span face=""verdana" , sans-serif">Unzip if necessary, check the </span><span style="font-family: "courier new" , "courier" , monospace;">readme.html</span><span face=""verdana" , sans-serif"> file if you want</span></li>
<li><span face=""verdana" , sans-serif">Copy the </span><span style="font-family: "courier new" , "courier" , monospace;">okapiFiltersForOmegaT-1.9-1.41.jar</span><span face=""verdana" , sans-serif"> file to the OmegaT plugins folder that you identified above</span></li>
<li><span face=""verdana" , sans-serif">Restart OmegaT</span></li>
</ol>
<div style="font-stretch: normal; line-height: normal;">
<span style="font-family: "verdana";">Once you have installed the plugin, open OmegaT's File Filters preferences (</span><span style="font-family: "courier new" , "courier" , monospace;">Options > File Filters...</span><span style="font-family: "verdana";">) You should see a number of filters that have their name appended with "(Okapi)".</span></div>
<div style="font-stretch: normal; line-height: normal;">
<span style="font-family: "verdana";"><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNjsDWSWJAvaoquwoLredOh35Po1O9S0YSjiAP3C1_1tmkUdrdDErUiumuMj1pHfEh9X6i7aDS70z6jWXsdh-BQhmYKK6VofqD_mGqY5km8q_kjRAVC9Ij4exUCroTMrLWfKzOBBSqUxuR/s1600/Screen+Shot+2020-04-21+at+18.45.33.png" style="margin-left: auto; margin-right: auto;"><img alt="The Okapi plugin provides a number of additional filters that are identified in the OmegaT interface by the string "(Okapi)" appended to their names" border="0" data-original-height="548" data-original-width="1042" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNjsDWSWJAvaoquwoLredOh35Po1O9S0YSjiAP3C1_1tmkUdrdDErUiumuMj1pHfEh9X6i7aDS70z6jWXsdh-BQhmYKK6VofqD_mGqY5km8q_kjRAVC9Ij4exUCroTMrLWfKzOBBSqUxuR/s400/Screen+Shot+2020-04-21+at+18.45.33.png" title="Additional filters provided by the Okapi plugin" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The additional filters provided by the Okapi plugin</td></tr>
</tbody></table>
</span></div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal; min-height: 22px;">
<br /></div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal;">
Et voilà.</div>
<div style="font-family: Verdana; font-stretch: normal; line-height: normal; min-height: 22px;">
<br /></div>
<h3>
Now, 3 things</h3>
<ol>
<li><span style="font-family: "verdana";">[</span><b style="font-family: Verdana;">obvious, but it doesn't cost much to repeat</b><span style="font-family: "verdana";">]<br />If anything doesn't work as planned, carefully read the information in the links above and see that you have followed all the instructions and checked all the requirements. <i>This article is only a summary</i>.</span></li>
<li><span style="font-family: "verdana";">[</span><b style="font-family: Verdana;">beginner level</b><span style="font-family: "verdana";">]<br />OmegaT already has native filters for some of the Okapi filters. If you want OmegaT to use the Okapi filters, uncheck the native filters.</span></li>
<li><span style="font-family: "verdana";">[<b>advanced level</b>]<br />The Okapi filters have a default behavior that is reasonable enough. If you want to modify that behavior, you'll need to create a custom filter parameters file (</span><span style="font-family: "courier new" , "courier" , monospace;">.fprm</span><span style="font-family: "verdana";"> extension) from within Rainbow. You'll use OmegaT's filter specific options (select the Okapi filter in OmegaT's Filter Filters interface, click on "</span><span style="font-family: "courier new" , "courier" , monospace;">Options...</span><span style="font-family: "verdana";">") to select that file so that OmegaT uses it.<br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxTA8Cxl6_N5fvZ3dQstqq2LgvumTyohsTPuhpBth1d4YjtHM76R5X2INWBqGw7oy0kn5MyIL3WGeS9CfJCEw1huHUn1HbVT4DwPiY0JCy_NWpPg8F2GkqM71WJ_vx0XgtbvLHYm6wO35y/s1600/Screen+Shot+2020-04-21+at+18.55.08.png" style="margin-left: auto; margin-right: auto;"><img alt="It is possible to customize the Okapi filters behavior by adding parameters files created in Okapi's Rainbow" border="0" data-original-height="944" data-original-width="1600" height="235" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxTA8Cxl6_N5fvZ3dQstqq2LgvumTyohsTPuhpBth1d4YjtHM76R5X2INWBqGw7oy0kn5MyIL3WGeS9CfJCEw1huHUn1HbVT4DwPiY0JCy_NWpPg8F2GkqM71WJ_vx0XgtbvLHYm6wO35y/s400/Screen+Shot+2020-04-21+at+18.55.08.png" title="Adding a parameter file to customize the Okapi XLIFF filter behavior" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Adding a parameter file to customize the Okapi XLIFF filter behavior</td></tr>
</tbody></table>
</span></li>
</ol>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-89826394911536540842019-04-19T21:39:00.002+09:002019-07-27T11:58:58.468+09:00Random mail...<div style="font-stretch: normal; line-height: normal;">
<span style="font-family: verdana;"><span style="font-size: 14px;">Sometimes a wifi service wants your mail to register on their service. Sometimes it's to grant you full access, sometimes it is just to give you a few minutes so that you get their confirmation mail and register.</span></span><br />
<span style="font-family: verdana;"><span style="font-size: 14px;"><br /></span></span>
<span style="font-family: verdana;"><span style="font-size: 14px;">In any case, you generally don't want to give your email to just about anybody. I was thinking of creating a random mail generator that creates valid "enough" mails that they pass muster when you paste them in a mail field. Because sometimes, the few minutes you are granted to confirm that email are enough to just check your own mail and be done with the wifi access.</span></span><br />
<span style="font-family: verdana;"><span style="font-size: 14px;"><br /></span></span>
<span style="font-size: 14px;"><span style="color: black; font-family: verdana;"></span></span><br />
<span style="font-family: verdana;"><span style="font-size: 14px;">So, here it is.</span></span><br />
<div style="color: blue; font-family: verdana; font-size: 14px;">
<br /></div>
<div style="color: blue; font-family: verdana; font-size: 14px;">
<span style="color: black;">------✂︎------✂︎------✂︎------✂︎------✂︎------</span></div>
<div style="color: blue; font-family: verdana; font-size: 14px;">
<span style="color: black;"><b><br /></b></span></div>
<div style="color: blue; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>use</b> </span><i>scripting additions</i></div>
<div style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>global</b> </span>mailCharacters</div>
<div style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>set</b> <span style="color: #408000;">mailCharacters</span> <b>to</b> ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]</div>
<div style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #fb0007; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>set</b> </span><span style="color: #408000;">myName</span><span style="color: black;"> <b>to</b> </span>myRandomString<span style="color: black;">(10)</span></div>
<div style="color: #fb0007; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>set</b> </span><span style="color: #408000;">myDomain</span><span style="color: black;"> <b>to</b> </span>myRandomString<span style="color: black;">(10)</span></div>
<div style="color: #fb0007; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>set</b> </span><span style="color: #408000;">myExtension</span><span style="color: black;"> <b>to</b> </span>myRandomString<span style="color: black;">(3)</span></div>
<div style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>set</b> </span>myNewMail<span style="color: black;"> <b>to</b> </span>myName<span style="color: black;"> & "@" & </span>myDomain<span style="color: black;"> & "." & </span>myExtension</div>
<div style="color: #0016b0; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="text-decoration: underline;"><b>set the clipboard to</b></span><span style="color: black;"> </span><span style="color: #408000;">myNewMail</span></div>
<div style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #fb0007; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>on</b> </span>myRandomString<span style="color: black;">(</span><span style="color: #408000;">n</span><span style="color: black;">)</span></div>
<div style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #408000;">myString</span> <b>to</b> ""</div>
<div style="color: #0016b0; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="color: #408000;">myLength</span><span style="color: black;"> <b>to</b> </span><span style="text-decoration: underline;"><b>random number</b></span><span style="color: black;"> </span>from<span style="color: black;"> 2 </span>to<span style="color: black;"> </span><span style="color: #408000;">n</span></div>
<div style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>repeat</b> <b>with</b> <span style="color: #408000;">i</span> <b>from</b> 1 <b>to</b> <span style="color: #408000;">myLength</span></div>
<div style="color: #408000; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span>myString<span style="color: black;"> <b>to</b> </span>myString<span style="color: black;"> & </span><span style="color: blue;"><i>item</i></span><span style="color: black;"> (</span><span style="color: #0016b0; text-decoration: underline;"><b>random number</b></span><span style="color: black;"> </span><span style="color: #0016b0;">from</span><span style="color: black;"> 1 </span><span style="color: #0016b0;">to</span><span style="color: black;"> </span><span style="color: #6c05d3; text-decoration: underline;">length</span><span style="color: black;"> <b>of</b> </span>mailCharacters<span style="color: black;">) <b>of</b> </span>mailCharacters</div>
<div style="color: black; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>repeat</b></div>
<div style="color: blue; font-family: verdana; font-size: 14px;">
</div>
<div style="color: #fb0007; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>end</b> </span>myRandomString</div>
</div>
<div style="color: #fb0007; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
------✂︎------✂︎------✂︎------✂︎------✂︎------</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
The script creates something like:</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
[between 1 and 10 characters]@[between 1 and 10 characters].[between 1 and 3 characters]</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
and puts it into the clipboard so that you just have to run the script, and paste in the field where you need to put a mail.</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
It's pretty trivial, but it is just what I need.</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
Also, if you're a tad conscious about security, you should use a VPN over a free wifi, but that's another story.</div>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>suzumehttp://www.blogger.com/profile/04461530003126147499noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-13154136388129422472019-03-17T12:22:00.006+09:002021-05-09T12:29:52.488+09:00OmegaT launcher in applescript<p>(updated on May 9 2021 with fixed links, etc.)
<p>As a follow-up to a discussion on the OmegaT list<a name="fromNote1" href="#toNote1">*</a>, I put my OmegaT launcher applescript on github:
<p><a href="https://github.com/brandelune/OmegaT-things/blob/master/%3EOmegaT.applescript">https://github.com/brandelune/OmegaT-things/blob/master/%3EOmegaT.applescript</a>
<p>I'll write a more detailed post about that one later but it should be useable as is.
<p>To test it, open it with Script Editor, select a valid OmegaT project in Finder, go back to Script Editor and click on Run (▶︎) or hit Cmd+R. You should see a dialog with 3 buttons and "Open Project" is selected ("Create Project" won't create a project for you because it calls code that I have not yet cleaned up, so you'll have to manually create a project, select it and then launch this script).
<p>Clicking on it should launch Terminal, and from there OmegaT with a default command that looks like this by default:
<p><code>java -Xdock:name=OmegaT -jar '/path/to/OmegaT.jar' '/path/to/project/' --no-team</code>
<p>Feel free to fiddle with the script and once you're satisfied with it, use File > Export and select "Application" as the file format. Then you can use it as a normal application to call it from Spotlight, etc.
<p>There are plenty of TODOs in the file. I'm planning to slowly fill them with working code. If you have ideas, don't hesitate to make suggestions.
<hr>
<a name="toNote1" href="#fromNote1">*</a> After Didier Briel left the OmegaT project a few days ago, he asked me to take the role of "twitter community manager", and so I'm back into the OmegaT Project, after an 18 months lapse. Aaron Madlon-Kay is the new project manager. Don't hesitate to follow <a href="https://twitter.com/OmegaTOfficial">@OmegaTOfficial</a> on Twitter if you don't already.<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-17206456659072798642018-10-26T02:26:00.005+09:002019-01-01T21:45:01.541+09:00Support this blog ?<span style="font-family: "verdana" , sans-serif;"><u>Update</u> (12/16) :</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b>I'm canceling the e-junkie button. Thank you to the one person who sent </b><strike>$5</strike><b> 5</b></span><b style="font-family: verdana, sans-serif;">€</b><b style="font-family: verdana, sans-serif;">. </b><span style="font-family: "verdana" , sans-serif;">I'm sending that money to support OmegaT (on a side note, the 5€ turned out to become 3.95€ after Paypal took its share both ways...)</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<hr />
<br />
<span style="font-family: "verdana" , sans-serif;">I was reading a reply on the Script Debugger forum that mentioned a really cheap online shopping service: http://e-junkie.com.</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br />
</span> <span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">And then I thought... I've run this blog for more than 10 years, without any Google Ad or any kind of promotional material, so why not add a button somewhere where readers are free to support the writing with the amount they want...</span></span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br />
</span> <span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">30 minutes later, I had that button installed, for you to click on it!</span></span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br />
</span> <span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">You support will go to the free and indies software that allow us to work on our macs!</span></span><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-77310533002895504742018-09-29T11:50:00.000+09:002018-09-29T11:57:42.675+09:00No mojave on this machine<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">I bought this MacBook Pro in July 2011. It is a 13" machine, to which I added 16gb of ram from the start.</span></div>
<div style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; min-height: 19px;">
<span style="font-kerning: none;"></span><br /></div>
<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">A few months ago I removed the hard disk that was getting really old and seemed to have issues, and put an SSD drive instead. The speed bump was immediately noticeable and it really felt like this machine was getting a second life.</span></div>
<div style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; min-height: 19px;">
<span style="font-kerning: none;"></span><br /></div>
<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">Now I had one issue left. Battery life.</span></div>
<div style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; min-height: 19px;">
<span style="font-kerning: none;"></span><br /></div>
<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">The original battery served me well for 7 years. After more than 1300 cycles, the capacity was down to about 50% of the original battery, which meant 2h30 of autonomy at best (unless you cut wifi and a number of services that run in the background). I started putting a recharger in my bag a few weeks ago but that was not a really satisfying situation.</span></div>
<div style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; min-height: 19px;">
<span style="font-kerning: none;"></span><br /></div>
<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">This week, I decided to get a new battery. The difficult part is to identify a maker that sells good products, at a reasonable price. I eventually found a seemingly good product for about ¥8000 and installed it right away.</span></div>
<div style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; min-height: 19px;">
<span style="font-kerning: none;"></span><br /></div>
<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">It looks like the battery sensors needed some time to get used to the new data. At first they were struggling to reconcile the legacy data with the new battery performance. Eventually I am at a point where I get at least 5 hours on a charge. That's a huge improvement since I'm seldom far from a power cord for more than 5 hours, and I usually don't work on the machine for that much time in a row.</span></div>
<div style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; min-height: 19px;">
<span style="font-kerning: none;"></span><br /></div>
<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">So, now that my machine is almost like new (except for the bumps and scratches on the aluminium cover, for the keyboard keys that seem to have taken a hit from my nails after so many years, and for the screen that seems to have some imprinted key shapes on it that I can't remove), I was thinking that a software upgrade was in order. But I knew from when mojave was announced that High Sierra would be the last macos version I could install on that machine.</span></div>
<div style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; min-height: 19px;">
<span style="font-kerning: none;"></span><br /></div>
<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">I think it's the first time my work machine is too old to support the latest version of macos. But after the hardware upgrades, and the fact that 16gb makes it run extremely smoothly even for a 7 years old machine, I don't feel like I need a new machine.</span></div>
<div style="font-family: Times; font-size: 16px; font-stretch: normal; line-height: normal; min-height: 19px;">
<br /><span style="font-kerning: none;"></span></div>
<div style="font-family: Verdana; font-size: 16px; font-stretch: normal; line-height: normal;">
<span style="font-kerning: none;">I heard stories about the touch bar and about the keyboard on the new MBPs. I wouldn't want to spend money on Apple hardware if I were not sure such issues were solved. Also, if I were to buy a new laptop, it would probably be a super light and thin machine. So unless something bad happens, I guess I'll wait for a few more years, when the applications I use require frameworks that do not support this High Sierra machine anymore. Then, I'll buy the equivalent of what the current Mac Book is. A super tight (is "tight" a contraction of "thin" and "light"?) machine, with nice specs (and they will feel especially nice after having worked on this MBP for about 10 years).</span></div>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-35960434583829923402018-07-22T21:00:00.002+09:002018-07-22T22:27:54.286+09:00Easily launch scripts from Spotlight<span style="font-family: "verdana" , sans-serif;">I've been advertising <a href="https://mac4translators.blogspot.com/search/label/AppleScript" target="_blank">AppleScript</a> a lot here. Automating a task is something, but easy access to that automation is quite important too.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Since I try to stick to Apple solutions and free software* I prefer using Spotlight instead of all the smart launchers that we have for macOS.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">What I do is that I call my script names that are easy to call first in Spotlight. A few screenshots speak louder than words so here we are:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The series that start with ">" usually is scripts that I use to open something.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">See how just typing ">" suggests ">BB". That ">BB" is what I use to <a href="https://mac4translators.blogspot.com/2018/07/open-file-in-your-editor-of-choice.html" target="_blank">open the files selected in Finder with BBEdit</a>.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The one below is ">Tedit", short for "TextEdit" and opens selected files in TextEdit, etc.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW_UaWR2eK30gxHJDCKfiedMK2JJkr7oLU73guXlRCARY84mSgwrtMGHtTwkZ-DRTLzGSaWhYgkjCfg548FToR609UsHjmp98eSXKkkdTw0sy5z4l4kFWEpl1WcwRg64L2uMPIK3dplSk/s1600/Screen+Shot+2018-07-22+at+20.31.56.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="319" data-original-width="785" height="130" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW_UaWR2eK30gxHJDCKfiedMK2JJkr7oLU73guXlRCARY84mSgwrtMGHtTwkZ-DRTLzGSaWhYgkjCfg548FToR609UsHjmp98eSXKkkdTw0sy5z4l4kFWEpl1WcwRg64L2uMPIK3dplSk/s320/Screen+Shot+2018-07-22+at+20.31.56.png" width="320" /></a></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">If I type "c" after ">", I get the following list of choices. ">command" is to launch an arbitrary command in Terminal, ">Capture" is to use org capture in Emacs (see <a href="https://mac4translators.blogspot.com/2017/09/writing-because-emacs.html" target="_blank">here</a> and <a href="https://mac4translators.blogspot.com/2017/11/capture-really-everywhere.html" target="_blank">here</a> for more information) and <a href="https://mac4translators.blogspot.com/2018/04/from-finder-to-terminal-cd-anywhere.html" target="_blank">">cd" just opens a Terminal tab on the front Finder window, or selected Finder folder</a>.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1-GsqdiNYx8JuMBjrlVs-wdFtKkTcx-aC_AQal6LTCZ2Re7xcxt49H8KGufyikVLbu0t8ToOWSD_c4RyhJO74WxCInGkK6_2G7B9CXuUIBD9pbXd6sstntL3iSyrBqsGDL2i2dgwxags/s1600/Screen+Shot+2018-07-22+at+20.33.41.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="342" data-original-width="807" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1-GsqdiNYx8JuMBjrlVs-wdFtKkTcx-aC_AQal6LTCZ2Re7xcxt49H8KGufyikVLbu0t8ToOWSD_c4RyhJO74WxCInGkK6_2G7B9CXuUIBD9pbXd6sstntL3iSyrBqsGDL2i2dgwxags/s320/Screen+Shot+2018-07-22+at+20.33.41.png" width="320" /></a></div>
<br />
<span style="font-family: "verdana" , sans-serif;">When I use "<" to initiate the search, I get a different list. That series is for scripts that usually act by themselves. "<text file" creates a text file in the front Finder window and proposes to open it in BBEdit for editing, "<facturation" is an invoicing script for the job selected in Finder, "<job" is a job managing script that creates a job hierarchy in Finder based on a mail, along with an event in calendar, and then "<xls2tmx" is a TMX converter for multicolumn Excel reference data (I'll publish it when it's more polished, but creating XML data with AppleScript is documented <a href="https://mac4translators.blogspot.com/2018/02/this-article-is-attempt-at-putting.html" target="_blank">here</a>).</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFH-V7wkubG2Pf5Encmn6pH_kU2UPkjAGze1VU2lhQQky4G7v0XwrSuYJBRN8SnVKZHP4OMSGumVFssKegIL49gTfbN-dCtWVJUaO8BQcr2HunJG-y3zZVsPruMwXVuAnAkP1bIysm3Fg/s1600/Screen+Shot+2018-07-22+at+20.34.57.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="294" data-original-width="827" height="113" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFH-V7wkubG2Pf5Encmn6pH_kU2UPkjAGze1VU2lhQQky4G7v0XwrSuYJBRN8SnVKZHP4OMSGumVFssKegIL49gTfbN-dCtWVJUaO8BQcr2HunJG-y3zZVsPruMwXVuAnAkP1bIysm3Fg/s320/Screen+Shot+2018-07-22+at+20.34.57.png" width="320" /></a></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">I have a few more scripts (a dozen) that I routinely call with Spotlight, which I find totally sufficient for my needs.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">As you know, hitting Command+Enter when you have a selection in Spotlight is a way to reveal that selection in the Finder if it is available. So when I want to edit a script, I start by calling it in Spotlight, I hit Command+Enter when it is selected and then I call <a href="https://mac4translators.blogspot.com/2018/07/open-file-in-your-editor-of-choice.html" target="_blank">"</a></span><span style="font-family: "verdana" , sans-serif;"><a href="https://mac4translators.blogspot.com/2018/07/open-file-in-your-editor-of-choice.html" target="_blank">>SEditor" (Script Editor) or ">debugger" (Script Debugger) on the selection</a>, to open it with the appropriate application...</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">* </span><span style="font-family: "verdana" , sans-serif;">Ok, I do have BBEdit, Microsoft Office and Illustrator... And maybe a few others...</span><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-42529845108275576562018-07-22T18:10:00.000+09:002018-07-25T08:37:11.403+09:00Open a file in your editor of choice<span style="font-family: "verdana" , sans-serif;"><b>[Update]</b></span><br />
<span style="font-family: "verdana" , sans-serif;">Chris Stone has a nice follow-up on the <a href="https://groups.google.com/forum/#!topic/bbedit/R0fLMNYyUUo" target="_blank">BBEdit user forum</a>.</span><br />
<hr />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">You know how it is. You double-click on a file thinking it will open in the application that you're working with at the moment and you forget that the file type was associated with a different application...</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">Back to Finder, right-click on the file, select "Open with..." and you're good. But mousing around macOS can be tedious at times so here is a simple script that I was pretty much given by an ASUL co-lister and that I barely had to adapt to my workflow to make it more general.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>property</b> <span style="color: #4e8f00;">targetApplication</span> : "BBEdit"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Finder" <b>to</b> <b>set</b> <span style="color: #4e8f00;">mySelectionList</span> <b>to</b> <span style="color: #812fdc; text-decoration: underline;">selection</span> <b>as</b> <span style="color: #0433ff;"><i>alias list</i></span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>if</b> <span style="color: #812fdc; text-decoration: underline;">length</span> <b>of</b> <span style="color: #4e8f00;">mySelectionList</span> = 0 <b>then</b> <b>error</b> "No files were selected in the Finder!"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>tell</b> </span><span style="color: #0433ff;"><i>application</i></span><span style="color: black;"> </span>targetApplication</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>repeat</b> <b>with</b> </span>myFile<span style="color: black;"> <b>in</b> </span>mySelectionList</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0433ff; text-decoration: underline;"><b>open</b></span><span style="color: black;"> </span>myFile</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>repeat</b></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></div>
<br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>end</b> <b>tell</b></div>
<div>
<b><br />
</b></div>
<span style="font-family: "verdana" , sans-serif;">You notice right away that the only reference to the opening application is in the first line. You can change the application name to anything you want and have multiple copies of the script, one for each application, with an appropriate name so that you can open any file with any supporting application you want.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">Here is the exact same code for TextEdit:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>property</b> <span style="color: #4e8f00;">targetApplication</span> : "TextEdit"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Finder" <b>to</b> <b>set</b> <span style="color: #4e8f00;">mySelectionList</span> <b>to</b> <span style="color: #812fdc; text-decoration: underline;">selection</span> <b>as</b> <span style="color: #0433ff;"><i>alias list</i></span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>if</b> <span style="color: #812fdc; text-decoration: underline;">length</span> <b>of</b> <span style="color: #4e8f00;">mySelectionList</span> = 0 <b>then</b> <b>error</b> "No files were selected in the Finder!"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>tell</b> </span><span style="color: #0433ff;"><i>application</i></span><span style="color: black;"> </span>targetApplication</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>repeat</b> <b>with</b> </span>myFile<span style="color: black;"> <b>in</b> </span>mySelectionList</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0433ff; text-decoration: underline;"><b>open</b></span><span style="color: black;"> </span>myFile</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>repeat</b></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></div>
<br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>end</b> <b>tell</b></div>
<div>
<b><br />
</b></div>
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">The same for Script Editor:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>property</b> <span style="color: #4e8f00;">targetApplication</span> : "Script Editor"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Finder" <b>to</b> <b>set</b> <span style="color: #4e8f00;">mySelectionList</span> <b>to</b> <span style="color: #812fdc; text-decoration: underline;">selection</span> <b>as</b> <span style="color: #0433ff;"><i>alias list</i></span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>if</b> <span style="color: #812fdc; text-decoration: underline;">length</span> <b>of</b> <span style="color: #4e8f00;">mySelectionList</span> = 0 <b>then</b> <b>error</b> "No files were selected in the Finder!"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>tell</b> </span><span style="color: #0433ff;"><i>application</i></span><span style="color: black;"> </span>targetApplication</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>repeat</b> <b>with</b> </span>myFile<span style="color: black;"> <b>in</b> </span>mySelectionList</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0433ff; text-decoration: underline;"><b>open</b></span><span style="color: black;"> </span>myFile</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>repeat</b></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></div>
<br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>end</b> <b>tell</b></div>
<div>
<b><br />
</b></div>
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">The same for Script Debugger:</span><br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>property</b> <span style="color: #4e8f00;">targetApplication</span> : "Script Debugger"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Finder" <b>to</b> <b>set</b> <span style="color: #4e8f00;">mySelectionList</span> <b>to</b> <span style="color: #812fdc; text-decoration: underline;">selection</span> <b>as</b> <span style="color: #0433ff;"><i>alias list</i></span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>if</b> <span style="color: #812fdc; text-decoration: underline;">length</span> <b>of</b> <span style="color: #4e8f00;">mySelectionList</span> = 0 <b>then</b> <b>error</b> "No files were selected in the Finder!"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>tell</b> </span><span style="color: #0433ff;"><i>application</i></span><span style="color: black;"> </span>targetApplication</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>repeat</b> <b>with</b> </span>myFile<span style="color: black;"> <b>in</b> </span>mySelectionList</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0433ff; text-decoration: underline;"><b>open</b></span><span style="color: black;"> </span>myFile</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>repeat</b></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>end</b> <b>tell</b></div>
<div>
<b><br />
</b></div>
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">The same for Word:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>property</b> <span style="color: #4e8f00;">targetApplication</span> : "Microsoft Word"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Finder" <b>to</b> <b>set</b> <span style="color: #4e8f00;">mySelectionList</span> <b>to</b> <span style="color: #812fdc; text-decoration: underline;">selection</span> <b>as</b> <span style="color: #0433ff;"><i>alias list</i></span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>if</b> <span style="color: #812fdc; text-decoration: underline;">length</span> <b>of</b> <span style="color: #4e8f00;">mySelectionList</span> = 0 <b>then</b> <b>error</b> "No files were selected in the Finder!"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>tell</b> </span><span style="color: #0433ff;"><i>application</i></span><span style="color: black;"> </span>targetApplication</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>repeat</b> <b>with</b> </span>myFile<span style="color: black;"> <b>in</b> </span>mySelectionList</div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0433ff; text-decoration: underline;"><b>open</b></span><span style="color: black;"> </span>myFile</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>repeat</b></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></div>
<br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>end</b> <b>tell</b></div>
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">You get the drift.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">Some applications don't work that way, so here is the code for Emacs.app:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <br />
<div style="color: #272828; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>use</b> </span><span style="color: #812fdc; text-decoration: underline;">AppleScript</span><span style="color: black;"> </span><span style="color: #0433ff;">version</span><span style="color: black;"> "2.4" </span>-- Yosemite (10.10) or later</div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>use</b> </span><i>scripting additions</i></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Finder" <b>to</b> <b>set</b> <span style="color: #4e8f00;">fileSelection</span> <b>to</b> <span style="color: #812fdc; text-decoration: underline;">selection</span> <b>as</b> <span style="color: #0433ff;"><i>alias list</i></span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>try</b></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "System Events" <b>to</b> <b>tell</b> <span style="color: #0433ff;"><i>process</i></span> "Emacs" <b>to</b> <b>set</b> <span style="color: #812fdc; text-decoration: underline;">frontmost</span> <b>to</b> <span style="color: #812fdc; text-decoration: underline;"><i>true</i></span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>on</b> <b>error</b></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "/Users/suzume/Documents/Code/emacs/nextstep/Emacs.app"</div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>delay</b></span><span style="color: black;"> 1</span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>end</b> <b>try</b></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #272828; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
# return</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #4e8f00; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>repeat</b> <b>with</b> </span>selectedFile<span style="color: black;"> <b>in</b> </span>fileSelection</div>
<div style="color: #012fbe; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>set the clipboard to</b></span><span style="color: black;"> (</span><span style="color: #812fdc; text-decoration: underline;">POSIX path</span><span style="color: black;"> <b>of</b> </span><span style="color: #4e8f00;">selectedFile</span><span style="color: black;">)</span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "/Users/suzume/Documents/Code/emacs/nextstep/Emacs.app"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "System Events"</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #0433ff; text-decoration: underline;"><b>delay</b></span> 0.5</div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>keystroke</b></span><span style="color: black;"> "x" </span>using<span style="color: black;"> {</span><span style="color: #812fdc; text-decoration: underline;"><i>control down</i></span><span style="color: black;">}</span></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>keystroke</b></span><span style="color: black;"> "f" </span>using<span style="color: black;"> {</span><span style="color: #812fdc; text-decoration: underline;"><i>control down</i></span><span style="color: black;">}</span></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>keystroke</b></span><span style="color: black;"> "a" </span>using<span style="color: black;"> {</span><span style="color: #812fdc; text-decoration: underline;"><i>control down</i></span><span style="color: black;">}</span></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>keystroke</b></span><span style="color: black;"> "v" </span>using<span style="color: black;"> {</span><span style="color: #812fdc; text-decoration: underline;"><i>command down</i></span><span style="color: black;">}</span></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>keystroke</b></span><span style="color: black;"> "k" </span>using<span style="color: black;"> {</span><span style="color: #812fdc; text-decoration: underline;"><i>control down</i></span><span style="color: black;">}</span></div>
<div style="color: #0433ff; font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>key code</b></span><span style="color: black;"> 36 </span><span style="color: #272828;"># Escape</span></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #0433ff; text-decoration: underline;"><b>delay</b></span> 0.1</div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></div>
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></div>
<br />
<div style="font-family: Verdana; font-size: 14px; font-stretch: normal; line-height: normal;">
<b>end</b> <b>repeat</b></div>
<div>
<b><br />
</b></div>
<span style="font-family: "verdana" , sans-serif;">The code makes use of UI scripting because Emacs does not support Applescript, but it works just as well.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">What you do now, is create one script for each application you want to open your files with, save the script with a name that Spotlight will easily call first (something like ">BB" for opening in BBedit) and you're done!</span><br />
<span style="font-family: "verdana" , sans-serif;"><br />
</span> <span style="font-family: "verdana" , sans-serif;">Thank you Chris Stone on ASUL (and all the others) for your help !</span><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-44494564685675295602018-07-05T11:16:00.000+09:002018-07-22T19:54:02.338+09:00 Wordpress site translation (1) install a local copy<div style="font-family: Verdana, sans-serif;">
I'm currently working on 2 WP sites. One is the sub-site of a world-wide IT organization, the other one is the main site of a local business. I had forgotten how site localization can be a pain, so here is a summary of the solutions I'm using for the 2 sites.<br />
<br />
The main issue with any kind of site (be it WP or any other system) is access rights. If you don't have full access rights (or only limited access), you can only do what the client allows you to do. Depending of the l10n savviness of the client, that can be a lot or very little.<br />
<br />
So let's say that you work directly for the client and you have full access rights to the site.<br />
<br />
First you <b>don't want</b> to work directly on the site. You want to install the site on your machine and have it run locally to be able to see all your changes and validate them before you reproduce them online.<br />
<br />
Also, you want to be able to manage your changes and know exactly what was that change your made for. You want to have granular control of all the modifications and for that you'll need a version control system. That way you can revert any modification any time you want.<br />
<br />
<ol>
<li>Follow the instructions here to install a "blank" WP site locally and to be able to run it: <a href="https://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP">https://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP</a></li>
<li>(Install and) Use the "All-in-One WP Migration" plugin on the online site to export all the data (an FTP download only won't work, there are databases, etc. that you can't access from FTP)</li>
<li>Use that same plugin on the local site to import the site</li>
<li>Now you have a copy of your online site running locally. Changes that you'll do locally will be live right away so that you can test them. They will not affect the online site.</li>
<li>To have granular control of your modifications, use git to create a version control repository for your site: enter the root of your site and run "git init", add all the files to the repository.<br />
<ul>
<li>A few links to get up to speed with git:</li>
<ul>
<li><a href="https://xkcd.com/1597/">https://xkcd.com/1597/</a></li>
<li><a href="https://www.sitepoint.com/introduction-to-git-1/">https://www.sitepoint.com/introduction-to-git-1/</a></li>
<li><a href="https://git-scm.com/docs/gittutorial">https://git-scm.com/docs/gittutorial</a></li>
</ul>
</ul>
</li>
<li>You need a robust backup system. Something that does everything automatically so that you don't loose too much data (or any data at all) in case of problem. <a href="https://mac4translators.blogspot.com/2017/10/adventures-in-kernel-panic-land.html" target="_blank">Time Machine is good</a> but don't hesitate to use something more sophisticated.</li>
<li>You can now start working on the site localization.</li>
</ol>
<br />
WP is a mess when it comes to translating a whole site. There are no integrated mechanisms to access <i>all</i> the localizable parts: you have to use plugins to create the l10n infrastructure, then plugins to export the theme strings, then whateverelse to actually access the textual contents of the site.<br />
<br />
I'll write more later about the second phase of the l10n: the actual translation process.</div>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-324142063960240862018-04-01T10:33:00.000+09:002018-07-05T12:02:47.424+09:00From Finder to Terminal: cd anywhere<span style="font-family: "verdana" , sans-serif;">At a point in a Mac user life, the Terminal utility and all the command line applications that it brings to the game become a daily necessity. Typically, you work in a Finder window and want to work on the window items from the command line. For that, you can go up to the parent window, select the folder that you just exited and copy it, move to terminal, hit "</span><span style="font-family: "courier new" , "courier" , monospace;">cd</span><span style="font-family: "verdana" , sans-serif;">", add a space, paste the folder and hit "</span><span style="font-family: "courier new" , "courier" , monospace;">Enter</span><span style="font-family: "verdana" , sans-serif;">". That's a lot of fiddling around.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<span style="font-family: "verdana" , sans-serif;">I just checked and found that I needed about 10 seconds to complete the task. 10 seconds, 4 times a day, 5 times a week, 40 times a year and you've lost 8,000 seconds = more than 2 hours. Eventually you'll notice that you're wasting time on this particular task and you end up either cursing yourself that you can't go faster, or start looking for a solution.</span><br /><span style="font-family: "verdana" , sans-serif;">Here is my take on the problem.</span><span style="font-family: "verdana" , sans-serif;"><br /></span><span style="font-family: "verdana" , sans-serif;">On a side note, I spent way more than 2 hours to find that solution (and all the solutions that I write about here). Namely, I had to learn enough AppleScript, then I applied that knowledge to Finder and Terminal, then I found all the issues that made this a non trivial task, then I asked around (eternal thanks to the members of the AppleScript Users list hosted by Apple), then I tried a new implementation, then I was not satisfied with it, rewrote the whole thing and that's where I stand today. But the time spent on learning AppleScript and the workings of the various applications translates into knowledge (along with its own lot of frustration) that I can apply to other issues, while <b><i>not</i></b> spending that time only translates in frustration and a sense that you can't do much with computers...</span><br />
<br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>use</b> </span><span style="color: #812fdc; text-decoration: underline;">AppleScript</span><span style="color: black;"> </span><span style="color: #0433ff;">version</span><span style="color: black;"> "2.4" </span>-- Yosemite (10.10) or later</div>
<div style="color: #0433ff; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>use</b> </span><i>scripting additions</i></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Finder"</div>
<div style="color: #0433ff; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>try</b> </span># if what is selected in Finder is a folder, then use that folder</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>if</b> <span style="color: #0433ff;"><i>class</i></span> <b>of</b> <span style="color: #0433ff;"><i>item</i></span> 1 <b>of</b> (<span style="color: #812fdc; text-decoration: underline;">selection</span> <b>as</b> <span style="color: #0433ff;"><i>list</i></span>) <b>is</b> <span style="color: #0433ff;"><i>folder</i></span> <b>then</b></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #4e8f00;">myFolder</span> <b>to</b> <span style="color: #0433ff;"><i>item</i></span> 1 <b>of</b> (<span style="color: #812fdc; text-decoration: underline;">selection</span> <b>as</b> <span style="color: #0433ff;"><i>alias list</i></span>)</div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>else</b> </span># if nothing is selected or if the selection is not a folder, use the parent folder</div>
<div style="color: #812fdc; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="color: #4e8f00;">myFolder</span><span style="color: black;"> <b>to</b> </span><span style="text-decoration: underline;">insertion location</span><span style="color: black;"> <b>as</b> </span><span style="color: #0433ff;"><i>alias</i></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>if</b></div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>on</b> <b>error</b> </span># if nothing works, default to using the Desktop</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #4e8f00;">myFolder</span> <b>to</b> <span style="color: #812fdc; text-decoration: underline;">desktop</span> <b>as</b> <span style="color: #0433ff;"><i>alias</i></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>try</b></div>
<div style="color: #812fdc; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="color: #4e8f00;">myPath</span><span style="color: black;"> <b>to</b> </span><span style="text-decoration: underline;">quoted form</span><span style="color: black;"> <b>of</b> (</span><span style="text-decoration: underline;">POSIX path</span><span style="color: black;"> <b>of</b> </span><span style="color: #4e8f00;">myFolder</span><span style="color: black;">)</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> <span style="color: #4e8f00;">myCommand</span> <b>to</b> "cd " & <span style="color: #4e8f00;">myPath</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<b>end</b> <b>tell</b></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
# I use a separate "handler" to launch the command.</div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
# That handler can be saved in a script library so as to be able to call it from other scripts</div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="color: red; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>my</b> </span>launchMyCommand<span style="color: black;">(</span><span style="color: #4e8f00;">myCommand</span><span style="color: black;">)</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
# A handler is useful because what matters is what it outputs, not how it works.</div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
# So, if at one point in the future I decide that this way of launching a command in Terminal is not efficient anymore, I can change the way the handler works but I won't have to change the scripts that call it.</div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="color: red; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>on</b> </span>launchMyCommand<span style="color: black;">(</span><span style="color: #4e8f00;">myCommand</span><span style="color: black;">)</span></div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span># First I use GUI scripting to create a new Terminal window</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Terminal" <b>to</b> <span style="color: #0433ff; text-decoration: underline;"><b>activate</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "System Events" <b>to</b> <b>tell</b> <span style="color: #0433ff;"><i>application process</i></span> "Terminal"</div>
<div style="color: #812fdc; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="text-decoration: underline;">frontmost</span><span style="color: black;"> <b>to</b> </span><span style="text-decoration: underline;"><i>true</i></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #0433ff; text-decoration: underline;"><b>delay</b></span> 0.1</div>
<div style="color: #0433ff; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>keystroke</b></span><span style="color: black;"> "n" </span>using<span style="color: black;"> {</span><span style="color: #812fdc; text-decoration: underline;"><i>command down</i></span><span style="color: black;">}</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span># Then I ask the newly created window to run the command</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "Terminal"'s <b>front</b> <span style="color: #0433ff;"><i>window</i></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #0433ff; text-decoration: underline;"><b>delay</b></span> 0.1</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #0433ff; text-decoration: underline;"><b>do script</b></span> <span style="color: #4e8f00;">myCommand</span> <span style="color: #0433ff;">in</span> <b>its</b> <b>last</b> <span style="color: #0433ff;"><i>tab</i></span></div>
<div style="color: #0433ff; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="text-decoration: underline;"><b>activate</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="color: #272828; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span># And I eventually merge that window to the other so as to keep everything tidy</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> <span style="color: #0433ff;"><i>application</i></span> "System Events" <b>to</b> <b>tell</b> <span style="color: #0433ff;"><i>application process</i></span> "Terminal"</div>
<div style="color: #812fdc; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>set</b> </span><span style="text-decoration: underline;">frontmost</span><span style="color: black;"> <b>to</b> </span><span style="text-decoration: underline;"><i>true</i></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #0433ff; text-decoration: underline;"><b>delay</b></span> 0.1</div>
<div style="color: #812fdc; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0433ff; text-decoration: underline;"><b>keystroke</b></span><span style="color: black;"> "m" </span><span style="color: #0433ff;">using</span><span style="color: black;"> {</span><span style="text-decoration: underline;"><i>control down</i></span><span style="color: black;">, </span><span style="text-decoration: underline;"><i>command down</i></span><span style="color: black;">}</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>return</b></div>
<br />
<div style="color: red; font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="color: black;"><b>end</b> </span>launchMyCommand</div>
<div>
<br /></div>
<span style="font-family: "verdana" , sans-serif;">I save this script as an AppleScript application and I call it "</span><span style="font-family: "courier new" , "courier" , monospace;">>cd</span><span style="font-family: "verdana" , sans-serif;">". Now when I am working in Finder, I just call Spotlight with a system shortcut, I start hitting </span><span style="font-family: "courier new" , "courier" , monospace;">>c</span><span style="font-family: "verdana" , sans-serif;"> and Spotlight autocompletion proposes </span><span style="font-family: "courier new" , "courier" , monospace;">>cd.app</span><span style="font-family: "verdana" , sans-serif;">, I hit Enter and I'm in Terminal with a window opened on the item I wanted.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-44325786335924627692018-03-31T23:30:00.001+09:002018-07-05T11:24:33.165+09:00Searching for empty translations in OmegaT<span style="font-family: Verdana, sans-serif;">OmegaT searches are very powerful. One feature OmegaT does not have (yet?) is the ability to register common searches for later use.</span><br />
<span style="font-family: Verdana, sans-serif;">There are at least 2 RFEs for that on the OmegaT development site, one registered in 2006 (by me) and one in 2014.</span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In the meanwhile, there are at least 2 searches that you want to remember:</span></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<ol>
<li><span style="font-family: Verdana, sans-serif;">searches for non translated segments</span></li>
<li><span style="font-family: Verdana, sans-serif;">searches for segments that have been set to <EMPTY> (they are translated but the translation being empty, the source won't appear in the target document).</span></li>
</ol>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<h3>
<span style="font-family: Verdana, sans-serif; font-size: small;">Searches for non translated segments</span></h3>
<span style="font-family: Verdana, sans-serif;">The logic is straightforward:</span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">You want to search for <b>any one character</b> in <b>source</b> that is <b>untranslated</b>.</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In a search, "any one character" can be expressed by the regular expression "." (period). So you put a period in the search field and you make sure you have selected "Regular expressions" below it. That "any one character" is to be found in "source", so you uncheck anything else but "source" in the line below that. Then you specify "Untranslated", since that's exactly what your looking for, and you can eventually select "all matching segments" to make sure non unique segments are all displayed.</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The search scope will be "Project" and only "Memory".</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_MicON9lBIr__JVNQiBji_NAXQBRynkDtY7mNf-yQhyphenhyphen8tEth28bFSd_jsfncoFhH095DY1crSbgetMhVodnXrH_dWFoeoN8WXrbhfZFMj609SVAZmF8mE3Sv3V3e6F632JoZCKuPKrbE/s1600/Screen+Shot+2018-03-31+at+22.55.02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" data-original-height="197" data-original-width="757" height="83" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_MicON9lBIr__JVNQiBji_NAXQBRynkDtY7mNf-yQhyphenhyphen8tEth28bFSd_jsfncoFhH095DY1crSbgetMhVodnXrH_dWFoeoN8WXrbhfZFMj609SVAZmF8mE3Sv3V3e6F632JoZCKuPKrbE/s320/Screen+Shot+2018-03-31+at+22.55.02.png" width="320" /></span></a></div>
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
</span><br />
<h3>
<span style="font-family: Verdana, sans-serif; font-size: small;">Searches for <EMPTY> segments</span></h3>
<span style="font-family: Verdana, sans-serif;">In OmegaT, when a segment is left untranslated, the source text appears in the target document. An easy way to get around this is to translate the segment with a space. The problem is that sometimes you really want to not use anything in target. For this, OmegaT allows you to "Set [an] empty translation" in the Edit menu. Once you do that, the segment will be empty but translated (it appears in the same color as the other translated segments when you select "Mark translated segments" in the View menu), and OmegaT will display it with the <EMPTY> string when you've left it.</span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">To search for such segments, the logic is a bit different:</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">You want to search for <b>an empty string</b> in <b>target</b> that is <b>translated</b>.</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">In a search, "an empty string" can be expressed by the regular expression "^$" (caret, followed by dollar). The ^ stands for the beginning of the line and the $ for its end, with nothing in between the string is empty. So you put a caret followed by a dollar sign in the search field and you make sure you have selected "Regular expressions" below it. That "empty string" is to be found in "target", so you uncheck anything else but "target" in the line below that. Then you specify "Translated", since that's exactly what your looking for, and you can eventually select "all matching segments" to make sure non unique segments are all displayed.</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">The search scope will be "Project" and only "Memory".</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-family: "verdana" , sans-serif;"><br /></span>
</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsPJwVF4TI1ZDVwr5SbPY5SKI79xN2p4HZLO91cMP0m2ufyru8M_U3bTjEFXy_a_a5HbStfLblMFFT-csxfNcMPqmnCKBBTF-APKq_TVVyXRFoqSwU7mcTcwIWfL7qtjV2qu-j7igwCLI/s1600/Screen+Shot+2018-03-31+at+23.04.50.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" data-original-height="196" data-original-width="757" height="82" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsPJwVF4TI1ZDVwr5SbPY5SKI79xN2p4HZLO91cMP0m2ufyru8M_U3bTjEFXy_a_a5HbStfLblMFFT-csxfNcMPqmnCKBBTF-APKq_TVVyXRFoqSwU7mcTcwIWfL7qtjV2qu-j7igwCLI/s320/Screen+Shot+2018-03-31+at+23.04.50.png" width="320" /></span></a></div>
<br /><div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.comtag:blogger.com,1999:blog-6335460019316576281.post-26766087129394196922018-02-06T17:52:00.001+09:002018-07-05T11:24:54.089+09:00Selecting stuff with AppleScript<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
There was a tweet about Numbers the other day:</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><a href="https://twitter.com/jaimerios/status/960157190354063360">#</a>applescript can be such a pain sometimes to use. Simple things, like getting the selection of the current cell in #numbers is not easy info to come by.</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
I totally understand the author's feeling and my first take was based on a misunderstanding: in the tweet where my reply is (that you can see below his) I took his request as looking for the value of the selected cell, but now that I think of it, he meant "the selected thing <i>within</i> the current cell". So let's take a minute to see how hard it is to find that information in Number's dictionary (hint: it's not there, as far as I can tell):</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
We have 2 items to base our investigation on: "selection" and "cell".</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
Looking for "selection" does not bring anything interesting, we only get "<b>selection range</b>" which is a property of <b>table</b> and returns the "cells currently selected in the table." So let's check "cell". We end up with 1 class and 2 elements (one of <b>table</b> and one of <b>range</b>). So let's check the class:</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><b>cell</b><span style="font-family: "lucida grande"; font-stretch: normal; line-height: normal;"> </span>n [inh. range] : A cell in a table</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
We get a number of properties for <b>cell</b>, including <b>value</b> that return various objects (number, date, text, boolean, or missing value) but further investigation does not help us finding something that returns the textual selection.</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
In fact, checking the dictionaries of the main applications delivered by Apple, only 2 seem to have a way to get a textual selection: Script Editor and Xcode. Page, Keynotes, Numbers, Notes, Preview, TextEdit, Contacts, Calendar, Reminders, Safari, etc. don't have anything. Finder, Mail, Terminal have a "selection" mechanism but only to select objects specific to their models and not to select a textual range.</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
Now, that doesn't mean it is not possible to get the textual selection in the above applications, just that a reasonable investigation into the various dictionaries did not provide us with that information.</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
So, now that we're stuck, the only path I'd think of to access that textual selection is to use GUI scripting to copy the selection, put it in the clipboard and access it from there.</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; text-indent: -45.9px;">
<span style="font-variant-ligatures: no-common-ligatures;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>tell</b> </span><span style="color: #0433ff; text-decoration: underline;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "Numbers"</span></div>
<div style="color: #0433ff; font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 91.7px; text-indent: -91.7px;">
<span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>activate</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 91.7px; text-indent: -91.7px;">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0433ff; text-decoration: underline;"><b>delay</b></span><span style="font-variant-ligatures: no-common-ligatures;"> 0.1</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 91.7px; text-indent: -91.7px;">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> </span><span style="color: #0433ff; text-decoration: underline;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "System Events"</span></div>
<div style="color: #0433ff; font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 137.4px; text-indent: -137.5px;">
<span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>keystroke</b></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> "c" </span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;">using</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> {</span><span style="color: #812fdc; text-decoration: underline;"><i>command down</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;">}</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 91.7px; text-indent: -91.7px;">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; text-indent: -45.9px;">
<span style="font-variant-ligatures: no-common-ligatures;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>end</b> <b>tell</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; min-height: 17px; text-indent: -45.9px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br /></div>
<div style="color: #012fbe; font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; text-indent: -45.9px;">
<span style="color: black; font-variant-ligatures: no-common-ligatures;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>set</b> </span><span style="color: #4e8f00; text-decoration: underline;">mySelection</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>to</b> </span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;"><b>the clipboard</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; min-height: 17px; text-indent: -45.9px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; text-indent: -45.9px;">
Ok, it's ugly. But we got it.</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; min-height: 17px; text-indent: -45.9px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; text-indent: -45.9px;">
Last but not least, I'd like to go back to that "selection" thing.</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; min-height: 17px; text-indent: -45.9px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; text-indent: -45.9px;">
In Script Editor it's very easy to use:</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; min-height: 17px; text-indent: -45.9px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 48.5px; text-indent: -48.6px;">
<span style="font-variant-ligatures: no-common-ligatures;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>tell</b> </span><span style="color: #0433ff; text-decoration: underline;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "Script Editor"</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 97.1px; text-indent: -97.2px;">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>tell</b> </span><span style="color: #0433ff; text-decoration: underline;"><i>document</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "Untitled 3"</span></div>
<div style="color: #812fdc; font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 145.7px; text-indent: -145.7px;">
<span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;">selection's</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> </span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;">properties</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 97.1px; text-indent: -97.2px;">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>end</b> <b>tell</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 48.5px; text-indent: -48.6px;">
<span style="font-variant-ligatures: no-common-ligatures;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>end</b> <b>tell</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 48.5px; min-height: 17px; text-indent: -48.6px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #272828; font-variant-ligatures: no-common-ligatures;">--> </span><span style="font-variant-ligatures: no-common-ligatures;">{</span><span style="color: #0433ff; text-decoration: underline;"><i>class</i></span><span style="font-variant-ligatures: no-common-ligatures;">:</span><span style="color: #0433ff; text-decoration: underline;"><i>selection-object</i></span><span style="font-variant-ligatures: no-common-ligatures;">, </span><span style="color: #812fdc; text-decoration: underline;">character range</span><span style="font-variant-ligatures: no-common-ligatures;">:{35, 60}, </span><span style="color: #812fdc; text-decoration: underline;">contents</span><span style="font-variant-ligatures: no-common-ligatures;">:"tell document \"Untitled 3\""}</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; min-height: 17px; text-indent: -45.9px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; text-indent: -45.9px;">
We get textual information but only the actual text contents, nothing like what the clipboard tells us (with <span style="color: #012fbe; text-decoration: underline;"><b>clipboard info</b></span> for ex).</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; min-height: 17px; text-indent: -45.9px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; text-indent: -45.9px;">
In Xcode we seem to be able to get the "<span style="color: #812fdc; text-decoration: underline;">selected character range</span>" only of source files. RTF files return errors.</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 45.8px; min-height: 17px; text-indent: -45.9px;">
<br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 48.5px; text-indent: -48.6px;">
<span style="font-variant-ligatures: no-common-ligatures;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>tell</b> </span><span style="color: #0433ff; text-decoration: underline;"><i>application</i></span><span style="font-variant-ligatures: no-common-ligatures;"> "Xcode"</span></div>
<div style="color: #812fdc; font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 97.1px; text-indent: -97.2px;">
<span style="color: black; font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-variant-ligatures: no-common-ligatures; text-decoration: underline;">selected character range</span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> <b>of</b> </span><span style="color: #0433ff; text-decoration: underline;"><i>document</i></span><span style="color: black; font-variant-ligatures: no-common-ligatures;"> 4</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; margin-left: 48.5px; text-indent: -48.6px;">
<span style="font-variant-ligatures: no-common-ligatures;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>end</b> <b>tell</b></span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #272828; font-variant-ligatures: no-common-ligatures;">--> </span><span style="font-variant-ligatures: no-common-ligatures;">{1, 5}</span></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br /></div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
and it's easy to get mixed up since for each independent document opened, Xcode will create a "workspace document" that includes it. So if we just create a single source file outside of any project, we still need to refer to it as <span style="color: #0433ff; text-decoration: underline;"><i>document</i></span><span style="font-variant-ligatures: no-common-ligatures;"> 2</span> because <span style="color: #0433ff; text-decoration: underline;"><i>document</i></span><span style="font-variant-ligatures: no-common-ligatures;"> 1</span> will be the enclosing workspace...</div>
<div style="font-family: verdana; font-stretch: normal; line-height: normal; min-height: 17px;">
<br /></div>
<br />
<div style="font-family: verdana; font-stretch: normal; line-height: normal;">
Some applications I use frequently have good selection support: BBEdit works a bit like Script Editor where a simple "<span style="color: #812fdc; text-decoration: underline;">selection</span>" in the application tell block will return the user visible selection. Word needs "<span style="color: #812fdc; text-decoration: underline;">selection's</span><span style="font-variant-ligatures: no-common-ligatures;"> </span><span style="color: #812fdc; text-decoration: underline;">content</span>" to return the textual value of the selection but <span style="color: #812fdc; text-decoration: underline;">selection</span> itself offers plenty of properties including style, etc.</div>
<div class="blogger-post-footer"><hr/>
<a href="http://mac4translators.blogspot.com/2008/02/mac-for-translators-mailing-list.html">Mac for Translators, the discussion group...</a>
<hr/></div>Jean-Christophe Helaryhttp://www.blogger.com/profile/05177466380850385765noreply@blogger.com