🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.photoshop.scripting
Article #505

Re: Text background fill

#505
From: Paul_R
Date: Fri, 02 Jan 2009 16:47
67 lines
2030 bytes
Like this...


 
if (documents.length)  

{  

var originalRulerUnits = preferences.rulerUnits;  

preferences.rulerUnits = Units.PIXELS;  

var txtLayer = activeDocument.artLayers.add();  

txtLayer.kind = LayerKind.TEXT;  

txtLayer.textItem;  

txtLayer.textItem.size = 60;  

txtLayer.textItem.font = "ArialNarrow";  

var TXTColor = new SolidColor; 

TXTColor.rgb.hexValue = '00ffc8';  

txtLayer.textItem.color = TXTColor;  

var X = ((activeDocument.width/100)*2); 

var Y = ((activeDocument.height/100)*98); 

txtLayer.textItem.position = new Array( X, Y);  

txtLayer.textItem.contents = activeDocument.name.slice(0,-4); 

var LB=activeDocument.activeLayer.bounds; 

var textBackLayer = activeDocument.artLayers.add();  

txtLayer.move( activeDocument.activeLayer, ElementPlacement.PLACEBEFORE) 

var Height = LB[3].value - LB[1].value;  

var Width = LB[2].value - LB[0].value;  

activeDocument.selection.select([[LB[0],LB[1]], [LB[2],LB[1]], [LB[2],LB[3]], [LB[0], LB[3]]], SelectionType.REPLACE, 0, false); 

//Background fill colour. 

var FillColor = new SolidColor; 

FillColor.rgb.hexValue = 'ffff00';  

activeDocument.selection.fill(FillColor); 

activeDocument.selection.deselect(); 

activeDocument.flatten(); 

preferences.rulerUnits = originalRulerUnits;  

} else {  

alert( "No Document Open");  

}   
Technical Details
Message-ID: <59b76899.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!webcrossing
References: <59b76899.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,316cbaf55885981b
X-Google-Attributes: gidf5839,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Paul_R@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.photoshop.scripting
Subject: Re: Text background fill
Message-ID: <59b76899.0@webcrossing.la2eafNXanI>
Date: Fri, 2 Jan 2009 08:47:17 -0800
References: <59b76899.-1@webcrossing.la2eafNXanI>
Lines: 69
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Original-Lines: 37