An efficient way to process files after download has finished

This is what I did:


property type_list : {"doc", "rtf", "ppt", "docx", "pptx"}

on adding folder items to this_folder after receiving these_items
	tell application "Finder"
		repeat with itemn in these_items
			if name extension of itemn is in type_list then my convertDOCtoPDF(itemn)
		end repeat
	end tell
end adding folder items to

on removing folder items from this_folder after losing these_items
	tell application id "com.apple.FolderActionsDispatcher" to tick
end removing folder items from

Basically, the “adding folder items to” handler would be invoked after the download starts and after it has finished. The “removing folder items from” handler would be invoked when the download has finished (I assume this is due to the fact that the .download package is removed when download is finished). However, for some strange reason, Folder Actions Dispatcher provides an empty list of files with the latter two handler invocations. Having Folder Actions Dispatcher poll again when the .download package has been removed seemed to produce the correct behaviour. However, without knowing more about Folder Actions Dispatcher’s tick command, I can’t rule out the possibility of side effects with this remedy.