NSProgressIndicator Smooth animation

Hi there,

i have an NSProgressIndicator as bar correctly displayed, initiated and it also increments well.
The problem i have is that is just “jumps” to the next step instead of smoothly filling up.

I also tried to put the stuff inside a new NSThread (but as its ASOC anyways i think it all goes through Applescript Object anyways)

Heres my Code (reduced to what’s necessary)


property processBarMainWindowSmall: missing value

set currentProgressIndicator to processBarMainWindowSmall -- needed because i have several indicators to handle
set currentProgressIndicator's indeterminate to true
currentProgressIndicator's startAnimation_(missing value) -- Starts the animation of an indeterminate progress indicator.
set currentProgressIndicator's maxValue to 5
currentProgressIndicator's setUsesThreadedAnimation:true

add()
delay 1
add()
delay 1
add()

on add()
set currentProgressIndicator to processBarMainWindowSmall 
set currentProgressIndicator's indeterminate to false
currentProgressIndicator's incrementBy:1
end

Hi Jonathan

I’m a bit confused with your posting.
Firstly an indeterminate progress indicator doesn’t use the maxValue: or a incrementBy: methods.
These particular methods are used by a determinate progress indicator, and not the indeterminate type.
Maybe you’ve made a mistake in the definition of your posting by accident, but it’s worth clarifying this in order to get some help from other users.

Secondly you seem to be mixing AppleScriptObc syntax styles in your code, with the older method_(param) and the interleaved method:(param) styles.
So it may also be worth clarifying what version of OSX and Xcode your using.

I used two progress indicators myself in a recent project, and found setting the parameters of the progress bar before starting it’s animation works fine, so use the setUsesThreadedAnimation:true method before starting the animation.
I’m not sure it makes much difference in an ASOC project, but it does seem more logical to me.

Lastly if you where referring to a determinate progress indicator, then a maxValue of only 5 would make it appear to jump in large steps, as the visual length of the progress bar would be divided into five segments, and each fifth of the bar would fill with each increment, which would account for what you describe.

Regards Mark

Intermediate state is deactivated in add () function.
Works perfect. All I want is smoother animation from step to step as I know it is possible.
There is no need to split the process in 1000s of steps to get a “fake” smooth animation.

Newest Xcode 7 (not beta). Osx 10.11 (newest)

Is there a problem with mixing calls?
Let’s not drift away from my issue…

Still looking for a way to smoothly move progress bar from step 1 to step 2.

Your code is wrong.
Your approach is wrong.
And your attitude is wrong.

And I’m out.

This is not very helpful.

The code works perfect so far. If there is something wrong you’d better help instead of flaming.
You can switch a progress indicator from indeterminate to determinate state - that’s what i am doing here.

Anyone else… with more constructive comment?

EDIT: Found the solution myself by writing a category for NSProgressIndicator using NSAnimation
EDIT2: For anyone else who is interested - Somenone else had the same idea: https://github.com/eternalstorms/NSProgressIndicator-ESSProgressIndicatorCategory

This is old but I’ve come across it a couple times and I agree with Jonathan Engelhardt: “This is not very helpful.”

If anyone has a wrong attitude, its Mark FX. Jonathan – glad you got your script working.

Hello Jonathan,

I was wondering if you could post complete code, so I can learn how to do a progress bar.

The snippet you put up doesn’t do anything because i need the parts that will do “NSProgressIndicator as bar correctly displayed, initiated and it also increments well.”

Thanks.

I got it working

Thanks