I’ve got a script which grabs the path of an image in a Filemaker container field:
set myPath to cell “image_path” of current record
and then moves the image to a new location. I now want to update the reference path in Filemaker so the image remains visible in the database.
set cell “image_path” of current record to finalPath
The new path reads fine in Filemaker, but the container field remains empty with the message “The file cannot be found:”
Tried closing and reopening the database figuring it might update but it didn’t.
Is there some way using either Applescript or a Filemaker command I can call from the Applescript to accomplish this reconnection/refresh? I know I could reconnect it manually, but the whole purpose of this exercise was to automate this move process.
Which version of FMP are you running?
Can you give me a detail or two to help me visualize, and verify my grasp?
You have a FMP database that:
–Has a container field storing an image
–A separate field that describes the path
–You want to move the physical location of the image and update the database’s record of the physical location to match
–What format is the path field, text?
–Is it text, or some kind of special type that can keep track of the image’s URL? (never know, maybe there is a field type I’ve never used, most of my knowledge is from FMP 6 & 7, despite using 8 and 9 these days)
Sometimes the best way to do data collection and updates in FileMaker from AppleScript is to use ScriptMaker directly. Either initiate the file moves from a Do AppleScript step in ScriptMaker (FileMaker), or have an external AppleScript kick-off a Do Script in FileMaker and have a script done in ScriptMaker do all the work.
So for example, if you need to refresh the database, figure out how to do it in ScriptMaker and then call that ScriptMaker script from AppleScript. I can give some examples of this sort of thing if I do some digging. I’ve done a couple of basic FileMaker/AppleScript combo systems. Actually it’s one of my favorite ways to do automated data collection and manipulation, and it’s alot easier to do than it is in Excel.
Turns out since I had the new path, the easiest thing to do was just have the script reimport the image into the same record.
That seems to be working fine.
I really do need to look at Filemaker’s internal scripting capabilities and then using that Do Script option. I think Calvin’s right, that’s the way to solve a lot of my issues.
Thanks for the input.