This script works using FMP 9.03 (mac). Unfortunately, I am not able to verify this with your version 8.5 (pc) but hopefully, it will help.
The variable "$filename" is entered into the "specify source file" in the Insert File script step.
Replace "file:filename" with your field containing your "filewin://path/folder/abc.zip"
Go to Field [yourtablename::yourfieldname]
Set Varialbe [$filename; Value:"file:filename"]
Set Error Capture [On]
Insert File [Reference; "$filename"]
If [Get(LastError) > 0]
Show Custom Dialog ["yourTitle"; "File not found!"]
Thanks a lot, Jade. I'll give this a try in 8.5 and report back if it solves the problem.
I don't have FM on this system, but I believe the problem will be entering the Insert File script step...it doesn't seem to allow me to use a variable for the file name, but brings up a dialog and I have to specify a particular file. But I'll keep experimenting.
but brings up a dialog and I have to specify a particular file. But I'll keep experimenting.
Instead of entering a particular file, enter the variable name in that dialog box:
OK, now I see that you can use a variable in the Insert File step in place of an actual pathname, and that works fine as long as the file exists. That's cool.
However, if it doesn't exist, Insert File appears to interrupt the script and bring up the Specify File dialog which requires one to specify a file or hit cancel. Is there any way to have it just ignore the missing file and go to the next step in the loop?
Is there any way to have it just ignore the missing file and go to the next step in the loop?
Sorry… I went through everything I could think of and came up empty.
Perhaps someone else can help?
Or take a look at third party plug-ins something like the Grab-it plug-in:
There was a recent thread on the TechNet mailing list which showed a (couple of) method to do this, using plain FileMaker. Since that is more or less a proprietary list, and since I did not write the technique (which is a bit tricky), I don't feel I should post it here without permission. You could join TechNet ($99/year).
Since I'm mostly on a Mac, I've always just used AppleScript for this. I cannot tell what platform you are on. On Windows you could use the free MooPlug plug-in, or any plug-in (or command line) that lets you look at the file system.
The Troi File plug-in will let you build the test right into a FileMaker calculation, which you can search on in real time. But it's a bit pricey for one thing like this; awesomely powerful though (the new drag-and-drop is something else; when can we have it in FileMaker :-?)
The MooPlug plug-in was the solution for me (FileMaker 8.5 on Windows). Among its many functions was Moo_FileExists which allowed me to check whether the file I wanted to Insert File in my script existed. The problem is that if it doesn't and you invoke Insert File, the script stops while a Specify File dialog is presented.
MooPlug is free (see MooPlug.com) but I sent the developer a couple bucks via PayPal for making such a useful tool available.
(Incidentally, most of you FM power users certainly already know this, but to install this plug in I simply copied MooPlug.fmx to C:\Program Files\FileMaker\FileMaker Pro 8.5 Advanced\Extensions. It then shows up in Edit > Preferences > Plug-Ins.
Thanks for everyone who offered advice and help; I definitely saved a lot of hair pulling by asking on this forum.