Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

new record in FMP by dropping a file into a folder

Featured Replies

  • Newbies

hi

I want to create a new record in my database each time I drop files in folders on my finder desktop

I use the Folder Actions Scripts

I have one folder per client and many different kind of files

When the record is created in FMP, I want to paste the name of the folder and the name of the file in 2 differents fields...

I wrote an applescript and no problem create a new record and to copy and paste the folder name... but I can't find how do the same thing with the file name...

help...

this is my script :P

thanks

-----------------------------------------------------------------------------------------

property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.

on adding folder items to this_folder after receiving added_items

try

tell application "Finder"

--get the name of the folder

set the folder_name to the name of this_folder

end tell

-- find out how many new items have been placed in the folder

set the item_count to the number of items in the added_items

--create the alert string

set alert_message to ("Folder Modification :" & return & return) as Unicode text

if the item_count is greater than 1 then

set alert_message to alert_message & (the item_count as text) & " Some Files "

else

set alert_message to alert_message & "New file "

end if

set alert_message to alert_message & "in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."

set the alert_message to (the alert_message & return & "Create new record for this file in database?")

display dialog the alert_message buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout

set the user_choice to the button returned of the result

if user_choice is "Yes" then

tell application "FileMaker Pro Advanced"

activate

create new record

set cell "folder" of last record to folder_name

set cell "file" of last record to file_name

end tell

end if

end try

end adding folder items to

When you drop items on an AppleScript the result is a list, whether there's 1 or several (I don't know whether they've handled 1 automatically in Leopard or not, but I'll have to assume not).

The question for FileMaker is whether you want a new record for each file dropped. I will assume yes.

Your original script did not get the file name at all, possibly because of confusion re: 1 or several. What I did is build a list of the file names.

I also have no idea what this is (though it doesn't seem to matter; perhaps it's a Leopard text object):P

«data utxt201C»


property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.



on adding folder items to this_folder after receiving added_items

	

	try

		tell application "Finder"

			--get the name of the folder

			set the folder_name to the name of this_folder

			set file_names to {}

			repeat with i in added_items

				set file_name to name of i

				set file_names to file_names & file_name

			end repeat

		end tell

		

		-- find out how many new items have been placed in the folder

		set the item_count to the number of items in the added_items

		

		--create the alert string

		set alert_message to ("Folder Modification:" & return & return) as Unicode text

		if the item_count is greater than 1 then

			set alert_message to alert_message & (the item_count as text) & " New files "

		else

			set alert_message to alert_message & "New file "

		end if

		set alert_message to alert_message & "in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."

		set the alert_message to (the alert_message & return & "Create new record for this file in database?")

		

		display dialog the alert_message buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout

		set the user_choice to the button returned of the result

		

		if user_choice is "Yes" then

			tell application "FileMaker Pro Advanced"

				activate

				repeat with i in file_names

					create new record

					set cell "folder" of last record to folder_name

					set cell "file" of last record to i as Unicode text

				end repeat

			end tell

		end if

	end try

end adding folder items to

  • Author
  • Newbies

thanks for your quick answer,

I try this right now

.

.

.

one minute later

.

.

.

whoa...

fantastic that's work fine, thanks a lot

Edited by Guest

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.