9 Replies Latest reply on Jun 2, 2017 3:01 AM by vinny38

    Selecting price but not dollar sign


      I have two 300 page catalogues that I'm moving into Indesign from Quark, and the software I'm using to create a editable database of prices has to be rebuilt manually. That means I have to select each price and give it a code.


      The problem: When I double click on a price (say $239.95) I want the price with decimals, but not the dollar sign. Right no if I click on the .95 I get the numbers before the decimal. If I click on the 239 I get those 3 numbers and the dollar sign.


      To sum up: I want to double click on $239.95 and select  only 239.95



        • 1. Re: Selecting price but not dollar sign
          [Jongware] Most Valuable Participant

          Use a GREP search. You cannot change ID's built-in double-click behavior -- it is based on, I believe, the distinction between spaces and punctuation, and "word" characters. In addition, a GREP search can be done entirely using the keyboard, which is my preferred way of quickly going through a document over point and clicking anyway.


          The GREP can be as simple as "(?<=\x24)\d+\.\d\d\b" (enter it without the quotes). Every Find Next keypress will automatically locate the next occurrence of your dollar amount, right up until you see you are going back to the first page.


          A more advanced trick is this: search for "text in black", using this GREP, and change it to be red. Whenever you search again -- this time around add "Red" to the Search formatting -- apply your special code, then change the text color back to black. That way, you will go through the document only once and miss not a single occurrence!


          What sort of code are you applying, by the way? If it's something like a special formatting, condition, or character style, you can forget the above paragraph and put it straight into the Change To formatting, then do a global Change All.

          1 person found this helpful
          • 2. Re: Selecting price but not dollar sign
            kevins42458544 Level 1

            I'm using Incatalog to build a database that can update the entire catalogue with revised pricing once the document pricing is coded.


            I have to select & copy each code (which is listed beside the price), then select the corresponding price and paste the code into the data menu so they link.


            I tried the GREP function you mention, and while it does work, it's awkward as the search jumps to the beginning of the text box after I select the next code to copy.


            I basically need to: select(code)/copy/select(price)/paste as fast as possible.

            • 3. Re: Selecting price but not dollar sign
              MW Design Level 5

              I haven't used InCatalog. But are you sure it doesn't have the capability of formatting the prices sans currency marker? I thought it did when I last looked at it. If it were me, I would shoot Chris or their technical support an email and inquire.



              • 4. Re: Selecting price but not dollar sign
                kevins42458544 Level 1

                It's not about formatting, it's about selecting the price with a double click. I have spoken directly to Joe at EM software (the makers of InCatalog), and this is his response:

                "It is frustrating in InDesign to not be able to select a price as if it were a single word, as one can in QXP. Essentially, make sure you’re zoomed in close enough, have hidden characters showing, and get good at click-dragging through the price to select it.

                Wish I had a better answer."


                So I guess I have my answer unless ID people have a secret solution or tweak in their future versions.

                • 5. Re: Selecting price but not dollar sign
                  vinny38 Level 4

                  Hi (I don't use InCatalog either)

                  Couldn't a script be of any help?

                  If I understand well, you could easily script:

                  1. Search for a code with no condition next to a price, using GREP *
                  2. Copy
                  3. changeTo= condition (i.e. "code")
                  4. New grep query to catch the price next to this code without the $ sign.
                  5. optional : add a condition to price, or char style. Could be helpful.
                  6. Exit. I suppose at this point all you got to do is to paste your code into the InCatalog data menu.


                  * Not knowing what you mean by "which is listed beside the price", it's impossible to give a GREP example. Are they in a table? separated by a tab, or anything else? do they have a specific format that could be used for a regex?... Think Screenshots...

                  • 6. Re: Selecting price but not dollar sign
                    kevins42458544 Level 1

                    I'm not super familiar with the GREP script writing but could enter one if someone else knew how to write it.


                    Each product has a text box with a title, description and then code and price. Some are separated by one tab, some 2 (I inherited the design). Sometimes there are multiple codes/prices for listing with different sizes/colours etc.


                    In the screenshot I've selected and copied the code, then selected the price and pasted the code into the "Key" area in the data box at right, which links the price to that code in the database.


                    I need to do this a lot. 


                    So other than click-dragging the price would there be a way to select the price that follows a 5 digit code without the $ sign and in sequence moving down a mulitple code/price situation? Someone posted above how to select the price using GREP but it starts at the top of the box every time I move to the next code in mulitple code/price situations.



                    Screen Shot 2017-06-01 at 10.34.46 AM.png

                    Screen Shot 2017-06-01 at 10.42.20 AM.png

                    • 7. Re: Selecting price but not dollar sign
                      Obi-wan Kenobi Level 5



                      I don't understand at all what you're trying to do!!


                      ... I simply answer to the original question: "selecting price but not dollar sign"


                      Instead of trying to select it except $, just place the cursor into the text, e.g. "$239.95" (considered as a "word") and play this:


                      app.selection[0].words[0].characters.itemByRange(1, app.selection[0].words[0].characters.length-1).showText();


                      Associated to a keyboard shortcut, this JS code line will select "239.95"!



                      • 8. Re: Selecting price but not dollar sign
                        kevins42458544 Level 1

                        We have a winner! I don't know much about scripting but I saved that as a .jsx file and googled how to install it as a script and create a keyboard shortcut. So I just put my cursor in the price and hit "command g" (close to command c for speed) and it selects just the price with no dollar sign.


                        Apparently Obi-wan user name checks out.



                        • 9. Re: Selecting price but not dollar sign
                          vinny38 Level 4


                          since Obi wan came up with a nice and easy solution, you probably finished your job already.


                          However, in order to practice scripting (which I'm trying to learn), I did try to script it as an exercise.

                          There is probably a lot of things to improve in this one, and if scripting gurus want to correct or give advises, it would be great...

                          Still... it kinda of work... Assuming two conditions have been created first (code and price  in this example)


                          So here it is, for information purpose:


                          var myDocument = app.documents.item(0);
                          //Clear the find/change grep preferences.
                          app.findGrepPreferences = NothingEnum.nothing;
                          app.changeGrepPreferences = NothingEnum.nothing;
                          //Set the find options.
                          app.findChangeGrepOptions.includeFootnotes = false;
                          app.findChangeGrepOptions.includeHiddenLayers = false;
                          app.findChangeGrepOptions.includeLockedLayersForFind = false;
                          app.findChangeGrepOptions.includeLockedStoriesForFind = false;
                          app.findChangeGrepOptions.includeMasterPages = false;
                          try {
                          //GREP search for 6 digit code with no condition:
                          app.findGrepPreferences.findWhat ="\\d{6}(?=\\t\\x24\\d+\\.\\d\\d)";
                          app.findGrepPreferences.appliedConditions = [];
                          var myCodes = app.activeDocument.findGrep();
                          var myCode = myCodes[0]; // Get first item of myCodes Array
                          var myCodeCondition = "code"; // Name the condition you created for code here
                          app.select(myCode); //select code
                          app.copy(myCode); //copy it
                          app.selection[0].applyConditions (app.activeDocument.conditions.item(myCodeCondition, true));   //apply condition, so it won't be searched again
                          //then lets' target the price. Based on this pattern: 6 digits + tab + dollar + n digits + dot + 2 digits
                          app.findGrepPreferences.findWhat ="(?<=\\x24)\\d+\\.\\d{2}";
                          app.findGrepPreferences.appliedConditions = [];
                          var myPrices = app.activeDocument.findGrep();
                          var myPrice = myPrices[0]; // Get first item of myPrices Array
                          var myPriceCondition = 'price'; // Name the condition you created for price here
                          app.select(myPrice); //select code
                          app.selection[0].applyConditions (app.activeDocument.conditions.item(myPriceCondition, true));   //apply condition, so it won't be searched again
                          catch(err) {
                              alert("OK, you're done!");