FolderWatcher

This script is meant to watch a folder of image files and catalog added files to an Extensis Portfolio catalog. It has also been used for Canto Cumulus. Everything worked fine under OS 9. I am getting an error under OS X in the “–update Portfolio” area before actually opening the catalog. Any assistance is greatly appreciated.

OS version: OS X

property PortfolioDB : "Pentagram Portfolio Archive.fdb" -- the name of the Portfolio gallery
property PortfolioDBPath : alias "Macintosh HD:Applications:Extensis Portfolio 6.1:Pentagram Portfolio Archive.fdb" -- actual path of the Portfolio gallery

on adding folder items to this_folder after receiving these_items
	tell application "Finder"
		activate
		set AddedList to every item of these_items
		set AddedNames to {}
		repeat with i in AddedList
			set FileName to name of i
			set AddedNames to AddedNames & FileName
		end repeat
		set OldFolderName to name of this_folder
		set newFolderItems to {}
		
		--update Portfolio
		try
			set AllItems to every item in this_folder
			set PortfolioItems to (newFolderItems & AllItems sort by name) as list
			repeat with eachItem in PortfolioItems
				set theFile to name of eachItem
				--display dialog theFile as string
				if AddedNames contains theFile then
					set thePath to eachItem as alias
					display dialog (theFile as string) & " will be added to Portfolio"
					--display dialog thePath as string
					
					tell application "Extensis Portfolio 6"
						activate
						try
							open PortfolioDB
							-- verify database is running, if not, script will open it
							--if not (exists gallery (PortfolioDB)) then
							--open server "portfolio://192.168.100.16/Pentagram Portfolio Archive.fdb"
							open gallery "Pentagram Gallery"
							--end if
							--on error errMsg number errNum
							--display dialog errMsg
						end try
						catalog thePath to front gallery
					end tell
				end if
			end repeat
		on error errMsg number errNum
			set LogErrorText to "Error reported: " & (errMsg as string) & " Error Number " & (errNum as string)
			display dialog LogErrorText buttons {"Cancel"} default button 1
		end try
	end tell
end adding folder items to