33 Replies Latest reply on Jun 12, 2015 9:55 AM by rob day

    Adding specific glyphs automatically in a document

    scs38088219

      Hi everyone,

       

      I wondered whether you had a better idea to go about the following issue:

       

      We have 15 pages of small type event listings (100s of them) and I would like to add a specific glyph (number in a circle) next to the venues. The text comes out of the database like this:

       

      Eventname

      Artist

      Where,

      13–17 Aug, £5

       

      Which would be changed to

      Eventname

      Artist

      (1) Where,

      13–17 Aug, £5

       

      So far I used the search & find method to placing a standard number next to the venue. And then as a second step using search & find Glyphs to replace the number with the specific number glyph.

       

      Now I am wondering whether there is a better solution for doing this more quickly, given that there will be around 50 different venues. Or would the only way around this to use a script, which

      I have never used before.

       

       

      I would be grateful for advice.

      Dirgis

       

      Screen shot 2015-06-10 at 12.01.00.png

        • 1. Re: Adding specific glyphs automatically in a document
          Chad Chelius Adobe Community Professional

          It sounds like you've figured out the grep to insert the number at the appropriate location. You can speed this up by copying the glyph to the clipboard and then in the change expression, choose Clipboard Contents, Formatted from the Other submenu. Hopefully this will save you that second step as you describe above.

          • 2. Re: Adding specific glyphs automatically in a document
            Peter Spier Most Valuable Participant (Moderator)

            I suspect you could also use a GREP style to automatically format the digits.

            • 3. Re: Adding specific glyphs automatically in a document
              scs38088219 Level 1

              Hi Chad,

               

              not quite. My search is rather time consuming, looking for the venue name and then adding a number in front of it, see attached.

              There will be also then 50 glyphs to be searched for. Does that mean there is no way around this?

               

               

              Screen shot 2015-06-10 at 13.47.40.png

              • 4. Re: Adding specific glyphs automatically in a document
                Obi-wan Kenobi Adobe Community Professional

                Hi,

                 

                Not clear for me! Can you make a better screenshot of what you really have and what you really want! Thanks!  ;-)

                • 5. Re: Adding specific glyphs automatically in a document
                  rob day Adobe Community Professional & MVP

                  I'm not sure if it could be done easily via find and change, but it could be scripted. What OS are you using?

                  • 6. Re: Adding specific glyphs automatically in a document
                    Obi-wan Kenobi Adobe Community Professional

                    Rob,

                     

                    For fun, I did this with Grep very quickly:

                    Capture d’écran 2015-06-10 à 17.26.25.png

                    … Here, for instance, the number is defined by the word behind! If the op says us what link exists between the words and the numbers, it could be done without pain! 

                    • 7. Re: Adding specific glyphs automatically in a document
                      scs38088219 Level 1

                      That looks pretty close to what I would need.

                       

                      The glyph comes from a different font though and so far I had to do two steps to achieve this.

                      However, surely you must be running all those 5 Greps individually no?

                       

                       

                      @Rob

                      I am working on two systems (Mac 10.6.8) – I do not know the other one by heart, but if it works for this one it should do for the newer one.

                      • 8. Re: Adding specific glyphs automatically in a document
                        Obi-wan Kenobi Adobe Community Professional

                        No, 1 click!

                        The funny tip here [It's a sample for pleasure!] is that if I select, e.g. at the third line, "Hxxx" and type "Oxxx" instead of, the number changes automatically, from 7 to 1! 

                        It's "a kind of magic!" (Queen, 1986, Queen - A Kind of Magic (Official Video) - YouTube)

                        • 9. Re: Adding specific glyphs automatically in a document
                          Peter Spier Most Valuable Participant (Moderator)

                          You absolutely could be setting the font by using a GREP style, though it probably is just as easy to include that in the script.

                          • 10. Re: Adding specific glyphs automatically in a document
                            scs38088219 Level 1

                            Ok so I have never done a script before. How would I go about this?

                             

                            Would I need to set an array with numbers and venues?

                            • 11. Re: Adding specific glyphs automatically in a document
                              Obi-wan Kenobi Adobe Community Professional

                              No need script! If you have a list with numbers and venues [I think yes!] and, say, 2 minutes, it's enough and truly simple to search venues and add the numbers in 1 click as:

                              Search: venue

                              Replace by: number-space-venue

                              Can you show us a part of this list?

                              As Peter said, use grep styles to apply the right font. 

                              • 12. Re: Adding specific glyphs automatically in a document
                                scs38088219 Level 1

                                Hiya,

                                 

                                apologies, I may have not been very clear.

                                 

                                The way I have to do it, is to assign the number to the venue with the search & find function and then replace this number with the alternate glyph which has a different GID

                                as it is an alternate styling glyph. This would need to be done for 50+ venues.

                                 

                                There is no list at this stage, though there will be a map with venue numbers and thus it would be good to assign the same number to

                                these listing pages as well. Yet, depending on how we can do this process we may or may not be able to do it.

                                 

                                Thus my questions:

                                Can this be speeded up in some way?

                                Can I replace alternate styling glyphs via referencing GID in GREP?

                                Can I replace numbers with objects? (In case I have to create numbers, that are not part of this font)

                                 

                                 

                                Again, sorry for not being clear in first place. Thanks for all your help! Really appreciated.

                                • 13. Re: Adding specific glyphs automatically in a document
                                  Obi-wan Kenobi Adobe Community Professional

                                  Hi,

                                   

                                  I find it hard to follow you!

                                  If you have at step n-1:

                                   

                                  artist

                                  (1) Where,

                                  13-17 Aug, £ 5

                                   

                                  [so, it's you who, manually, insert the right numbers between parenthesis] ... and if you would finally get at step n:

                                   

                                  artist

                                  1 Where,

                                  13-17 Aug, £ 5

                                   

                                  i.e., replace "(1)" by "1", "1" is the number with a circle ! …

                                   

                                  ... So it is very very simple!!    one click with one regex!  The number, 1, 25 or 49 won't be absolutely a problem!

                                  • 14. Re: Adding specific glyphs automatically in a document
                                    scs38088219 Level 1

                                    No worries.

                                     

                                    I was just trying to find out whether there was an automated way to doing these steps, rather than doing it manually by hand for each individual venue,
                                    which is yes simple, but takes too long given I need two steps for 50+ of them.

                                     

                                    The time schedule will be tight for x pages with hundreds of listings (venues occurs more than once for different events that are taking place).

                                     

                                    I will continue searching. Thank you though!

                                    • 15. Re: Adding specific glyphs automatically in a document
                                      Obi-wan Kenobi Adobe Community Professional

                                      Sorry, I do not understand you at all:

                                      At one point, you will necessarily make a list of your locations and associate them to numbers!

                                      Right?

                                      When it will be done, your problem will be fixed! 

                                      • 16. Re: Adding specific glyphs automatically in a document
                                        Peter Spier Most Valuable Participant (Moderator)

                                        The alternate GID does throw a wrench in the works (alternate font with the same Unicode position is not a problem). The GREP style might still work, though, if you can make the alternate glyph part of a Glyph Set.

                                        • 17. Re: Adding specific glyphs automatically in a document
                                          rob day Adobe Community Professional & MVP

                                          When I suggested a script I was assuming you were looking for a way to add the numbers based on the venue and that the numbers do not exist in your text.

                                           

                                          So the script below contains two lists and the name of a character style in the first 3 lines. The first list is the names of your venues in quotes separated by commas. The list is case sensitive. The second list is the unicode number for the glyph you want to insert, which you can get from the Glyph panel. And finally the third line is the exact name of a Character style for styling the glyph.

                                           

                                          You'll have to edit the lists. There can be any number of items as long as there is a matching unicode for each. In the example below I'm using FFDingbests for the number font

                                           

                                          ----------------------------

                                          (*edit the two lists, venuelist is a list of names and glyphlist is a list of matching unicode numbers to be associated with each place. glyphstyle is the name of the Character Style to be applied to the glyph*)

                                           

                                          set venuelist to {"Empire State Building", "Venue Two", "Eiffel Tower"}

                                          set glyphlist to {"0031", "0032", "0033"}

                                          set glyphstyle to "VenueGlyph"

                                           

                                          tell application "Adobe InDesign CC 2014"

                                              repeat with i from 1 to count of venuelist

                                                  set g to item i of glyphlist

                                                  set f to item i of venuelist

                                                  set r to "\\x{" & g & "}\\s" & f

                                                  set t to my GrepSearch(f, r, glyphstyle)

                                              end repeat

                                          end tell

                                           

                                          --the search function (find, change, style)

                                          on GrepSearch(f, c, s)

                                              tell application "Adobe InDesign CC 2014"

                                                  set find grep preferences to nothing

                                                  set change grep preferences to nothing

                                                  set find what of find grep preferences to f

                                                  set change to of change grep preferences to c

                                                  tell active document

                                                      set myt to change grep

                                                      repeat with i from 1 to count of myt

                                                          if i is 1 then

                                                              set applied character style of character 1 of item i of myt to s

                                                          else

                                                              set applied character style of character 3 of item i of myt to s

                                                          end if

                                                      end repeat

                                                  end tell

                                                  set find grep preferences to nothing

                                                  set change grep preferences to nothing

                                              end tell

                                          end GrepSearch

                                           

                                           

                                          -------------------------------------

                                           

                                          Screen Shot 2015-06-12 at 8.20.32 AM.png

                                           

                                          Screen Shot 2015-06-12 at 8.20.40 AM.png

                                           

                                          uni.png

                                          • 18. Re: Adding specific glyphs automatically in a document
                                            rob day Adobe Community Professional & MVP

                                            BTW in case it isn't obvious test the script on a copy of your document.

                                            • 19. Re: Adding specific glyphs automatically in a document
                                              rob day Adobe Community Professional & MVP

                                              And here is my example packaged with the compiled script:

                                               

                                              http://www.zenodesign.com/forum/GlyphSearchFolder.zip

                                              • 20. Re: Adding specific glyphs automatically in a document
                                                Obi-wan Kenobi Adobe Community Professional

                                                Rob, Cool!  I keep it for some uses (another script in the ID scripts Panel "Rob Day" subfolder!) Thanks!

                                                 

                                                Capture d’écran 2015-06-12 à 14.59.59.png

                                                 

                                                … But how do you do with 11, 12, 13, …?

                                                … and if you want that effect:

                                                Capture d’écran 2015-06-10 à 22.01.05.png

                                                If, as you say, the op gives a venues list with corresponding numbers, this simple regex will do it!  [ Aha! I love this joke! but the regex is right!  ]

                                                 

                                                Capture d’écran 2015-06-12 à 14.55.34.png

                                                • 21. Re: Adding specific glyphs automatically in a document
                                                  rob day Adobe Community Professional & MVP

                                                  If, as you say, the op gives a venues list with corresponding numbers, this simple regex will do it!

                                                   

                                                  But how do you do with 11, 12, 13, …?

                                                   

                                                  The only reason for resorting to the script is the numbers don't exist, only the venue names—the OP has hundreds of lines with the only the venue. Adding the number via the script's lists would also have the advantage of no typos.

                                                   

                                                  And I was assuming a dingbat glyph is being used (from the #1 post screen capture), so I'm using unicode for the replace, but we could certainly have the replace be any string of digits, like this:

                                                   

                                                  ------------------------------------------------------------------------------------------ -----------

                                                  set venuelist to {"Empire State Building", "Venue Two", "Eiffel Tower", "Venue Three"}

                                                  set glyphlist to {"1", "12", "21", "45"}

                                                  set glyphstyle to "VenueGlyph"

                                                   

                                                  tell application "Adobe InDesign CC 2014"

                                                      repeat with i from 1 to count of venuelist

                                                          set g to item i of glyphlist

                                                          set f to item i of venuelist

                                                          set r to g & "\\s" & f

                                                          set t to my GrepSearch(f, r, glyphstyle)

                                                      end repeat

                                                  end tell

                                                   

                                                  --the search function (find, change, style)

                                                  on GrepSearch(f, c, s)

                                                      tell application "Adobe InDesign CC 2014"

                                                          --tell active document

                                                          set find grep preferences to nothing

                                                          set change grep preferences to nothing

                                                          set find what of find grep preferences to f

                                                          set change to of change grep preferences to c

                                                          tell active document

                                                              set myt to change grep

                                                              repeat with i from 1 to count of myt

                                                                  if i is 1 then

                                                                      set applied character style of word 1 of item i of myt to s

                                                                  else

                                                                      set applied character style of word 2 of item i of myt to s

                                                                  end if

                                                              end repeat

                                                          end tell

                                                          set find grep preferences to nothing

                                                          set change grep preferences to nothing

                                                      end tell

                                                  end GrepSearch

                                                  • 22. Re: Adding specific glyphs automatically in a document
                                                    scs38088219 Level 1

                                                    Hi Rob,

                                                     

                                                    I did not have the chance to try your script yet. Looks amazing though.

                                                     

                                                    Do you think this could work with GID as well? The unicode is unfortunately the same for a number and its few alternate stylings (e.g. the circled number)

                                                    that are only distinguished by GID.

                                                    • 23. Re: Adding specific glyphs automatically in a document
                                                      Obi-wan Kenobi Adobe Community Professional

                                                      You're right! Numbers are not typed in the text! … but there's a correspondances list somewhere, as, maybe, an Excel file!

                                                      So, like you, I only need this list! … What else!, as say George!  ;-)

                                                      • 24. Re: Adding specific glyphs automatically in a document
                                                        rob day Adobe Community Professional & MVP

                                                        Do you think this could work with GID as well?

                                                        My understanding is you can't use GID with GREP, so you have to use the Glyph F/C for GID replacements.

                                                         

                                                        I'm assuming we are talking about single glyphs?

                                                         

                                                        My script applies a character style to the added unicode character, so as long as the font for that style is different than the body text's font you could use the Glyph F/C to replace all instances of the style font's unicode to the needed GID.

                                                         

                                                        The glyph search could be added to the script but I'm guessing it will take you less time to change the 10 instances to the GID than it will for me to add the code

                                                        • 25. Re: Adding specific glyphs automatically in a document
                                                          Peter Spier Most Valuable Participant (Moderator)

                                                          Rob, I haven't played with Stylistic sets, but aren't you able to specify a set as part of a character style? Seems to me if that's true you ought to be able to create a set for the alternate glyphs, specify it in the style and your script ought to work.

                                                          • 26. Re: Adding specific glyphs automatically in a document
                                                            Obi-wan Kenobi Adobe Community Professional

                                                            Rob, using Dingbats font to manage ten numbers will easily work with your [AS] but if 50?

                                                            Of course, the user could find a special font with 50 "bullet" numbers (interested to know one!) or create his special font with IndyFont, but it becomes hot!  ;-)

                                                            • 27. Re: Adding specific glyphs automatically in a document
                                                              Peter Spier Most Valuable Participant (Moderator)

                                                              Evidently the number of digits is NOT an issue for the OP since he's able to work with and alternate glyph for each number.

                                                               

                                                              You are focused on the wrong part of the problem -- it isn't getting the numbers assigned to the venues, which is easy, it's getting the correct alternate glyph (same Unicode, different GID) in place.

                                                              • 28. Re: Adding specific glyphs automatically in a document
                                                                Obi-wan Kenobi Adobe Community Professional

                                                                Peter,

                                                                 

                                                                What I mean is that, if the op wants a special font, e.g., the same font he uses for the rest of the text or Futura, … His choices will be quickly limited (and time!):

                                                                Create his own font with IndyFont or take another quick and simple way!

                                                                I'm truly interested by the way Rob works and very curious of a solution he could find!  ;-)

                                                                • 29. Re: Adding specific glyphs automatically in a document
                                                                  Peter Spier Most Valuable Participant (Moderator)

                                                                  The question here is very specific. While you are correct that there are major problems with numbers in the general case, they clearly are not present here. He already has a solution -- multiple find/change operations to first add the numbers in the correct font and then to change those number glyphs to the alternate glyphs he wants.

                                                                   

                                                                  Seems to me the part that should be scripted is matching the numbers to venues (I don't really read applescript, so I'm not certain what Rob's script is doing), and if the glyphs can be added to a Stylelistic Set, then that can be handled either in the script as well, or via GREP style. No, it won't work for multi-digit numbers without a special font, but it doesn't look as if it needs to.

                                                                  • 30. Re: Adding specific glyphs automatically in a document
                                                                    Obi-wan Kenobi Adobe Community Professional

                                                                    Peter,

                                                                     

                                                                    Imagine the op decides to play the game with a font that looks like Futura with red bullet and blue numbers!

                                                                    … in a second time, his client demands a font that looks like Arial with grey square and green numbers!

                                                                    … and finally, a third choice!…

                                                                    Of course, the game needs 50 numbers: from 1 to 50 … and the numbers with 2 digits will be at current font size 80%!

                                                                     

                                                                    A lot of choice criterias but I don't think this is a crazy event! 

                                                                    • 31. Re: Adding specific glyphs automatically in a document
                                                                      Peter Spier Most Valuable Participant (Moderator)

                                                                      But he isn't asking for that, at least not now, so why don't we try to give him a solution that will work within the limitations of his current situation?

                                                                      • 32. Re: Adding specific glyphs automatically in a document
                                                                        Obi-wan Kenobi Adobe Community Professional

                                                                        Imho, a solution is truly relevant when it can simply be transposable!  ;-)

                                                                        • 33. Re: Adding specific glyphs automatically in a document
                                                                          rob day Adobe Community Professional & MVP

                                                                          matching the numbers to venues (I don't really read applescript, so I'm not certain what Rob's script is doing),

                                                                           

                                                                          That's the way I looked at it, the script simply loops through the provided list of venues and matching numbers or unicodes, and runs a find and change for each. So the script is only useful if the list is long. It's not clear what the numbers or glyphs represent but you could have a case where New York, Paris, and Milan all want a "2" which represents "Fashion" and London has a "4" for "Theater". You could have a list of 50 venues matched up with 5 unique glyphs.

                                                                          {"New York", "Paris", "Milan", "London"}

                                                                          {"0032", "0032", "0032", "0034"}

                                                                           

                                                                          Obviously if you needed double-digit numbers that are going to be styled, the number version in my #21 could be used. In that case you wouldn't need unicode or GID, just styled digits.