What is the variable of links selected for myLinks = var
Hi, I need to run a script only for the selected links in the
the links Panel, but I don't know the variable, for example the myLinks var = myDoc.links is for all document´s links
Here's a version that rebuilt all the links - missing not only those.
#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); } } } //--------------------------------------------------------------------------------------------------
Tags: InDesign
Similar Questions
-
What is the latest version of Firefox for my laptop from August 2011?
I'm running Windows 8 (xp) and you plan to switch to Firefox. I would like to know what is the latest version of Firefox for my laptop?
Do you mean IE8? Windows 8 was not released.
You can use the latest version, Firefox 5.0.1. Look at the system requirements carefully to be sure that only what is necessary, especially the Pentium 4 processor and enough RAM since many XP systems came with only 256 MB. Right-click on the 'My Computer' icon on your desktop and select properties for the basic information about your system in the 'General tab '.
- System requirements: https://www.mozilla.com/en-US/firefox/5.0/system-requirements/index.html
- Install Firefox: http://support.mozilla.com/en-US/kb/Installing+Firefox
- Download from (select the language and OS): http://www.mozilla.com/en-US/firefox/all.html
If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.
-
What is the use of links and the executable section in a pageDef?
Hello
What is the use of links and executable section in a page view definition file.
I know that we can add different types of links to page with links that are not there in the page what use executable?
If I click on the icon I get different types of iterators and stocks + green. If the two are even why we we both kept?
Thank you
REDA
Hi Ashish I put in it,
Now, only I realized the problem is with the lifecycle ADF
If I place a logging operation in the method of the request form, we will see that the method is called twice and that is why exceptions are thrown. Change the property of refreshment of the invokeAction of prepareModel to renderModelIfNeeded. The commit operation will work with this change and the invokeAction will be called once again because it will be necessary. Once again, the point of the example is to call the invokeAction but for the validation button, as is evident, the value of prepareModel was not enough. The value renderModuleIfNeeded ends the validation operation. .
-
What is the best program to use for invitations and cards?
I'm looking to build my own invitations and other stuff like business cards... What is the best program to use for this? At work, I use InDesign for booklets of customer and brochures - but looking for a program that can do a bit more to my invitations.
Thank you!
Cold you use whichever you choose. Each has its advantages.
These links can help you to choose:
http://www.printwand.com/blog/when-to-use-Adobe-Illustrator-vs-Photoshop-VS-InDesign
http://www.ehow.com/about_5378077_photoshop-vs-Illustrator.html
-
What is the latest version of Safari for OX 10.8.5 I Safari 6.0.5 and it does not work well, but I DO NOT update my OS for good reasons. When updated with the latest system all going nuts with the software. Apple always wants us to be updated, but it messes things and then we have all the new software. Is Safari 6.0.5 later that I can run with my 10.8.5 OX? My Firefox works very well and I prefer it to Google Chrome, but what other browsers could I use better than the Safai I if I can't get a later version of Safari? Thank YOU if you reply
Safari 6.2.8. Open the Mac App Store, click the updates tab and install Safari or security updates that appear.
(143364)
-
What is the latest version of safari for OS Lion
What is the latest version of Safari for OS Lion
Version 6.
Mavericks, Yosemite and El Capitan using version 9.
-
What is the best protector of screen for iPhone 6 s Please?
What is the best protector of screen for iPhone 6 s Please?
Anyone who has a type of glass
-
What is the latest version of safari for mac 10.7.5?
What is the latest version of safari for mac 10.7.5?
The latest version of Safari would be available since last year, he took charge.
As upgrades of the Safari browser are usually attached to the version of OS X itself, only
Some OS X systems have seen than Safari upgrades without a new OS X too.
• Safari version history, Mac compatibility:
https://en.Wikipedia.org/wiki/Safari_version_history#Mac
• Safari (web browser)
https://en.Wikipedia.org/wiki/Safari_%28web_browser%29
Which version you see in your OS X applications? It should be (maybe) Safari 6.1.6
If the software update cannot show you something more recent (for Lion 10.7.5) then you're there.
-
What is the latest version of Safari for PC? I need an update
What is the latest version of Safari for PC? I need an update. I'm running on 5.1.7!
Help
One you have. Apple has continued to develop.
(138014)
-
What resistance the Thermocouple VI convert use for thermistor CYC?
What resistance the Thermocouple VI convert use for thermistor CYC?
No, I do not claim that. I was just trying to interpret what you said.
You indicated that you were using the Thermocouple convert VI. VI has a 'Sensor CSF' entry, and it can a value "Sensor IC" or "thermistor". So, I assumed you were talking about using this VI with "Sensor of CYC" = "thermistor". In this case the VI calls the convert thermistor reading VI to convert the voltage to temperature. It uses the default values for the resistance, and I guess that's what you were asking about. If you open the Panel before convert thermistor reading, you can see what resistance values it uses.
-
What is the maximum amount of RAM for the HP ENVY 15-j015sr model?
By default, the model HP ENVY 15-j015sr worth DDR3L SDRAM 8 GB. What is the maximum amount of RAM for this model?
Where can I find a list of the modules supported DDR3L SDRAM for this model?
Service guide says like that
Two clients-available/expandable
memory module slots
Support for DDR3L (1600 MHz)
dual channel
Support for 16834-MB of RAM
in the following configurations:
● 16834-MB (8192 MB × 2)
● 12288 MB (8192 MB + 4096 MB)
● (8192 MB × 1, 4096 - 8192 MB
MB × 2)
● 6144 MB (4096 MB + 2048 MB)
● 4096 MB (4096 MB × 1, 2048-
MB × 2) -
What is the best browser to use for a home user?
What is the best browser to use for a home user,
original title: browser
It's really a matter of personal preference. He has Firefox, Chrome, Safari and many more. They have differences, but as long as you have a decent security program, it is really important that you use. Try a few and see what you think. They are easy to install and easy to remove. Most will import your Favorites during the installation.
-
I would like to ask what is the official number of built for windows 7 tnx
I would like to ask what is the official number of built for windows 7 tnx
Hello Goka86, this is 7600. Paul Smith - MVP for Windows desktop experience... I crawled off NNTP - for now. Detachment Aldershot, United Kingdom. On the internet at windowsresource.net and dasmirnov.net. Please post back to let us know what works and what does not. :-)
-
What is the incoming and outgoing POP3 for AOL?
What is the incoming and outgoing POP3 for aol?
Hello
the servers are:
for POP3 - pop.aol.com
for SMTP - smtp.aol.com
But you need to change the port number in 587 for SMTP .
You can see here - how to configure Outlook 2002 and Outlook 2003 for SMTP and POP3: click here
(the last photo is important - you need to check - this server requires an encrypted connection SSL - SMTP and POP3 too)
LC
-
What is the latest hardware and drivers for windows XP
What is the latest hardware and drivers for my windows xp
'Last hardware drivers' for your computer will be found on the download page of the manufacturer of the device or the computer. Why do you ask?
Maybe you are looking for
-
Hello world I have a satellite M30, and the 'PC Diagnostic tool' utility does not work (nothing happens when I click on the program). I have windows XP service pack 1. I uninstalled and downloaded a new site of toshiba, but it still does not work. No
-
do you need your router firewall
Do you need the firewall on the router.
-
Boot Windows XP on old HP XE813 problem
Hello. I just got a HP XE813 of my friend who doesn't have a working disk drive. It has a hard drive, I put in with Windows XP, but it does not start. This last thing it loads successfully is "Mup.sys" in safemode, then it freezes and restarts. Is th
-
Can I simulate the acquisition of a working folder?
Hello I am using vision builder to perform an inspection, and I'm the images that pass inspection and filtering images that are not and save each in a different folder. I want that whenver there is a bad image, a copy of the last "good image" is sav
-
Do not print on the Dell AIO printer. It passes through the movement of printing, but does not print.