http://imagej.273.s1.nabble.com/Detecting-animated-state-in-a-macro-tp3686936p3686941.html
> On Sep 12, 2010, at 9:01 PM, Bill Mohler wrote:
>
>> Jerome, Ved,& Wayne
>>
>> Thanks for your advice. I guess I'll have to experiment to find out how
>> much lag there might be in the disk-access required (I think) for the
>> prefs approach, versus the need to wait for a frame change in the
>> getSliceNumber approach. I'm trying to set up a very quick response in
>> the UI to a keystroke, but need to know whether the stack is currently
>> animated before choosing which actions to perform. It would be best, I
>> think, if a macro command could directly return the current value of
>> StackWindow.getAnimate(). Obviously this means work for Wayne, but I
>> think it would be useful.
> The is("animated") macro function, added in the 1.44g daily build, can be used to detect if a stack is currently animated.
>
> -wayne
>
>> On 9/12/10 3:35 p.m., Jerome Mutterer wrote:
>>> Bill, Ved,
>>>
>>> The following macro retrieves the animation state of the current stack using
>>> a javascript call. The state is returned using the built-in preferences
>>> mechanism, because the eval() macro function cannot return a value.
>>>
>>> s="Prefs.set('is.animated',WindowManager."+
>>> "getCurrentImage().getWindow()."+
>>> "getAnimate());";
>>> eval("script",s)
>>> a = call ('ij.Prefs.get','is.animated',false);
>>> print ("animated: "+a);
>>>
>>>
>>> Jerome
>>>
>>> On Sat, Sep 11, 2010 at 12:25 AM, Ved Sharma<
[hidden email]> wrote:
>>>
>>>> Hi Bill,
>>>>
>>>> You can try the following code. You might have to adjust the wait time,
>>>> depending on the your stack size and speed.
>>>>
>>>> ------------------------------------
>>>> a = getSliceNumber();
>>>> wait(1000);
>>>> b = getSliceNumber();
>>>>
>>>> if(a!=b)
>>>> print("Stack is animated.");
>>>> else
>>>> print("Stack is not animated.");
>>>> -------------------------------------
>>>>
>>>> Ved
>>>>
William A. Mohler
Dept. of Genetics and Developmental Biology
400 Farmington Ave.
263 Farmington Ave.