Multiple select files using clipboard from Filemaker records

I am trying to set up a script that will select multiple files in the Finder as referenced by fields across multiple records in Filemaker, so that I can move them all together to a new location. In this case the files are image files, so I’m trying to do what QuarkXpress would call a collect for output.

I have managed to do it such that Filemaker initiates the action using the clipboard to determine which file I want to select and then moving that file individually before moving onto the next Filemaker record. The looping is done by a Filemaker script then the slection and moving is done like this:

tell application “Filemaker Pro”
set clip_data to cell “cell1”
end tell
tell application “Finder”
copy file clip_data of folder “folderfrom” of startup disk to folder “folderto” of startup disk
end tell

This works OK but is slow. What I 'd like to do is to use the clipboard to reference and select each individual file and then go and move them all at once. I presume that this could be done with a list such you have file1,file2,file3 etc where file1 is the value from a field in 1 filemaker record, and file2 is the value from the next etc, but am not sure how to do this or how to make the process open ended so that it doesn’t matter how many files there are to move. Can anyone give me some pointers?

Thanks in advance


Something like this might work (untested). You’ll likely need to modify the FileMaker repeat loop to make it refer to the correct set of records.

set sud to path to startup disk as text
set sourceFol to (sud & "folderfrom:") -- path to source folder
set targFol to (sud & "folderto:") -- path to target folder

set clip_data to {}
tell application "FileMaker Pro"
	-- generate a list of file names
	repeat with record_ in records
		copy (cell "cell1" of record_) to end of clip_data
	end repeat
end tell

-- generate a list of file references for Finder
set filesToCopy to {}
repeat with clip_ in clip_data
	copy ((sourceFol & clip_) as file specification) to end of filesToCopy
end repeat

-- copy files to target folder
tell application "Finder"
	copy filesToCopy to folder targFol
end tell

– Rob