Jump to content

Drag and Drop File path


This topic is 7773 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Although you are basically on the right track, you've likely violated one of applescript's quirky syntax rules; I didn't spend a lot of time looking at what you did. But why reinvent the wheel? I found the following general purpose applescript at Apple's website. I modified it to work with filemaker:


-- the list of file types which will be processed

-- I used graphics file types to test  this. You will have to change them to the

-- file types for whatever sound files you want to process

property type_list : {"PICT", "JPEG", "TIFF", "GIFf"}



-- This droplet processes both files or folders of files dropped onto the applet

on open these_items

	repeat with i from 1 to the count of these_items

		set this_item to (item i of these_items)

		set the item_info to info for this_item

		if folder of the item_info is true then

			process_folder(this_item)

		else if (alias of the item_info is false) and (the file type of the item_info is in the type_list) then

			process_item(this_item)

		end if

	end repeat

end open



-- this sub-routine processes folders

on process_folder(this_folder)

	set these_items to list folder this_folder without invisibles

	repeat with i from 1 to the count of these_items

		set this_item to alias ((this_folder as text) & (item i of these_items))

		set the item_info to info for this_item

		if folder of the item_info is true then

			process_folder(this_item)

		else if (alias of the item_info is false) and (the file type of the item_info is in the type_list) then

			process_item(this_item)

		end if

	end repeat

end process_folder



-- this sub-routine processes files

-- by creating new FM records and saves the filepath

on process_item(this_item)

	--You will have to change soundfile to the name of your actual filemaker

 --database in the following line

	tell document "soundfile" of application "FileMaker Pro"

		create new record

		go to last record

  --change this line to agree with your field name

		set cell "filepath" of current record to (this_item as text)

	end tell

end process_item

Although this script is somewhat long, it will go right to the bottom level of all enclosed folders to locate the files you want. So you don't have to worry about the files being at the top level.

Link to comment
Share on other sites

This topic is 7773 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.