🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1654

Re: Update link - js assistance

#1654
From: Rasmus_Olsen
Date: Mon, 02 Feb 2009 10:47
31 lines
2146 bytes
Kasyan,

I've used your script to alert out a sort of link report - se script below. Can myLog variable be written to a txtfile with same path as current document using InDesign API? I've looked in the Core Javascript Core Objectmodel viewer under the File classes but got lost in the code.. :-)



 
var myDoc = app.activeDocument; 
checkLinkNormal(); 
function checkLinkNormal() { 
	var myLog1 = new String; 
	var myLog2 = new String; 
	var myLog3 = new String; 
	for(var myCounter = 0; myCounter < myDoc.links.length; myCounter++) {  		var myLink = myDoc.links[myCounter];  		if(myLink.status != LinkStatus.normal) {  			if(myLink.status == LinkStatus.linkOutOfDate) {  				myLog1 += 'Link #'+myCounter+' name: '+myLink.name+'.\n';  				myLink.update();  			}  			else if(myLink.status == LinkStatus.linkMissing) {  				myLog2 += 'Link #'+myCounter+' name: '+myLink.name+' Link #'+myCounter+' path: '+myLink.filePath+'.\n';  			}  			else if(myLink.status == LinkStatus.linkEmbedded) {  				myLog3 += 'Embedded links: \nLink name: '+myLink.name+'.\n';				  			}  		}  	}  	if(myLog1.length > 0) { 
		alert('Links updated: \n'+myLog1); 
	} 
	if(myLog2.length > 0) { 
		alert('Missing links: \n'+myLog2); 
	} 
	if(myLog3.length > 0) { 
		alert('Embedded links: \n'+myLog3); 
	} 
} 




BTW Isn't there an easier method to posting script with formatting preserved? I've googled a "script poster" with no luck.

Best regards,
Rasmus
Technical Details
Message-ID: <59b7bbb3.5@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!news.glorb.com!news-xfer.nntp.sonic.net!news.astraweb.com!border5.newsrouter.astraweb.com!newshub.sdsu.edu!webcrossing
References: <59b7bbb3.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,91cecb121be77b84
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Rasmus_Olsen@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!news.glorb.com!news-xfer.nntp.sonic.net!news.astraweb.com!border5.newsrouter.astraweb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: Update link - js assistance
Message-ID: <59b7bbb3.5@webcrossing.la2eafNXanI>
Date: Mon, 2 Feb 2009 02:47:53 -0800
References: <59b7bbb3.-1@webcrossing.la2eafNXanI>
Lines: 47
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit