{"id":5714,"date":"2018-06-11T18:24:15","date_gmt":"2018-06-12T01:24:15","guid":{"rendered":"https:\/\/www.rorohiko.com\/wordpress\/?page_id=5714"},"modified":"2023-05-07T14:06:28","modified_gmt":"2023-05-07T21:06:28","slug":"use-indesign-find-and-replace-to-assign-hyperlinks-to-text","status":"publish","type":"page","link":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/","title":{"rendered":"Use InDesign Find-And-Replace To Assign Hyperlinks To Text"},"content":{"rendered":"<h1>Intro<\/h1>\n<p>How to automatically assign a hyperlink to InDesign text based on find-and-replace pattern matching.<\/p>\n<p>At the\u00a0<a href=\"https:\/\/creativeproweek.com\/\">Creative Pro Week<\/a>\u00a02018 in New Orleans, <a href=\"https:\/\/connect.creativepro.com\/users\/1216277\">Rachel Pozner<\/a> asked about a script that could automatically recognize certain patterns (e.g. SKUs) in InDesign text, and automatically assign hyperlinks to the text.<\/p>\n<p>Challenge accepted!<\/p>\n<p>The following script should help with that:<\/p>\n<p><a href=\"https:\/\/github.com\/zwettemaan\/GryperLink\/blob\/main\/README.md\">https:\/\/github.com\/zwettemaan\/GryperLink\/blob\/main\/README.md<\/a><\/p>\n<p>(Update 12-Mar-2019: v1.0.6: bug fix when processing tables)<\/p>\n<p>(Update 8-Mar-2019: v1.0.4: also search in tables)<\/p>\n<p>(Update 6-Mar-2019: v1.0.3: allow adding optional match criteria for paragraph style, character style, or font name)<\/p>\n<p>(Update 17-Nov-2018: v1.0.2: fixed issue when document has multiple stories with patterns).<\/p>\n<h2>About Rorohiko<\/h2>\n<p>Rorohiko specialises in making printing, publishing and web workflows more efficient.<\/p>\n<p>This script is a free sample of the custom solutions we create for our customers.<\/p>\n<p>If your workflow is hampered by boring or repetitive tasks, inquire at<\/p>\n<p><a href=\"mailto:sales@rorohiko.com\">sales@rorohiko.com<\/a><\/p>\n<p>The scripts we write for our customers repay for themselves within weeks or months.<\/p>\n<h1>Installing And Configuring<\/h1>\n<p>First download the script using the link above.<\/p>\n<p>The downloaded file is in .zip compressed format. You\u2019ll need to decompress it unless your computer already does it automatically for you.<\/p>\n<p>If all is well, you should end up with a file called\u00a0<em>Gryperlink.jsx<\/em>.<\/p>\n<h2>Installing<\/h2>\n<p>A quick way to navigate to the\u00a0<em>Scripts Panel<\/em>\u00a0folder: first launch InDesign.<\/p>\n<p>Bring up the\u00a0<em>Scripts<\/em>\u00a0panel by means of the\u00a0<em>Window \u2013 Utilities \u2013 Scripts<\/em>\u00a0menu item.<\/p>\n<p>Right-click the\u00a0<em>User<\/em>\u00a0folder on the\u00a0<em>Scripts<\/em>\u00a0panel.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5717\" src=\"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/InDesign-CCScreenSnapz001-1.png\" alt=\"\" width=\"244\" height=\"243\" \/><\/p>\n<p>Select\u00a0<em>Reveal in Finder<\/em>\u00a0(Mac) or\u00a0<em>Reveal in Explorer\u00a0<\/em>(Windows) from the contextual menu.<\/p>\n<p>The <em>Scripts\u00a0<\/em>folder will appear. It will contain a sub-folder called\u00a0<em>Scripts Panel.<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5719\" src=\"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-12-at-12.55.54-PM.png\" alt=\"\" width=\"543\" height=\"233\" \/><\/p>\n<p>Double-click the\u00a0<em>Scripts Panel\u00a0<\/em>folder so it opens up.<\/p>\n<p>Move or copy the <em>Gryperlink.jsx<\/em> script into the <em>Scripts Panel<\/em> folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5718\" src=\"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-12-at-12.53.32-PM.png\" alt=\"\" width=\"562\" height=\"233\" \/><\/p>\n<h2>Configuring<\/h2>\n<p>Next, you must configure the script.<\/p>\n<p>To do that, you need to open the <em>Gryperlink.jsx<\/em> file you just installed using a text editor program, like BBEdit, TextWrangler, NotePad, NotePad++, TextMate, Sublime&#8230;<\/p>\n<p>Avoid using a word processor program like TextEdit, Microsoft Word, WordPad\u2026 to edit the script. Word processors often destroy scripts.<\/p>\n<p>There is a section in the script file near the start where you can tweak the script.<\/p>\n<p>Here, you should enter the GREP pattern to search for, and the replacement pattern for the URL.<\/p>\n<p>The\u00a0<em>Gryperlink.jsx<\/em> file initially only contains a single sample GREP expression.<\/p>\n<p>However, you can add multiple GREP patterns and replacement patterns if needed.<\/p>\n<p>The comma <em>between<\/em> two consecutive patterns is mandatory.<\/p>\n<p>Also, you should <em>not<\/em> add a comma after the last pattern.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5716\" src=\"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-12-at-12.34.24-PM.png\" alt=\"\" width=\"500\" height=\"287\" \/><\/p>\n<p>For the sake of argument, I&#8217;ve used simplified patterns in the screenshot above; they have just two lines. Actual patterns can have many more lines than shown, of course.<\/p>\n<p>The mocked-up example above will find all strings of the form<\/p>\n<p><code>123456-78<\/code>\u00a0(6 digits, dash, 2 digits)<\/p>\n<p>and will apply a hyperlink of the form:<\/p>\n<p><code>https:\/\/rwf.co\/?sku=123456-78<\/code><\/p>\n<p>The second GREP pattern will find all strings of the form<\/p>\n<p><code>123456-789<\/code> (6 digits, dash, 3 digits)<\/p>\n<p>and will apply a slightly different type of hyperlink:<\/p>\n<p><code>https:\/\/rwf.co\/?longsku=123456-789<\/code><\/p>\n<p>In addition to the <code>searchPattern<\/code>, there are a few optional patterns which can be used to make the search-and-replace more accurate.<\/p>\n<p>You can restrict the replacement to target only text that has been formatted in specific paragraph styles, or character styles, or fonts.<\/p>\n<p>For example, the pattern below will only apply to text that&#8217;s formatted in a character style &#8216;Partnumber&#8217;, and in a font whose name starts with &#8216;Minion&#8217;. Both these matches are case-insensitive due to the appended &#8216;i&#8217; flag.<\/p>\n<pre><code>{\n  searchPattern: \/(\\d{6}-\\d{2})\/g,\n  link: \"https:\/\/coppieters.nz\/?p=$1\",\n  charStyleName: \"linkstyle\",\n  paraStyleNameSearchPattern: undefined,\n  charStyleNameSearchPattern: \/^Partnumber$\/i,\n  fontNameSearchPattern: \/^Minion\/i\n}<\/code><\/pre>\n<h1>Usage<\/h1>\n<p>Open a document<\/p>\n<p>On the Scripts Panel, under the &#8216;User&#8217; folder, double-click the <em>Gryperlink.jsx<\/em> script.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5720\" src=\"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/InDesign-CCScreenSnapz002.png\" alt=\"\" width=\"754\" height=\"463\" \/><\/p>\n<p>The hyperlinks will appear.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5721\" src=\"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-12-at-1.02.27-PM.png\" alt=\"\" width=\"786\" height=\"448\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Intro How to automatically assign a hyperlink to InDesign text based on find-and-replace pattern matching. At the\u00a0Creative Pro Week\u00a02018 in New Orleans, Rachel Pozner asked about a script that could automatically recognize certain patterns (e.g. SKUs) in InDesign text, and &hellip; <a href=\"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":143,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5714","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>InDesign Find-And-Replace Hyperlink Script - Rorohiko<\/title>\n<meta name=\"description\" content=\"InDesign ExtendScript to use Find-And-Replace for assigning a hyperlink instead of an actual text replacement.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"InDesign Find-And-Replace Hyperlink Script - Rorohiko\" \/>\n<meta property=\"og:description\" content=\"InDesign ExtendScript to use Find-And-Replace for assigning a hyperlink instead of an actual text replacement.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/\" \/>\n<meta property=\"og:site_name\" content=\"Rorohiko Workflow Resources\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-07T21:06:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/InDesign-CCScreenSnapz001-1.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\\\/\",\"url\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\\\/\",\"name\":\"InDesign Find-And-Replace Hyperlink Script - Rorohiko\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rorohiko.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2018\\\/06\\\/InDesign-CCScreenSnapz001-1.png\",\"datePublished\":\"2018-06-12T01:24:15+00:00\",\"dateModified\":\"2023-05-07T21:06:28+00:00\",\"description\":\"InDesign ExtendScript to use Find-And-Replace for assigning a hyperlink instead of an actual text replacement.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rorohiko.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2018\\\/06\\\/InDesign-CCScreenSnapz001-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rorohiko.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2018\\\/06\\\/InDesign-CCScreenSnapz001-1.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Use InDesign Find-And-Replace To Assign Hyperlinks To Text\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/\",\"name\":\"Rorohiko Workflow Resources\",\"description\":\"Custom InDesign Development\",\"publisher\":{\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/#organization\",\"name\":\"Rorohiko Ltd.\",\"url\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rorohiko.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/roro-logo-3d-v2.png\",\"contentUrl\":\"https:\\\/\\\/www.rorohiko.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/roro-logo-3d-v2.png\",\"width\":207,\"height\":200,\"caption\":\"Rorohiko Ltd.\"},\"image\":{\"@id\":\"https:\\\/\\\/rorohiko.com\\\/wordpress\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/zwettemaan\",\"https:\\\/\\\/www.instagram.com\\\/kriscoppieters\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/kristiaan\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"InDesign Find-And-Replace Hyperlink Script - Rorohiko","description":"InDesign ExtendScript to use Find-And-Replace for assigning a hyperlink instead of an actual text replacement.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/","og_locale":"en_US","og_type":"article","og_title":"InDesign Find-And-Replace Hyperlink Script - Rorohiko","og_description":"InDesign ExtendScript to use Find-And-Replace for assigning a hyperlink instead of an actual text replacement.","og_url":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/","og_site_name":"Rorohiko Workflow Resources","article_modified_time":"2023-05-07T21:06:28+00:00","og_image":[{"url":"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/InDesign-CCScreenSnapz001-1.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/","url":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/","name":"InDesign Find-And-Replace Hyperlink Script - Rorohiko","isPartOf":{"@id":"https:\/\/rorohiko.com\/wordpress\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/#primaryimage"},"image":{"@id":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/InDesign-CCScreenSnapz001-1.png","datePublished":"2018-06-12T01:24:15+00:00","dateModified":"2023-05-07T21:06:28+00:00","description":"InDesign ExtendScript to use Find-And-Replace for assigning a hyperlink instead of an actual text replacement.","breadcrumb":{"@id":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/#primaryimage","url":"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/InDesign-CCScreenSnapz001-1.png","contentUrl":"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/06\/InDesign-CCScreenSnapz001-1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/rorohiko.com\/wordpress\/use-indesign-find-and-replace-to-assign-hyperlinks-to-text\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rorohiko.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Use InDesign Find-And-Replace To Assign Hyperlinks To Text"}]},{"@type":"WebSite","@id":"https:\/\/rorohiko.com\/wordpress\/#website","url":"https:\/\/rorohiko.com\/wordpress\/","name":"Rorohiko Workflow Resources","description":"Custom InDesign Development","publisher":{"@id":"https:\/\/rorohiko.com\/wordpress\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rorohiko.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/rorohiko.com\/wordpress\/#organization","name":"Rorohiko Ltd.","url":"https:\/\/rorohiko.com\/wordpress\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rorohiko.com\/wordpress\/#\/schema\/logo\/image\/","url":"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/03\/roro-logo-3d-v2.png","contentUrl":"https:\/\/www.rorohiko.com\/wordpress\/wp-content\/uploads\/2018\/03\/roro-logo-3d-v2.png","width":207,"height":200,"caption":"Rorohiko Ltd."},"image":{"@id":"https:\/\/rorohiko.com\/wordpress\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/zwettemaan","https:\/\/www.instagram.com\/kriscoppieters\/","https:\/\/www.linkedin.com\/in\/kristiaan"]}]}},"_links":{"self":[{"href":"https:\/\/rorohiko.com\/wordpress\/wp-json\/wp\/v2\/pages\/5714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rorohiko.com\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/rorohiko.com\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/rorohiko.com\/wordpress\/wp-json\/wp\/v2\/users\/143"}],"replies":[{"embeddable":true,"href":"https:\/\/rorohiko.com\/wordpress\/wp-json\/wp\/v2\/comments?post=5714"}],"version-history":[{"count":14,"href":"https:\/\/rorohiko.com\/wordpress\/wp-json\/wp\/v2\/pages\/5714\/revisions"}],"predecessor-version":[{"id":5924,"href":"https:\/\/rorohiko.com\/wordpress\/wp-json\/wp\/v2\/pages\/5714\/revisions\/5924"}],"wp:attachment":[{"href":"https:\/\/rorohiko.com\/wordpress\/wp-json\/wp\/v2\/media?parent=5714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}