Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6337 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I can't figure out how to have my FMP database be configured to open a different external file for each record in the FMP database. I have no trouble setting up the 60 or so different Send Event scripts that each identify a different external file to open (though, if there is a shortcut to this, that would be good, too), but what I'm struggling with is how can I add a button to a field to run this script so that the button opens a different file for each record.

Posted

Hello Mike,

Can you provide some specifics? Is there a field in your DB that will indicate which file to open? Is the path nearly the same for each?

Posted

Well, I can make one easily enough. And, yes, the files are all in the same general area, but not in one same folder. They're all in folders within the same master folder (one level up). But I guess my problem is ultra-basic. I know how to assign a button to do almost anything I need to do. What I can't figure out is what kind of field I need if I want to assign the same button to do the same-but-different thing in each record (the "same" being open an Adobe InDesign file, and the "different thing" being opening a different InDesign file for each FMP record. Is there any kind of FMP field that will contain a button like that?? Maybe there's an easier way to do it than what I'm trying to do. It would be great if a button in each record could read a file path in a field to open those design files, but I can't figure out how to do that either.

Posted

I am fairly new to FM so not sure if this is what you are looking for.

It would be great if a button in each record could read a file path in a field to open those design files

You could make a script that would go to the filed in the current record where your file path is and take that path and then set it to open that file. Then you assign that script to the button in the same record.

So basically every new record that you make would have that button and the script would get the file path from the current record so you would not have to set it up again and again for each different file path.

Not sure if it helps, might be way off...

Posted

If you have a field with the file path, you can define your button as:

Open URL [ No dialog; YourTable::YourPathField ]

Make sure you have a valid path - see Help > Creating a database > Creating file paths.

Posted

Thanks for your reply. I just can't get it to work. What happens is that my browser (Safari) keeps trying to execute the command and, of course, fails. But, in doing so, it blocks anything else from executing. I tried relative paths and absolute paths; Safari just butts in with all attempts.

Posted

Thanks for your reply, too. I just can't get this to work either. Your solution is to use the 'Send Event' by Calculation, and what happens is that my system just comes back with an error message that it just can't find the file. And that's with both relative paths and absolute file paths. I'm using the same file path as what shows up in the Send Event > Document Button window, and that works just fine. But I can only choose one file this way, not one different file per each FMP record. By the way, how does a person use that Send Event > Document Button window anyway? By that I mean, you can create a whole list of files there, but how do you control what the system looks for???

Thanks for your help everyone, but I'm still baffled. I guess I'm in over my head.

Posted

I think you have a path syntax problem. I'd suggest you perform this test:

1. Define a new container field, call it ContainerField;

2. Define a calculation field cPath (result is Text) = ContainerField;

3. Insert your file, as reference only, into ContainerField.

At this point, double-clicking the ContainerField should open the file in its native application. Also, the second line of cPath should show the absolute path to the file.

I'll pause here, so that you can get to this point.

Posted

Thanks for your help. I was wondering if a Container field might be able to do this. I did your 1,2,3 steps successfully (double-clicking on the container field does indeed open the desired file), but, while the other field reveals both the relative and absolute file paths, neither work when used with my script-and-field combo I set up for this.

What happens is the same thing: Safari responds and fails. What appears in the browser URL window for the one FMP record I tried this on is http://localhost/Columbus/Users/mikeheymer/Documents/Coupon%20Connection/Clients/Jones%20Blacktopping/Ad%20Layout.JB.indd for the absolute file path and http://file:Clients/Jones%20Blacktopping/Ad%20Layout.JB.indd for the relative path.

If nothing else works out, I can work with what you've shown me so far. I was easily able to turn the container field into a button by making it small and square and coloring it, and putting a 2-point emboss on the edge and making the text the same color. Presto! A poor man's home-made button that needs to be double-clicked once it's associated with a file name. Frankly, it may be the easiest set-up to associate the file name, since you're able to quickly make use of the Finder's Open window to establish the link.

Posted

Wait, we're only half-way there - although now we are branching into personal preferences.

First, you can make a button that will "double-click" the container field for you. The script can be something like:

Freeze Window

Go to Field [ YourTableTable::ContainerField ]

[ Select/perform ]

Go to Field [ ]

The field still has to be on the layout for this, but its behavior can be set to prohibit entry (so it cannot be accidentally cleared). To insert a file, make another script using the Insert File[] script step (it must be a script, not a single-step button action).

The OpenURL [] step does not require the field on the layout. In fact, it doesn't need the field at all - only the path. But the path needs to modified so that it begins with "file://" instead of "filemac:/" (note the double-slash).

Posted (edited)

Oh right, sorry I thought you were on XP.

Try this one on Mac... you know it just dawned on me what you could do with the web viewer here!! Pretty Cool,

Anyway, hope it works.

openExample.zip

Edited by Guest
Posted

Thanks, your setup really works good (using the container field). Your mod to the file path also works using the URL approach but the container field is so much faster to establish the link to the file by way of the standard system Open Dialog Window. I set up the two buttons as you suggested and also put an indicator within the "link-to-file" button: an On/Off radio button that appears solid green (like a traffic light) when the container field "not isempty" and just a blank circle when it is empty. So, with this indicator light, my button is able to tell me if a file has already been linked up to the external file or not. The other button simply opens the file once the link is established. (See attached files) Thanks again.

Unlinked.jpg

Green_light.jpg

Posted

Thanks for your help. The good news -- with your new solution (combining the Send Event with the URL command) -- is that Safari (the browser) didn't butt in and spoil the show. The bads news is that that didn't work out either. With both the relative path and the absolute path (with and without the mod from my other helper), I got "Can't find path" error messages. I drove from Cairns to Sydney about 5 years ago but never got further down to Melbourne. That will have to be another trip. Thanks again.

Posted

I basically agree with your analysis: these are two different methods, each suitable for a different situation. It is also possible to mix-and-match the two, for example use a container field to select the file, but then parse the path out to individual components that will be recombined into a URL (useful when you need to move/rename a folder).

  • 4 weeks later...
  • Newbies
Posted

This works for me:

1. I have a field called "URL" in each record.

2. In this field I entered the absolute filepath of the external file that I want to be able to open. It took some time, but eventually I discovered syntax that works: file://HD/Users/Username/Desktop/.../folder/filename.jpg.

3. I wrote a script that contains only the following: Open URL (No dialog; databasetablename::URL.

4. I formatted the URL field as a button to execute this script.

5. I used "Get info" on a single .jpg file to tell my computer to open all .jpg files by default in Safari.

Now when I click on the URL field in my database, it opens up the pic that is specified in the URL field.

Hope this works for you too.

  • 2 months later...
Posted (edited)

'COMMENT's suggestion (above) works excellently for me in a resources database to call up all sorts of files from all over our network.

What I haven't been able to crack is how to make it work cross-platform. The file reference appears to be set when the external file is inserted with either a 'filemac:/' path (if inserted on a mac) OR a 'filewin:/' path (if inserted on a PC).

Using a calculation in the field (cPath (result is Text) = ContainerField) to change the path according to the user's OS, doesn't appear to do the trick. Is the path set IN THE CONTAINER at insertion according to the OS the user is on? or is there a way to 'switch' the file reference to follow a different path for another OS? I've had little luck using 'send event' and just clicking the container would be perfect ... if it would work cross-platform.

Edited by Guest
Posted

Check out the calculations in the file of this thread.

http://www.fmforums.com/forum/showtopic.php?tid/189972/post/266713/hl//fromsearch/1/#266713

The volume and drive name are separate auto-enter calculations, so they could be changed later if necessary.

Posted

Thanks for this Fenton. If I've grasped it correctly, the example file is using the applescript to open the file on Mac OS and the Open URL to do it on PC.

The trouble is many of the resource files I'm calling are Word files and won't open in a browser (and anyway people need to edit them) ... or can these scripts open files in their own applications? (in which case my problem would seem to be with parsing the filepaths).

Posted

Well, I was mostly concerned with showing an image in FileMaker, or opening it for viewing, which works fine with OpenURL. But for other things, you might want to look at the _cOS_filepath field; which could be used in a Send Event?

This topic is 6337 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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