🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.photoshop.scripting
Article #280

Re: Any way to create or influence Animation-Frames by a script?

#280
From: Jochen_B_Winkler
Date: Wed, 18 Feb 2009 10:31
59 lines
3061 bytes
I solved the problem by now using the ScriptingListener. If you encounter the same problems, the functions below may help. However, I found no way of requesting the current frame - so you have to take track on how much frames you have and which frame is the current frame.

function jumpToFrame(frameNumber)
{
var idslct = charIDToTypeID( "slct" );

var desc30 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref25 = new ActionReference();
        var idanimationFrameClass = stringIDToTypeID( "animationFrameClass" );

ref25.putIndex( idanimationFrameClass, frameNumber );
    desc30.putReference( idnull, ref25 );
executeAction( idslct, desc30, DialogModes.NO );
}

function previousFrame()
{
	var idanimationFrameActivate = stringIDToTypeID( "animationFrameActivate" );

var desc26 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref21 = new ActionReference();
        var idanimationFrameClass = stringIDToTypeID( "animationFrameClass" );

var idOrdn = charIDToTypeID( "Ordn" );
        var idPrvs = charIDToTypeID( "Prvs" );
        ref21.putEnumerated( idanimationFrameClass, idOrdn, idPrvs );
    desc26.putReference( idnull, ref21 );
	executeAction( idanimationFrameActivate, desc26, DialogModes.NO );
}

function nextFrame()
{
	var idanimationFrameActivate = stringIDToTypeID( "animationFrameActivate" );
    var desc27 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref22 = new ActionReference();
        var idanimationFrameClass = stringIDToTypeID( "animationFrameClass" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idNxt = charIDToTypeID( "Nxt " );
        ref22.putEnumerated( idanimationFrameClass, idOrdn, idNxt );
    desc27.putReference( idnull, ref22 );
	executeAction( idanimationFrameActivate, desc27, DialogModes.NO );
}

function newFrame()
{
	var idDplc = charIDToTypeID( "Dplc" );
    var desc39 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref33 = new ActionReference();
        var idanimationFrameClass = stringIDToTypeID( "animationFrameClass" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref33.putEnumerated( idanimationFrameClass, idOrdn, idTrgt );
    desc39.putReference( idnull, ref33 );
	executeAction( idDplc, desc39, DialogModes.NO );
}
Technical Details
Message-ID: <59b7f715.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
References: <59b7f715.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,30636a782a149a66
X-Google-Attributes: gidf5839,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Jochen_B_Winkler@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.photoshop.scripting
Subject: Re: Any way to create or influence Animation-Frames by a script?
Message-ID: <59b7f715.0@webcrossing.la2eafNXanI>
Date: Wed, 18 Feb 2009 02:31:15 -0800
References: <59b7f715.-1@webcrossing.la2eafNXanI>
Lines: 68
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit