10 Replies Latest reply on Jun 18, 2010 3:49 AM by schiuma24

    Whats the selected links variable for var myLinks =

    schiuma24 Level 1

      Hi, i need to execute a script only for the links selected in the

      links panel, but i dont know the variable, for example var myLinks = myDoc.links is for all the document´s links

        • 1. Re: Whats the selected links variable for var myLinks =
          Kasyan Servetsky Level 5

          I don't think it's possible to get the links selected in the panel, but you can get all the links selected on the active spread. Below is a modified version of a function from my Resize images script that returns selected graphic links.

           

          Kasyan

           

          var myDoc = app.activeDocument;
          var mySelectedLinks = GetAllLinks();
          
          function GetAllLinks() {
                    var myGetAllLinks = [];
                    if (app.selection.length == 1 && app.selection[0].constructor.name == "Image" ) {
                         myGetAllLinks.push(app.selection[0].itemLink);
                    }
                    else if (app.selection.length == 1 && app.selection[0].allGraphics.length == 1) {
                         myGetAllLinks.push(app.selection[0].allGraphics[0].itemLink);
                    }
                    else if (app.selection.length >= 1 && app.selection[0].allGraphics.length > 0) { // Process all graphics in all selections
                         for (var l =  0; l < app.selection.length; l++) {
                              var myAllGraphics = app.selection[l].allGraphics;
                              if (myAllGraphics.length > 0) {
                                   for (var m =  0; m < myAllGraphics.length; m++) {
                                        try {
                                             var myCurrentLink = myAllGraphics[m].itemLink;
                                             myGetAllLinks.push(myCurrentLink);
                                        }
                                        catch(e) {
                                             $.writeln("Error -- " + e.message);
                                        }
                                   }
                              }
                         }
                    }
               return myGetAllLinks;
          }
          
          1 person found this helpful
          • 2. Re: Whats the selected links variable for var myLinks =
            schiuma24 Level 1

            Heres what i need to do, I need to be able to update paths just in the selected links. we have too many files in our magazines and we need to update the path no the new image server but just some of them not all and its a waste of time to be waiting for 2000 files to relink when i just want to relink 500.

            • 3. Re: Whats the selected links variable for var myLinks =
              John Hawkinson Level 5

              What's the metric by which you decide which to relink?

               

              Is it visual? Is it based on the name of the link?

               

              You could export all the links to a text file, then edit the text file to knock out the ones you don't want, and then read the textfile in a script and update the link. Etc.

               

              Tell us more about what you're actually trying to accomplish and how you are doing it now?

              1 person found this helpful
              • 4. Re: Whats the selected links variable for var myLinks =
                schiuma24 Level 1

                We do travel catalogs, so, for example, i have 100 links, 50 links are pictures from europe, 50 are pictures from america, so i have 2 separate folders there for links, then, inside that folder, i have a folder for every country and inside the country theres a folder for every city. Right now Im using Kasyan Servetsky´s update path names in links script. The thing is that the script tries to relink all the 100 files and searches all the subfolders for each and everyone of them. Im just wandering if there is a way to in the links panel select the pictures of, lets say, Spain, Canary Islands, Tenerife, and in the script select the folder for Tenerife it would relink way much faster for it would only look for those pictures.

                • 5. Re: Whats the selected links variable for var myLinks =
                  Kasyan Servetsky Level 5

                  Recently I wrote a new script that relinks missing linked images on folder by folder basis -- you select a list of folders in the dialog and the script searches for images only in these folders and its subfolders.

                   

                  Kasyan

                   

                  / Script for InDesign CS3 and CS4 -- repairs missing links in the active document.
                  // Version 3.0
                  // May 25 2010
                  // Written by Kasyan Servetsky
                  // http://www.kasyan.ho.com.ua
                  // e-mail: askoldich@yahoo.com
                  //--------------------------------------------------------------------------------------------------
                  
                  #target indesign
                  
                  if (Number(String(app.version).split(".")[0]) < 5) ErrorExit("This script requires InDesign CS3 or higher.");
                  if (app.documents.length == 0) ErrorExit("Please open a document and try again.");
                  
                  var gDoc = app.activeDocument;
                  var gLinks = gDoc.links;
                  
                  if (gLinks.length == 0) ErrorExit("This document doesn't contain any links.");
                  if (GetMissingLinks().length == 0) ErrorExit("This document doesn't contain any missing links.");
                  
                  if (app.extractLabel("Kas_RepairMissingLinksInSelectedFolders_ver3.0") != "") {
                       var gSet = eval(app.extractLabel("Kas_RepairMissingLinksInSelectedFolders_ver3.0"));
                  }
                  else {
                       var gSet = {}
                       gSet.folders = [];
                  }
                  
                  var gCounter = 0;
                  var gSelectedFolders = [];
                  
                  CrearLabels();
                  
                  CreateDialog();
                  
                  //-------------------------------------- FUNCTIONS ---------------------------------------------
                  function CreateDialog() {
                       var dlg = new Window("dialog", "Repair missing links");
                       dlg.orientation = "column";
                       dlg.alignChildren = "top";
                       dlg.btnPnl = dlg.add("panel", undefined, "Folders");
                       dlg.btnPnl.orientation = "column";
                       dlg.btnPnl.helpTip = "The script will search missing images in these folders";
                       dlg.btnPnl.listBox = dlg.btnPnl.add("listbox", undefined, gSet.folders, {multiselect:true});
                       var myListBoxBounds = [0, 0, 467, 160];
                       dlg.btnPnl.listBox.bounds = myListBoxBounds;
                       
                       // Buttons
                       dlg.btnPnl.grp = dlg.btnPnl.add("group");
                       dlg.btnPnl.grp.orientation = "row";
                       dlg.btnPnl.grp.addBtn = dlg.btnPnl.grp.add("button", undefined, "Add");
                       dlg.btnPnl.grp.addBtn.helpTip = "Add a  folder to the list";
                       dlg.btnPnl.grp.removeBtn = dlg.btnPnl.grp.add("button", undefined, "Remove");
                       dlg.btnPnl.grp.removeBtn.helpTip = "Remove the selected  folders from the list";
                       dlg.btnPnl.grp.remAllBtn = dlg.btnPnl.grp.add("button", undefined, "Remove All");
                       dlg.btnPnl.grp.remAllBtn.helpTip = "Remove all  folders from the list";
                       
                       // Ok & Cancel
                       dlg.grp = dlg.add("group");
                       dlg.grp.orientation = "row";
                       dlg.grp.alignment = "center";
                       dlg.grp.okBtn = dlg.grp.add("button", undefined, "OK");
                       dlg.grp.cancelBtn = dlg.grp.add("button", undefined, "Cancel");
                       // ---------------------------------------------------------------
                       dlg.btnPnl.grp.addBtn.onClick = function() {
                            var myFolder = Folder.selectDialog ("Select a folder");
                            if (myFolder != null) {
                                 if (!IsInArray(myFolder.fsName, gSet.folders)) {
                                      gSet.folders.push(myFolder.fsName);
                                      var myBounds = dlg.btnPnl.listBox.bounds;
                                      dlg.btnPnl.remove(dlg.btnPnl.listBox);
                                      dlg.btnPnl.listBox = dlg.btnPnl.add("listbox", myBounds, gSet.folders, {multiselect:true});
                                      dlg.btnPnl.listBox.bounds = myListBoxBounds;
                                 }
                                 else {
                                      alert("This folder has been already added.");
                                 }
                            }
                       }
                       // ---------------------------------------------------------------
                       dlg.btnPnl.grp.removeBtn.onClick = function() {
                            if (dlg.btnPnl.listBox.selection != null) {
                                 for (var i = dlg.btnPnl.listBox.selection.length - 1; i  >= 0; i --) {
                                      gSet.folders.splice(dlg.btnPnl.listBox.selection[i].index, 1);
                                      dlg.btnPnl.listBox.remove(dlg.btnPnl.listBox.selection[i]);
                                 }
                            }
                       }
                       // ---------------------------------------------------------------
                       dlg.btnPnl.grp.remAllBtn.onClick = function() {
                            dlg.btnPnl.listBox.removeAll();
                            gSet.folders = [];
                       }
                       // ---------------------------------------------------------------
                       dlg.grp.okBtn.onClick = function() {
                            gSet.folders = [];
                            for (j = 0; j < dlg.btnPnl.listBox.items.length; j++) {
                                 gSet.folders.push(dlg.btnPnl.listBox.items[j].text);
                            }
                            dlg.close(1);
                       }
                       // ---------------------------------------------------------------
                       dlg.grp.cancelBtn.onClick = function() {
                            dlg.close(0);
                       }
                       // ---------------------------------------------------------------
                       var myDialogResult = dlg.show();
                       if (myDialogResult) {
                            app.insertLabel("Kas_RepairMissingLinksInSelectedFolders_ver3.0", gSet.toSource());
                            Main();
                       }
                  }
                  //--------------------------------------------------------------------------------------------------
                  function Main() {
                       if (gSet.folders.length == 0) ErrorExit("No folders have been selected in the dialog box.", true);
                       var missingFolders = [];
                       
                       for (var f = 0; f < gSet.folders.length; f++) {
                            var theFolder = new Folder(gSet.folders[f]);
                            if (theFolder.exists) {
                                 gSelectedFolders.push(theFolder);
                                 AddSubFolders(theFolder);
                            }
                            else {
                                 missingFolders.push(theFolder);
                            }
                       }
                  
                       if (gSelectedFolders.length == 0) ErrorExit("All selected folders don't exist.", true);
                       if (missingFolders.length > 0) {
                            var missingFoldersList = [];
                            for (var m = 0; m < missingFolders.length; m++) {
                                 missingFoldersList.push(missingFolders[m].displayName);
                            }
                            if (!confirm("These folders are missing:\r" + missingFoldersList.join("\r") + "\r\rDo you want to continue?", false, "Warning")) exit();
                       }
                  
                       var w = new Window ("window", "Starting relinking files");
                       var pb = w.add ("progressbar", [12, 12, 350, 24], undefined, undefined);
                       var txt = w.add("statictext");
                       txt.bounds = [0, 0, 340, 20];
                       txt.alignment = "left";
                       w.show();
                       var pbCounter;
                  
                       for (var s = 0; s < gSelectedFolders.length; s++) {
                            var currentFolder = gSelectedFolders[s];
                            w.text = "Current folder - \"" + currentFolder.displayName + "\"";
                  
                            var missingLinks = GetMissingLinks();
                            
                            if (missingLinks.length == 0) {
                                 return;
                            }
                       
                            pb.minvalue = 0;
                            pbCounter = 0;
                            pb.maxvalue = missingLinks.length;
                            
                            for (var i = missingLinks.length-1; i >= 0 ; i--) {
                                 pbCounter++;
                                 pb.value = pbCounter;
                                 var theLink = missingLinks[i];
                                 txt.text = String("Relinking file - " + theLink.name + " (" + (gCounter +1) + ")");
                                 
                                 if (theLink.extractLabel("relinked") != "yes") {
                                      var oldImageFile = new File(theLink.filePath);
                                      var oldPath = oldImageFile.toString();
                                      var newPath = currentFolder.absoluteURI + "/" + theLink.name.replace(" ", "%20");
                                      if (oldPath != newPath) {
                                           if ( // If the link is not a text file
                                                theLink.linkType != "InCopyInterchange" && 
                                                theLink.linkType != "InCopyStory" &&
                                                theLink.linkType != "InCopyMarkup" &&
                                                theLink.linkType != "Microsoft Excel Import Filter" &&
                                                theLink.linkType != "Microsoft Word Import Filter" &&
                                                theLink.linkType != "RTF Import Filter" &&
                                                theLink.linkType != "Text"
                                                ) {
                                                     
                                                Relink(newPath, theLink);
                                           
                                           }
                                      }
                                 }
                            }
                  
                       } // end for
                  
                       w.close();
                  
                       if (gCounter == 1) {
                            alert("One file has been relinked.", "Finished");
                       }
                       else if  (gCounter > 1) {
                            alert(gCounter + " files have been relinked.", "Finished");
                       }
                       else {
                            alert("Nothing has been relinked.", "Finished");
                       } 
                  }
                  //--------------------------------------------------------------------------------------------------
                  function Relink(myNewPath, myLink) {
                       var myNewLink =  new File(myNewPath);
                       if (myNewLink.exists) {
                            myLink.relink(myNewLink);
                            
                            try {
                                 var myCurrentLink = myLink.update();
                            } catch(e){}
                            
                            if ( app.version.substr(0, 3) == "6.0" && (parseInt(app.version.substr(4, 1)) >= 4) ) {
                                 myLink.insertLabel("relinked", "yes");
                            }
                            else {
                                 myCurrentLink.insertLabel("relinked", "yes");
                            }
                            gCounter++;
                       }
                       else {
                       }
                  }
                  //--------------------------------------------------------------------------------------------------
                  function GetMissingLinks() {
                       var missingLinks = new Array();
                       for (var m =  0; m < gDoc.links.length; m++) {
                            if (gDoc.links[m].status == LinkStatus.linkMissing) missingLinks.push(gDoc.links[m]);
                       }
                       return missingLinks;
                  }
                  //--------------------------------------------------------------------------------------------------
                  // Clear labels in case this script has been already run on the current document
                  function CrearLabels() {
                       for (var f =  0; f < gDoc.links.length; f++) {
                            if (gDoc.links[f].extractLabel("relinked") != "") {
                                 gDoc.links[f].insertLabel("relinked", "");
                            }
                       }
                  }
                  //--------------------------------------------------------------------------------------------------
                  function ErrorExit(myMessage, myIcon) {
                       alert(myMessage, "Repair missing links", myIcon);
                       exit();
                  }
                  //--------------------------------------------------------------------------------------------------
                  function IsInArray(myString, myArray) {
                       for (x in myArray) {
                            if (myString == myArray[x]) {
                                 return true;
                            }
                       }
                       return false;
                  }
                  //--------------------------------------------------------------------------------------------------
                  function AddSubFolders(theFolder) {
                       var fileList = theFolder.getFiles();
                       for (var i = 0; i < fileList.length; i++) {
                            var theFile = fileList[i];
                            if (theFile instanceof Folder) {
                                 gSelectedFolders.push(theFile);
                                 AddSubFolders(theFile);
                            }
                       }
                  }
                  //--------------------------------------------------------------------------------------------------
                  
                  • 6. Re: Whats the selected links variable for var myLinks =
                    schiuma24 Level 1

                    Yes, but i dont have missing links, i just want to change the path, we have two locations, Server A and Server B in to different offices, some catalogs have passed from office A to B, so all the links must be updated. problem is, if i use the update path in links script as it is, its gonna take hours for each file, its even faster going manually link by link, but its tedious, if only you could select a bunch a links located in the same folder and select the target folder to search it would be done in seconds.

                    • 7. Re: Whats the selected links variable for var myLinks =
                      Kasyan Servetsky Level 5

                      Here is a version that relinks all links -- not only missing ones.

                      #target indesign
                      
                      if (Number(String(app.version).split(".")[0]) < 5) ErrorExit("This script requires InDesign CS3 or higher.");
                      if (app.documents.length == 0) ErrorExit("Please open a document and try again.");
                      
                      var gDoc = app.activeDocument;
                      var gLinks = gDoc.links;
                      
                      if (gLinks.length == 0) ErrorExit("This document doesn't contain any links.");
                      //~ if (GetMissingLinks().length == 0) ErrorExit("This document doesn't contain any missing links.");
                      
                      if (app.extractLabel("Kas_RepairMissingLinksInSelectedFolders_ver3.0") != "") {
                           var gSet = eval(app.extractLabel("Kas_RepairMissingLinksInSelectedFolders_ver3.0"));
                      }
                      else {
                           var gSet = {}
                           gSet.folders = [];
                      }
                      
                      var gCounter = 0;
                      var gSelectedFolders = [];
                      
                      CrearLabels();
                      
                      CreateDialog();
                      
                      //-------------------------------------- FUNCTIONS ---------------------------------------------
                      function CreateDialog() {
                           var dlg = new Window("dialog", "Repair missing links");
                           dlg.orientation = "column";
                           dlg.alignChildren = "top";
                           dlg.btnPnl = dlg.add("panel", undefined, "Folders");
                           dlg.btnPnl.orientation = "column";
                           dlg.btnPnl.helpTip = "The script will search missing images in these folders";
                           dlg.btnPnl.listBox = dlg.btnPnl.add("listbox", undefined, gSet.folders, {multiselect:true});
                           var myListBoxBounds = [0, 0, 467, 160];
                           dlg.btnPnl.listBox.bounds = myListBoxBounds;
                           
                           // Buttons
                           dlg.btnPnl.grp = dlg.btnPnl.add("group");
                           dlg.btnPnl.grp.orientation = "row";
                           dlg.btnPnl.grp.addBtn = dlg.btnPnl.grp.add("button", undefined, "Add");
                           dlg.btnPnl.grp.addBtn.helpTip = "Add a  folder to the list";
                           dlg.btnPnl.grp.removeBtn = dlg.btnPnl.grp.add("button", undefined, "Remove");
                           dlg.btnPnl.grp.removeBtn.helpTip = "Remove the selected  folders from the list";
                           dlg.btnPnl.grp.remAllBtn = dlg.btnPnl.grp.add("button", undefined, "Remove All");
                           dlg.btnPnl.grp.remAllBtn.helpTip = "Remove all  folders from the list";
                           
                           // Ok & Cancel
                           dlg.grp = dlg.add("group");
                           dlg.grp.orientation = "row";
                           dlg.grp.alignment = "center";
                           dlg.grp.okBtn = dlg.grp.add("button", undefined, "OK");
                           dlg.grp.cancelBtn = dlg.grp.add("button", undefined, "Cancel");
                           // ---------------------------------------------------------------
                           dlg.btnPnl.grp.addBtn.onClick = function() {
                                var myFolder = Folder.selectDialog ("Select a folder");
                                if (myFolder != null) {
                                     if (!IsInArray(myFolder.fsName, gSet.folders)) {
                                          gSet.folders.push(myFolder.fsName);
                                          var myBounds = dlg.btnPnl.listBox.bounds;
                                          dlg.btnPnl.remove(dlg.btnPnl.listBox);
                                          dlg.btnPnl.listBox = dlg.btnPnl.add("listbox", myBounds, gSet.folders, {multiselect:true});
                                          dlg.btnPnl.listBox.bounds = myListBoxBounds;
                                     }
                                     else {
                                          alert("This folder has been already added.");
                                     }
                                }
                           }
                           // ---------------------------------------------------------------
                           dlg.btnPnl.grp.removeBtn.onClick = function() {
                                if (dlg.btnPnl.listBox.selection != null) {
                                     for (var i = dlg.btnPnl.listBox.selection.length - 1; i  >= 0; i --) {
                                          gSet.folders.splice(dlg.btnPnl.listBox.selection[i].index, 1);
                                          dlg.btnPnl.listBox.remove(dlg.btnPnl.listBox.selection[i]);
                                     }
                                }
                           }
                           // ---------------------------------------------------------------
                           dlg.btnPnl.grp.remAllBtn.onClick = function() {
                                dlg.btnPnl.listBox.removeAll();
                                gSet.folders = [];
                           }
                           // ---------------------------------------------------------------
                           dlg.grp.okBtn.onClick = function() {
                                gSet.folders = [];
                                for (j = 0; j < dlg.btnPnl.listBox.items.length; j++) {
                                     gSet.folders.push(dlg.btnPnl.listBox.items[j].text);
                                }
                                dlg.close(1);
                           }
                           // ---------------------------------------------------------------
                           dlg.grp.cancelBtn.onClick = function() {
                                dlg.close(0);
                           }
                           // ---------------------------------------------------------------
                           var myDialogResult = dlg.show();
                           if (myDialogResult) {
                                app.insertLabel("Kas_RepairMissingLinksInSelectedFolders_ver3.0", gSet.toSource());
                                Main();
                           }
                      }
                      //--------------------------------------------------------------------------------------------------
                      function Main() {
                           if (gSet.folders.length == 0) ErrorExit("No folders have been selected in the dialog box.", true);
                           var missingFolders = [];
                           
                           for (var f = 0; f < gSet.folders.length; f++) {
                                var theFolder = new Folder(gSet.folders[f]);
                                if (theFolder.exists) {
                                     gSelectedFolders.push(theFolder);
                                     AddSubFolders(theFolder);
                                }
                                else {
                                     missingFolders.push(theFolder);
                                }
                           }
                      
                           if (gSelectedFolders.length == 0) ErrorExit("All selected folders don't exist.", true);
                           if (missingFolders.length > 0) {
                                var missingFoldersList = [];
                                for (var m = 0; m < missingFolders.length; m++) {
                                     missingFoldersList.push(missingFolders[m].displayName);
                                }
                                if (!confirm("These folders are missing:\r" + missingFoldersList.join("\r") + "\r\rDo you want to continue?", false, "Warning")) exit();
                           }
                      
                           var w = new Window ("window", "Starting relinking files");
                           var pb = w.add ("progressbar", [12, 12, 350, 24], undefined, undefined);
                           var txt = w.add("statictext");
                           txt.bounds = [0, 0, 340, 20];
                           txt.alignment = "left";
                           w.show();
                           var pbCounter;
                      
                           for (var s = 0; s < gSelectedFolders.length; s++) {
                                var currentFolder = gSelectedFolders[s];
                                w.text = "Current folder - \"" + currentFolder.displayName + "\"";
                      
                           
                                pb.minvalue = 0;
                                pbCounter = 0;
                                pb.maxvalue = gLinks.length;
                                
                                for (var i = gLinks.length-1; i >= 0 ; i--) {
                                     pbCounter++;
                                     pb.value = pbCounter;
                                     var theLink = gLinks[i];
                                     txt.text = String("Relinking file - " + theLink.name + " (" + (gCounter +1) + ")");
                                     
                                     if (theLink.extractLabel("relinked") != "yes") {
                                          var oldImageFile = new File(theLink.filePath);
                                          var oldPath = oldImageFile.toString();
                                          var newPath = currentFolder.absoluteURI + "/" + theLink.name.replace(" ", "%20");
                                          if (oldPath != newPath) {
                                               if ( // If the link is not a text file
                                                    theLink.linkType != "InCopyInterchange" && 
                                                    theLink.linkType != "InCopyStory" &&
                                                    theLink.linkType != "InCopyMarkup" &&
                                                    theLink.linkType != "Microsoft Excel Import Filter" &&
                                                    theLink.linkType != "Microsoft Word Import Filter" &&
                                                    theLink.linkType != "RTF Import Filter" &&
                                                    theLink.linkType != "Text"
                                                    ) {
                                                         
                                                    Relink(newPath, theLink);
                                               
                                               }
                                          }
                                     }
                                }
                      
                           } // end for
                      
                           w.close();
                      
                           if (gCounter == 1) {
                                alert("One file has been relinked.", "Finished");
                           }
                           else if  (gCounter > 1) {
                                alert(gCounter + " files have been relinked.", "Finished");
                           }
                           else {
                                alert("Nothing has been relinked.", "Finished");
                           } 
                      }
                      //--------------------------------------------------------------------------------------------------
                      function Relink(myNewPath, myLink) {
                           var myNewLink =  new File(myNewPath);
                           if (myNewLink.exists) {
                                myLink.relink(myNewLink);
                                
                                try {
                                     var myCurrentLink = myLink.update();
                                } catch(e){}
                                
                                if ( app.version.substr(0, 3) == "6.0" && (parseInt(app.version.substr(4, 1)) >= 4) ) {
                                     myLink.insertLabel("relinked", "yes");
                                }
                                else {
                                     myCurrentLink.insertLabel("relinked", "yes");
                                }
                                gCounter++;
                           }
                           else {
                           }
                      }
                      //--------------------------------------------------------------------------------------------------
                      // Clear labels in case this script has been already run on the current document
                      function CrearLabels() {
                           for (var f =  0; f < gDoc.links.length; f++) {
                                if (gDoc.links[f].extractLabel("relinked") != "") {
                                     gDoc.links[f].insertLabel("relinked", "");
                                }
                           }
                      }
                      //--------------------------------------------------------------------------------------------------
                      function ErrorExit(myMessage, myIcon) {
                           alert(myMessage, "Repair missing links", myIcon);
                           exit();
                      }
                      //--------------------------------------------------------------------------------------------------
                      function IsInArray(myString, myArray) {
                           for (x in myArray) {
                                if (myString == myArray[x]) {
                                     return true;
                                }
                           }
                           return false;
                      }
                      //--------------------------------------------------------------------------------------------------
                      function AddSubFolders(theFolder) {
                           var fileList = theFolder.getFiles();
                           for (var i = 0; i < fileList.length; i++) {
                                var theFile = fileList[i];
                                if (theFile instanceof Folder) {
                                     gSelectedFolders.push(theFile);
                                     AddSubFolders(theFile);
                                }
                           }
                      }
                      //--------------------------------------------------------------------------------------------------
                      
                      • 8. Re: Whats the selected links variable for var myLinks =
                        schiuma24 Level 1

                        is there a way to exclude file extensions?

                        • 9. Re: Whats the selected links variable for var myLinks =
                          Kasyan Servetsky Level 5
                          is there a way to exclude file extensions?

                          Do you want the script to ignore the links of a certain type?

                          If so, you can add new types to the if-statement:

                          ...

                          theLink.linkType != "Microsoft Word Import Filter" &&

                          theLink.linkType != "RTF Import Filter" &&

                          theLink.linkType != "Text" &&

                          theLink.linkType != "JPEG"

                          and so on.

                           

                          I think this approach is better since on Mac files can be with or without extensions.

                           

                           

                          Kasyan