file extentions/cut/filemakerpro/paste

using os 9/filemaker 4.0/photoshop 4 (low budget)

i have a folder on my desktop called “images”. in the folder are scanned images.

i have a db. one of the modules in the filemaker db is called images.hlly

each scan is assigned a file/scan name/extention xxxxxxxxxx.jpg (do not know if extention is the right word. newbie.)

i need to see if applescript can look into the file “images” on the desktop, copy the file name/extention, then…

go to the images.hlly flmkr module and paste the name/extention of the file/scan in 1 field called “FileName” in filemaker, create a new record, and repeat the action.

it was suggested i check out they told me to purchase a download “plugin” to do this. is there anyway applescript can do this?

I really like fmforums but keep in mind, FMPro is a cross platform product so you probably will get responses from PC users who are not hip to the script.

You certainly can do what you want using Applescript, and you can plant it right into a FileMaker script. First, for ease of use, create a new, blank layout with the 2 or 3 fields you want to work with. The reason I’m having you create a new layout is for the method in which we are going to create new records. “Create new record with data {variable1, variable2,variable3}” If your database is currently in a layout where fieldsl 1,2 and 3 are not the fields you want to set you’ll get your data in the wrong fields. Making a new layout ensures the new record will contain the right data in the right place.

In the following solution I offer the option of importing the actual image file, you don’t necessarily have to use it, but I thought since you were working with jpegs… Just comment out, or delete the line that tries to set the image cell. If you are going to use this line, just make sure you create a container cell to set the image to.

--pick a folder of images
set sourceFolder to choose folder with prompt "Choose a folder of image files"
--or, hard code it into the script
--set sourceFolder to "Mac HD:Desktop Folder:Some other folder:"

--get a listing of every item in that folder, (ignoring invisible files)
set fileList to list folder sourceFolder without invisibles

repeat with thisFile in fileList --repeat with every item found in the source folder
	set filePath to sourceFolder & thisFile as string --piece together the path to the file
	--if you want the actual type of file, have the finder get it
	tell application "Finder" to set fileType to the file type of alias filePath
	--this also gives you the added benefit of skipping folders
	if fileType is not equal to "fold" then
		--or, if you just want the textual extension of the file from it's name 
		set nameExtension to characters -3 thru -1 of thisFile as string--get the last 3 characters of the file name
--(keep in mind, if your files don't have ".xxx" extensions, this is useless
		tell application "FileMaker Pro"
			set imageDB to (a reference to database "import") --replace with the name of your database
			go to layout "import" of imageDB--replace with the name of the layout you created
			--create a new record with the textual data
			set newRec to create new record in imageDB with data {(thisFile as string), fileType}
			--or, if you want the actual nameExtension deactivate the line above and activate the line below
			--set newRec to create new record in imageDB with data {(thisFile as string), nameExtension}
			--optional, if you want the actual image in a container field, create it on your new layout
			--and keep this line of code to get the actual image into your DB. (There should be a way to
			--set this all in one line but I could not get the following to work):
			--set newRec to create new record in imageDB with data {(thisFile as string), fileType,file (filePath)}
			try --try, so your script doesn't fail  in case FileMaker cannot handle the file type
				set cell "image" of newRec to file (filePath)
			end try
		end tell
	end if
end repeat

You can copy and insert this script into a FileMaker script (perform applescript), and trigger it with a button, or compile using Script Editor, and save it as an application that you launch from the Finder.

Here is your download plugin, hope it helps you!