🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.photoshop.scripting
Article #616

Re: Batch Processing and Putting Two files together?

#616
From: george_dingwall
Date: Tue, 23 Dec 2008 12:41
43 lines
2573 bytes
Here is a simple script I made a while back that allows you to place one of two different logo files on the image, depending whether the image is upright or horizontal in orientation.

All you need is to put you two logo files in a folder and tell the script which folder they are in. After that, when you run the script, it will place the appropriate logo file onto you image depending on the orientation. I used "C:\\MyLogoA.tif" and "C:\\MyLogoB.tif" for this script.

You can run this script from a batch process.

- - - - - - - - -
var doc = app.activeDocument; // This defines the active document
var width = doc.width.value; // This is the width of the original image
var height = doc.height.value; // This is the height of the original image

// Call the placeLogo function
if(width>height){
	placeLogo("C:\\MyLogoA.tif");
}else{
	placeLogo("C:\\MyLogoB.tif");
}
// This is the placeLogo function
function placeLogo(path)
{
// =======================================================
var id35 = charIDToTypeID( "Plc " );
    var desc8 = new ActionDescriptor();
    var id36 = charIDToTypeID( "null" );
    desc8.putPath( id36, new File( path ) );
    var id37 = charIDToTypeID( "FTcs" );
    var id38 = charIDToTypeID( "QCSt" );
    var id39 = charIDToTypeID( "Qcsa" );
    desc8.putEnumerated( id37, id38, id39 );
    var id40 = charIDToTypeID( "Ofst" );
        var desc9 = new ActionDescriptor();
        var id41 = charIDToTypeID( "Hrzn" );
        var id42 = charIDToTypeID( "#Pxl" );
        desc9.putUnitDouble( id41, id42, 0.000000 );
        var id43 = charIDToTypeID( "Vrtc" );
        var id44 = charIDToTypeID( "#Pxl" );
        desc9.putUnitDouble( id43, id44, 0.000000 );
    var id45 = charIDToTypeID( "Ofst" );
    desc8.putObject( id40, id45, desc9 );
executeAction( id35, desc8, DialogModes.NO );
// =======================================================
}
- - - - - - - - - - - - - -
Technical Details
Message-ID: <59b755e9.2@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
References: <59b755e9.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,98b292b96d549e46
X-Google-Attributes: gidf5839,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: george_dingwall@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.photoshop.scripting
Subject: Re: Batch Processing and Putting Two files together?
Message-ID: <59b755e9.2@webcrossing.la2eafNXanI>
Date: Tue, 23 Dec 2008 04:41:00 -0800
References: <59b755e9.-1@webcrossing.la2eafNXanI>
Lines: 49
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit