FileMaker Start-Up Script

This script was designed to be placed in the ‘Start-Up Items’ folder of a Mac, which was used to host FileMaker Pro 5 Unlimited. FMP did not have an auto-launch facility built into it, to allow for the computer to automatically launch certain databases upon start-up, so, with some help from various forums, I built this one.
.
Within the FileMaker Folder, I created a sub-folder called “Web Databases”, and within that folder, I created individual folders for each of my hosted database solutions (ie 'Stock" containing files ‘Inventory’, ‘Location’, etc.)
.
This script will allow the user to abort it within the first 10 seconds of starting up, but if allowed to proceed, will open every file matching a certain file type (set in the script) which is found in the 1st teir of sub-folders within the Web Databases folder. Any files within sub-sub-folders (ie Web Databases:Stock:Archive) will not be launched.
.
At the end of the run, a summary is displayed, advising how many folders were checked and how many files were launched.
.
This script may be a bit rough (it’s one of my first), but it works.

OS version: Any

-- User-defined Base Folder
set filemakerRootFolder to "Macintosh HD:Applications:Filemaker Pro 5 Folder:Web Databases"
-- User-defined File Type
set filemakerFileType to "FMP5"

-- Initialise Counters
set countOfFolders to 0
set countOfFiles to 0

tell application "Finder"
	activate
	-- Allow User to Override Script, handy if run as part of StartUp Items
	set promptResponse to display dialog "FileMaker StartUp Application" & return & "You have 10 Seconds to abort" buttons ["Abort", "Continue"] default button "Continue" with icon caution giving up after 10
	if promptResponse is not equal to "Abort" then
		-- Make a list of Folders within the Base Folder
		set filemakerFolderList to folders in folder filemakerRootFolder
		set countOfFolders to number of items in filemakerFolderList
		-- Access Each of these Listed Folders individually
		repeat with i from 1 to the number of items in filemakerFolderList
			set filemakerFolder to item i of filemakerFolderList
			-- Make a list of Items within the Folder of the Type specified earlier
			set filemakerFileList to (files in filemakerFolder whose file type is filemakerFileType)
			-- Update Counter to show Running Total Number of Matching Files
			set countOfFiles to countOfFiles + (number of items in filemakerFileList)
			repeat with j from 1 to the number of items in filemakerFileList
				open item j of filemakerFileList
			end repeat
		end repeat
		tell application "Finder"
			activate
			-- Show Summary of Actions, with Number of Folders Accessed and Number of Files Launched
			display dialog "FileMaker StartUp Application" & return & "Launch Completed" & return & return & "-- Summary of Actions --" & return & "  " & countOfFolders & " Folders searched" & return & "  " & countOfFiles & " FileMaker Pro files opened" buttons ["OK"] default button "OK" with icon note giving up after 5
		end tell
	else
		-- Show Abort Acknowledgement
		display dialog "FileMaker StartUp Application" & return & "Aborted by User" buttons ["OK"] default button "OK" with icon stop giving up after 5
	end if
end tell