Moderators: Patrick, Mike Hale, xbytor, Larry Ligon, Andrew, PS-Moderators
// =======================================================
var id29 = charIDToTypeID( "setd" );
var desc5 = new ActionDescriptor();
var id30 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id31 = charIDToTypeID( "Prpr" );
var id32 = stringIDToTypeID( "time" );
ref2.putProperty( id31, id32 );
var id33 = stringIDToTypeID( "timeline" );
ref2.putClass( id33 );
desc5.putReference( id30, ref2 );
var id34 = charIDToTypeID( "T " );
var desc6 = new ActionDescriptor();
var id35 = stringIDToTypeID( "seconds" );
desc6.putInteger( id35, 6 );
var id36 = stringIDToTypeID( "frame" );
desc6.putInteger( id36, 11 );
var id37 = stringIDToTypeID( "frameRate" );
desc6.putDouble( id37, 30.000000 );
var id38 = stringIDToTypeID( "timecode" );
desc5.putObject( id34, id38, desc6 );
executeAction( id29, desc5, DialogModes.NO );
// =======================================================
var id39 = stringIDToTypeID( "previousFrame" );
var desc7 = new ActionDescriptor();
var id40 = stringIDToTypeID( "toNextWholeSecond" );
desc7.putBoolean( id40, false );
executeAction( id39, desc7, DialogModes.NO );
// =======================================================
var id41 = stringIDToTypeID( "nextFrame" );
var desc8 = new ActionDescriptor();
var id42 = stringIDToTypeID( "toNextWholeSecond" );
desc8.putBoolean( id42, false );
executeAction( id41, desc8, DialogModes.NO );getInteger wrote:This is the log when you click in the timeline in the animation window, when you do a previous frame and a next frame.
You don't get the real current frame number but you have seconds +frame rate + frame = frame number.
- Code: Select all
// =======================================================
var id29 = charIDToTypeID( "setd" );
var desc5 = new ActionDescriptor();
var id30 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id31 = charIDToTypeID( "Prpr" );
var id32 = stringIDToTypeID( "time" );
ref2.putProperty( id31, id32 );
var id33 = stringIDToTypeID( "timeline" );
ref2.putClass( id33 );
desc5.putReference( id30, ref2 );
var id34 = charIDToTypeID( "T " );
var desc6 = new ActionDescriptor();
var id35 = stringIDToTypeID( "seconds" );
desc6.putInteger( id35, 6 );
var id36 = stringIDToTypeID( "frame" );
desc6.putInteger( id36, 11 );
var id37 = stringIDToTypeID( "frameRate" );
desc6.putDouble( id37, 30.000000 );
var id38 = stringIDToTypeID( "timecode" );
desc5.putObject( id34, id38, desc6 );
executeAction( id29, desc5, DialogModes.NO );
// =======================================================
var id39 = stringIDToTypeID( "previousFrame" );
var desc7 = new ActionDescriptor();
var id40 = stringIDToTypeID( "toNextWholeSecond" );
desc7.putBoolean( id40, false );
executeAction( id39, desc7, DialogModes.NO );
// =======================================================
var id41 = stringIDToTypeID( "nextFrame" );
var desc8 = new ActionDescriptor();
var id42 = stringIDToTypeID( "toNextWholeSecond" );
desc8.putBoolean( id42, false );
executeAction( id41, desc8, DialogModes.NO );
getInteger wrote:Thanks.
I hope you'll find something.
Yes i know the log i posted is about set not get but that's all i was able to get in the log

function getFrame(IO) {
if (IO == "in") var tIO = stringIDToTypeID("workInTime");
if (IO == "out") var tIO = stringIDToTypeID("workOutTime");
var fr = 0;
var secs = 0;
var mins = 0;
var hrs = 0;
var frRate = 30.0;
var rate = stringIDToTypeID("frameRate");
var frame = stringIDToTypeID("frame");
var seconds = stringIDToTypeID("seconds");
var minutes = stringIDToTypeID("minutes");
var hours = stringIDToTypeID("hours");
var tLine=stringIDToTypeID("timeline");
var get=charIDToTypeID('getd');
var nul=charIDToTypeID('null');
var prop=charIDToTypeID('Prpr');
var actionRef = new ActionReference();
actionRef.putProperty(prop,tIO);
actionRef.putClass(tLine);
var desc=new ActionDescriptor();
desc.putReference(nul, actionRef);
var TC=executeAction(get,desc,DialogModes.NO);
var TL=TC.getObjectValue(tIO);
try {fr=TL.getInteger(frame);} catch(e){}
try {secs=TL.getInteger(seconds);} catch(e){}
try {mins=TL.getInteger(minutes);} catch(e){}
try {hrs=TL.getInteger(hours);} catch(e){}
frRate = TL.getDouble(rate);
return hrs * 3600 * frRate + mins * 60 * frRate + secs * frRate + fr;
}
alert(getFrame("in"));
alert(getFrame("out"));
[/code]getInteger wrote:Oh nice !
What do you mean by "in" slider or "out" slider ?
I guess i use all the ways i know to change the current frame.
I use the playback panel, the current frame number (you can click on it to slide or to enter a specific number) and the timeline slider.
function getFrame(IO) {
if (IO=="in") var tIO = stringIDToTypeID("workInTime");
if (IO=="out") var tIO = stringIDToTypeID("workOutTime");
if (IO=="current") var tIO=stringIDToTypeID("currentFrame");
var fr = 0;
var secs = 0;
var mins = 0;
var hrs = 0;
var frRate = 30.0;
var rate = stringIDToTypeID("frameRate");
var frame = stringIDToTypeID("frame");
var seconds = stringIDToTypeID("seconds");
var minutes = stringIDToTypeID("minutes");
var hours = stringIDToTypeID("hours");
var tLine=stringIDToTypeID("timeline");
var get=charIDToTypeID('getd');
var nul=charIDToTypeID('null');
var prop=charIDToTypeID('Prpr');
var actionRef = new ActionReference();
actionRef.putProperty(prop,tIO);
actionRef.putClass(tLine);
var desc=new ActionDescriptor();
desc.putReference(nul, actionRef);
var TC=executeAction(get,desc,DialogModes.NO);
if (IO=="current") return TC.getInteger(tIO);
var TL=TC.getObjectValue(tIO);
try {fr=TL.getInteger(frame);} catch(e){}
try {secs=TL.getInteger(seconds);} catch(e){}
try {mins=TL.getInteger(minutes);} catch(e){}
try {hrs=TL.getInteger(hours);} catch(e){}
frRate = TL.getDouble(rate);
return hrs * 3600 * frRate + mins * 60 * frRate + secs * frRate + fr;
}
alert(getFrame("in")); // For the beginning slider position
alert(getFrame("out")); // For the end slider position
alert(getFrame("current")); // For the current slider positionfunction getCurrentFrame(){
try{
var actionRef = new ActionReference();
actionRef.putProperty(charIDToTypeID('Prpr'), stringIDToTypeID("currentFrame"));
actionRef.putClass(stringIDToTypeID("timeline"));
var desc=new ActionDescriptor();
desc.putReference(charIDToTypeID('null'), actionRef);
var TC=executeAction(charIDToTypeID('getd'), desc, DialogModes.NO);
return TC.getInteger(stringIDToTypeID("currentFrame"));
}catch(e){}
}
getCurrentFrame();getInteger wrote:OMG THANKS A LOT it works !!!!!!!!!!![]()
EDIT: i have a question.
In the log some actions are totally invisibles, does that means that we can't do anything with ?
I mean for example when you edit a tool preset there is nothing wrote in the log, so is it imposssible to script stuff that control tool preset properties ?
Users browsing this forum: No registered users and 0 guests