Progress Indicator Script Doesn't Compile

I’m building an app that part of its function requires the moving of files. I want to show the user a progress bar while the file transfer is taking place. I can get it to do the barber pole thing but I want it to be a percentage representation of # of files moved of total files. One line of code doesn’t compile and I can’t figure out why. Any help would be appreciated.

Here’s the line:

set content of progress indicator “progressBar” to progressChange

and the error that gets generated:

/Users/steve/Desktop/photoMonkey/addRow.applescript:53: A identifier can’t go after this identifier. (-2740)

Here’s the relevant snippet of code:


--show status and progress bar
	set contents of text field "status" of window "addWin" to "Transferring files from " & thisFolder & " to application's temp folder."
	set visible of progress indicator "progressBar" of window "addWin" to true
	set uses threaded animation of progress indicator "progressBar" of window "addWin" to true
	set indeterminate of progress indicator "progressBar" of window "addWin" to false
	start progress indicator "progressBar" of window "addWin"
	
--move image files to temp folder
	repeat with thisFile in thisFolderList
		if thisFile does not start with "." then
			--set the path to the file
			set thisFilePath to (thisFolder as string) & thisFile as alias
			tell application "Finder"
				--make sure it's the right type of file
				set thisFileInfo to info for thisFilePath
				--get the file's kind
				set thisFileKind to kind of thisFileInfo
				--move only the image files
				if fileTypeList contains thisFileKind then
					set progressChange to progressChange + (100 / fileCount)
                                        (*THIS LINE WON'T COMPILE*)
					set content of progress indicator "progressBar" to progressChange 
					copy file thisFilePath to folder tempFolder
				end if
			end tell
		end if
	end repeat

I believe you’re missing the rest of the reference:

set content of progress indicator "progressBar" of window "addWin" to progressChange

You could also cleanup that first part:

	set contents of text field "status" of window "addWin" to "Transferring files from " & thisFolder & " to application's temp folder."
	tell progress indicator "progressBar" of window "addWin"
		set visible to true
		set uses threaded animation to true
		set indeterminate to false
		start -- Why is it starting if it's not indeterminate?
	end tell

Also, have you considered setting the maximum value of progress indicator to fileCount and then just increasing the value by one for each file?

tell progress indicator "progressBar" of window "addWin"
	set visible to true
	set uses threaded animation to true
	set indeterminate to false
	set maximum value to fileCount
	start
end tell
	
repeat with thisFile in thisFolderList
	-- whatever else
	
	tell progress indicator "progressBar" of window "addWin" to set content to content + 1
	
	-- whatever else
end repeat

Thanks Bruce, I did get it working, I took the call to increase the progress indicator out of the Finder.

I also made a subroutine for the progress indicator, which makes life easier.