🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #875

Re: how to set the fillcolor in findTextPreference in cs3 using js?

#875
From: jongware
Date: Fri, 27 Feb 2009 14:45
27 lines
1505 bytes
You are not really clear. What is the problem?

"Request failed because object is from a different document or workspace" is the exact error message that Dave explains in post #2, and suggests a work-around. Martin Fischer provided an implementation of this suggestion.

Martin's script



var myCol = getColor ( 'Blue' );  
// do something with myCol.col  
if ( myCol.created == true )   
	myCol.col.remove();

function getColor ( aColName ) {  
	var aCol = new Object;  
	try {  
		app.swatches.item( aColName ).name;  
		aCol.col = app.swatches.item( aColName );  
		aCol.created = false;  
	} catch (e) {  
		aCol.col = app.colors.add( {name:aColName, space:ColorSpace.rgb, colorValue: [0,0,255]} );  
		aCol.created = true;  
	}  
	return aCol;  
}

doesn't work? Perchance his sample uses the name "Blue" instead of your "Red"? (I'm clutching to straws here.)
Technical Details
Message-ID: <59b6ab99.11@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
References: <59b6ab99.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,201a313e0c494a79
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: jongware@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: how to set the fillcolor in
 findTextPreference in cs3 using js?
Message-ID: <59b6ab99.11@webcrossing.la2eafNXanI>
Date: Fri, 27 Feb 2009 06:45:21 -0800
References: <59b6ab99.-1@webcrossing.la2eafNXanI>
Lines: 30
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit