4 Replies Latest reply on Feb 20, 2013 4:41 AM by Jennifer Hearing

    Call in different .txt file name, FindChangeByList

    Jennifer Hearing Level 1

      On my home computer, I have been using the script FindChangeByList.jsx that Adobe provides with InDesign. It calls in a .txt file called "myFindChangeByList." (from a folder called "FindChangeSupport") I saved a copy in the same folder and added my own Find/Change items for a specific project. When you run the script, it sees there are two .txt files in the folder and asks you which of the two you want to run. I choose the 2nd, and it runs great.

       

      However,  I am trying to use the file at work. When I try adding the second .txt file to the FindChangeSupport folder, I need admin rights. I would have to call IT and get permission each time I wanted to change the file or add another .txt file.

       

      I did try naming all references to the .txt file to the name of my second file, but that did not work.

       

      I don't know anything about scripting, so I was wondering:

      Is there a way in the script (jsx) file to call in my 2nd .txt file no matter where I save it?

       

      Following is the beginning of the .jsx script -- the file is listed/called several times throughout. I'm assuming I need to change every reference to it?

       

       

      main();

      function main(){

          var myObject;

          //Make certain that user interaction (display of dialogs, etc.) is turned on.

          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

          if(app.documents.length > 0){

              if(app.selection.length > 0){

                  switch(app.selection[0].constructor.name){

                      case "InsertionPoint":

                      case "Character":

                      case "Word":

                      case "TextStyleRange":

                      case "Line":

                      case "Paragraph":

                      case "TextColumn":

                      case "Text":

                      case "Cell":

                      case "Column":

                      case "Row":

                      case "Table":

                          myDisplayDialog();

                          break;

                      default:

                          //Something was selected, but it wasn't a text object, so search the document.

                         myFindChangeByList(app.documents.item(0));

                  }

              }

              else{

                  //Nothing was selected, so simply search the document.

                  myFindChangeByList(app.documents.item(0));

              }