🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #9511

Re: get all graphics of selection

#9511
From: Martin Fischer*
Date: Wed, 16 Aug 2006 11:44
60 lines
2358 bytes

      But the graphics you're getting in that case are all the graphics in that
      item, not all the graphics in the selection.




Yes, I know.
So I have to loop thru the items of selection and get allGraphics of item i of selection.

This is a script to switch the display setting of every graphic item of the active spread (if nothing is selected).
If something is selected, it switches the display setting of graphics in selected items only.

 
// SwitchDisplaySetting.jsx  

Object.prototype.isGraphic = function() {      
	switch(this.constructor.name) {      
		case "Image":      
		case "EPS":      
		case "PICT":      
		case "PDF":      
		return true;      
		default :      
		return false;      
	}      
}   

app.displayPerformancePreferences.ignoreLocalSettings = false; 

// all or selection only  
app.selection.length == 0  
	? myObjects = app.layoutWindows[0].activeSpread.pageItems  
	: myObjects = app.selection 

for (oneObject = 0; oneObject < myObjects.length; oneObject++)  
	getGraphics(myObjects[oneObject]) 

// Inventory of graphics  
function getGraphics(theObject){  
	if (!theObject.isGraphic() && theObject.allGraphics.length > 0) {  
		for (oneGraphic = 0; oneGraphic < theObject.allGraphics.length; oneGraphic++)  
			switchDisplaySetting (theObject.allGraphics[oneGraphic])  
	}  
	else if (theObject.isGraphic()) 
		switchDisplaySetting (theObject) 
}  

// switch display setting  
function switchDisplaySetting(theGraph){  
	theGraph.localDisplaySetting == DisplaySettingOptions.highQuality  
		? theGraph.localDisplaySetting = DisplaySettingOptions.typical  
		: theGraph.localDisplaySetting = DisplaySettingOptions.highQuality   
}  




Martin
Technical Details
Message-ID: <3bc1473c.1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing
References: <3bc1473c.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,75905761aef336d1
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Martin Fischer*" <martin.fischer@online.de>
Newsgroups: adobe.scripting.indesign
Subject: Re: get all graphics of selection
Message-ID: <3bc1473c.1@webcrossing.la2eafNXanI>
Date: Wed, 16 Aug 2006 04:44:06 -0700
References: <3bc1473c.-1@webcrossing.la2eafNXanI>
Lines: 56
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing