Progress indicator not showing up immediately


I have a little programm that basically wraps a gui around the Unix find command. Now, I want to show a progress indicator while find is running, but it happens that the progress indicator does not show up after I have set ip up to do so. Instead each change gets activated when I do something else, like display dialog. Then suddenly ther progress indicator will appear.

	if theObject is equal to button "findFiles" of window "mainWindow" then
		tell window "mainWindow"
			set indeterminate of progress indicator "findProgressBar" to true
			set visible of progress indicator "findProgressBar" to true
			tell progress indicator "findProgressBar" to start
		end tell
	end if

This is the piece of code that turns on the progress indicator. Down in the procedure findFiles() there is a display dialog command that gets executed after the find command has returned and it is then when ther progrss indicator will suddenly appear. If I leaqve out the display dialog command the progress indicator does not get activated at all.

What wrong with my little app?


Your application is probably too busy handling findFiles to update the indicator. I would try using a seperate thread for the animation:

if theObject's name is "findFiles" then
	tell progress indicator "findProgressBar" of window "mainWindow"
		-- This makes the application use a seperate thread to handle the animation
		set uses threaded animation to true
		set indeterminate to true
		set visible to true
	end tell
end if

It’s not telling the indicator to animate that makes the difference here, it’s setting the threaded animation property. The tell commands are still executed in the same thread as the rest of your AppleScript code, after all.

I changed my wording. :slight_smile:

Hi guys,

thanks a lot, that did it.