I am trying to create an image database in FileMaker Pro 6.0. I have run into a problem importing large images into FileMaker even when I select to Save Reference to a File. (the images are >20 MG.)
As a work around, I want to import the file path of those large images into FileMaker, and the run a script that uses the filepath to open the image in Picture Viewer.
Is it possible to script this? How do I get the script to refer to the field in FileMaker that has the file path information?
karen
Make a new FileMaker script, and add this to it. You’ll be able to send an apple event from FileMaker to the Finder to open whatever file is referenced in the file path field of the current record.
Best of luck,
tell application "FileMaker Pro"
--set a variable to the text in the cell named "file path" of a certain database
set thisFilePath to cell "file path" of current record of database "your database name"
end tell
try
--try to set this string to an alias, if it fails, the file isn't at this path, if it doesn't fail...
set thisFileAlias to thisFilePath as alias
--you should be able to have the Finder open it.
tell application "Finder" to open thisFileAlias
on error
--if the alias is not found then do something like, throw up a dialog
display dialog "Sorry, that file doesn't appear to exist" with icon stop
end try
Thanks for your help! Unfortunately, I am still having problems. Forgive me if the answer is very obvious, I am very new to this.
When I run the suggessted script, the dialog box “Sorry, that file…” always appears. I have tried running the script with several different records.
Any thoughts on why this is happening? I have not altered the file path in anyway. I simply imported it into my database.
Karen
No problem. But it could be one of a couple of different things.
-
check to make sure you renamed elements of the script to match your computer, and your database. Cell “file path” should be changed to whatever the name of your file path cell is, and the database name should be changed to reflect the name of your database.
-
Verify that the path to the file found in the FileMaker record is what you are getting.
Add the following line to the script, just after the “set thisFilePath to cell…” line.
display dialog thisFilePath
This should show you then what the script is using to find the file. If it does not match the cell let me know. If it does match the cell, and the script still throws up the error, then the file isn’t where your database says it is.
How did you import that path to the file into your database?
And, as an example, what would a typical path look like, taken from your database?
Best regards.[/list]
Thank you so much for your help! I checked the file path’s that I was using and wherever a colon : was needed, the file path had a slash /. I have fixed that problem and now everything is working just fine.
Thanks again,
Karen