Help importing files to aperture

I am trying to write a script that will take subfolders from a selected folder and import their files using the subfolder name as the name of the project in Aperture. Under Mavericks

I think there is a problem in the line set pics to (every file of the folder aFolder where visible is true)

but I am not sure. Not sure how to correct this or what concept in apple scripting I am failing to understand.

Here is what I have so far:

set MainFolder to (choose folder with prompt “Choose Dive Trip Main Folder.”)
set AppleScript’s text item delimiters to “:”
tell application “Finder”
set theFolders to get every folder of MainFolder
repeat with aFolder in theFolders
set pics to (every file of the folder aFolder where visible is true) as list

	set ProjectName to text item -2 of (aFolder as text)
	
	
	tell application "Aperture"
		activate
		tell library 1
			set theProject to make new project with properties {name:ProjectName}
		end tell
		with timeout of 600 seconds
			import pics by referencing into theProject
		end timeout
	end tell
	
end repeat

end tell
set AppleScript’s text item delimiters to {“”}

I don’t have Aperture but here are a couple of pointers. Try ditching the visible bit in line 6:

		set pics to every file of aFolder as list

Even then, it might not work as that will make a list of Finder references. So you could further modify to:

		set pics to every file of aFolder as alias list