Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I am a doctor and I need to store patient info like photos and Xrays. I have downloaded a very useful freeware program called "medistic".

This program lets you import a thumbnail of a pic of your choice. I also has a "Open" button that should open the jpg file. In the original script provided with the program, it opens the file in Safari (with an "open URL" command), but I want it to open in Preview.

I am having trouble creating a script that opens a .jpg file that is in the container of the database.

So far, I have gotten Preview to open a specified file but not the file that is contained in the record.

Can anyone help?

Posted

Try Export Field contents with the auto open checked.

You can export to the desktop, or with FM9 there's a new function Get (TemporaryPath) that exports it to a folder that the OS deletes eventually.

Posted

Thank you for your response. However, all that happens now is that TextEdit (Word pad in windows) opens with the filepath as the text. Any ideas on how to get it to open Preview instead?

Posted

It sounds more like you're exporting the path itself, as a text field, to a text file. You want to export the contents of the container field, using Export Field Contents.

Posted

I am REALLY new at this. So please bear with me.

I have the Export field contents script selected. The Specify Target field is cContainerPathMac which is where the container is located. this cContainerPathMac is a field in a linked database and is a calculation. The calculation is as follows:

Right(cGetContainerPath;Length(cGetContainerPath)-Position(cGetContainerPath;"imagemac:/";1;1)-9)

/*Right ( text ; numberOfCharacters )*/

/*Length ( text )*/

/*Position ( text ; searchString ; start ; occurrence )*/

I can only get is to the path itself in TextEdit. What can I do to get the path to open in Preview?

Thank you

Posted

Fenton is alot more familiar with working with images, but let me chime in once more.

Export Field Contents expects the actual container field. Not a calc field that mentions the container field. cContainerPath isn't the field that you need to export.

What is the name of the actual container field?

Posted (edited)

I may be more familiar with the "theory of working with images", better known as "fooling around with images" B)-]. The main trouble with solving problems that beginners have with images is confusion over what they have in the first place, and what they want to do with it.

In this case, we were originally told that the database has a thumbnail in a container. We (I) assumed that this meant that the thumbnail was "embedded," i.e. inserted or imported with the [ ] As reference only UNCHECKED. Which would mean that the image was actually IN the field.

There was mention of using Safari to open the image file, using OpenURL. Which implies that the image is NOT embedded in the database, but was inserted [x] As reference only.

If this is the case, there is another method. FileMaker will open a "file" which has been referenced in a container field if you double-click it, or if you use the Go To Field [ Select/perform; container field with file ]

But, in this case you've got a picture, not a file. So what we can do is create a calculation that produces that same picture file as just a file. It's not that hard to do.

So, I've got a picture I've inserted (or imported) into a container field as [x] Save a reference only. If I created an unstored calculation, with result text, GetAsText (container field) I get the: size, relative path, absolute path (as the last line):P

imagemac:/Macintosh HD/Users/fej/Pictures/Animals/bighorn.jpg

Then I create a calculation, with the result CONTAINER, which takes the above, and just Substitutes "file" instead of "image".

filemac:/Macintosh HD/Users/fej/Pictures/Animals/bighorn.jpg

The result is Container, so FileMaker produces a cute little icon and name. If you double-click it, it will open the image file in its default application. (The icon may be misleading; it will likely be a Preview icon, but that's just OS X's default graphic application; it's not necessarily who'll open the file.) Using the Go To Field [ Select; that field ] also opens it.

The application may or may not be Preview. It will be the application which last saved the image. If you want to force Preview to open it, then you'll have to use AppleScript, in a Perform AppleScript step. You would in that case need an old-style Mac path, then tell Preview to open it. I can use:

tell application "Preview" to open file "Macintosh HD:Users:fej:Pictures:Animals:bighorn.jpg"

But I don't know if you can, though "open" might work. Because Apple in its infinite wisdom :-| did not turn on AppleScript for Preview. But it can be turned on easily, using AppleScript, run via the Script Editor application.

-- This line reads whether it's already on

do shell script "defaults read com.apple.Preview NSAppleScriptEnabled"

-- This line will turn it on

do shell script "defaults write com.apple.Preview NSAppleScriptEnabled -bool YES"

It is convenient to turn it on, so AppleScript can tell it to open images and to print files.

[P.S. You can also use AppleScript and just tell the Finder to open the file. But this has the same effect as the FileMaker method of opening it, i.e., it opens with the default application of the file.]

ContainerPicture_wOpen.fp7.zip

Edited by Guest
Posted

Thank you for your reply Fenton and bcooney. Re the file you sent me, I have downloaded it and I can insert a jpg without any problems. However, when I press the open button it doesn't open anything. Preview is on just like you explained. I am attaching the multimedia table that I am trying to fix. Please tell me where I'm wrong. The open cfile script is identical to the one you gave me.

PLEASE HELP!

multimedia.fp7.zip

Posted

Did you Insert one of your pictures, with [x] "Store only a reference to the file" checked? My FileMaker file was for using referenced image files.

It is very difficult to talk about images without knowing whether someone is talking about an "embedded" image (not referenced) or referenced (pointing to an external file). They look the same. But the methods to work with them are different.

Your file is password protected, so we can't open it. So we can't tell which your image is.

Posted

OK, that's an embedded file. You can tell because GetAsText ( container field ) only returns 1 line, the file name. You could also tell if you have a field Length ( container field ), result number, as it would > 0.

So you'd need to export the container somewhere, then open the resulting file. If that is going to be the way you Insert files. This is a big decision however, whether to embed or store a reference only. If they are as reference only, and you're using hosted files, then the images should be on a file server machine (not the FileMaker Server machine, not your machine).

If you're decided that you will always Insert embedded, then there are also methods. I suppose one could handle either kind of insertion, but that would be unusual I think. It just isn't clear which you want to do. I cannot tell from your file, as it does not seem you've understood the difference.

It is also not entirely clear whether this could be Mac only, or needs to be cross-platform.

Posted

I think it would be better for me to store a reference only with a thumbnail of the image. Then I could click on a button that opens it up in Preview.

Since the file is only for me, I don't need to share it with anyone. So, it would be for Mac only.

Thank you very much for your patience on this.

Posted

Not sure if this will help you but, there is a way to import images, thumbnails and filepaths into filemaker quickly and easily. (using the import folder script step.)

Attached is a file that does just that (imports an Image folder or just a refenace to the files in it.) I have also formated the thumbnail container field as a button that Opens the files path as a URL. (this should open the image with whatever is the defualt image viewer on the os)

Just an Idea!

Sample.zip

Posted

It does work on a Mac. It doesn't work with embedded files. You cannot open an embedded file directly from a container field. You need to export it first to a known location, then use the known path to open it.

BTW, if the file is not embedded, you don't need to use Open URL[] to open it. You can simply double-click the container. See also:

http://www.fmforums.com/forum/showpost.php?post/253451/

This topic is 6022 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.