Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

hello,

i am trying to write a script in which you drag a file/folder/volume onto an applescript applet ,it then creates a new record for each file and puts in the filepath into a cell called "filepathtext" .

Thanks for any help

Yours

Paul Apted

Posted

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.

This topic is 7959 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.