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

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

Recommended Posts

Posted

Howdy, all:

Just a quick question: As it stands now in my solution, a user has to double-click his or her mouse to open a file reference (a .pdf) stored in a Container field. What I'd like to do is make the container field a button so when it's clicked once, the .pdf opens. Ideas?

Thanks!

Rich

Posted

You can make the container field a button with a Go To Field [select/Perform] on the conatiner field itself.

You can also use Open URL with the correct file path.

  • Newbies
Posted

Hi,

I need something similar, but I tried this solution and nothing happens when I click. Maybe I did something wrong.

I have a container with an image of a pdf inserted. I want this file to open when I click on it.

I'm a total newbie!

Thanks

Posted

I think you have your file embedded instead of referenced as a link.

  • Newbies
Posted

If I disable the script, I can right click and export the file. I guess that means its embedded.

I need the image of the pdf as a big thumbnail-I guess I can't have a thumbnail if I don't embed?? but I also need to open the file. This could be a link to the original file or just opening the embedded file. The best I've managed was click-right and export to open, but it seems clumsy.

Is there any way to tell a script to open an embedded file in its default app. when double-clicked?

Posted (edited)

*blush* I spoke out of turn--see Mr. Vodka's response below.

Edited by Guest
Firmly embedded foot into mouth
Posted

Dnick,

When you have an embedded file, you will have to export its contents. With FM9 and above, you can have it so that you can export it to your temporary path. This can be scripted.

Here is a quick script that can check to see if its embedded or referenced and then use a different way to open it.


Set Variable [$container; GetAsText ( YourContainer ) ]

If [ ValueCount ($container) = 1 ]

   Set Variable [ $path; Case ( Abs ( Get (SystemPlatform)) = 1; "filemac:"; "filewin:" ) &  Get (TemporaryPath) & $container ]

   Export Field Contents [ YourContainer; $path; AutoOpen ]

Else If [ ValueCount ($container) > 1 ]

   Go To Field [select/Perform; YourContainer ]

End If

  • Newbies
Posted

I'm afraid I couldn't get this to work. Put it down to ignorance! I tried this:

I went to 'script', 'new script', 'perform script' from box at left and 'move'

selected 'specify', 'edit'

this took me to the 'specify calculation' window

I pasted in your script

changed "YourContainer" to "image" 3 times

and clicked OK

This gave me a dialog saying "the specified table cannot be found"

I couldn't see how to proceed and gave up.

My database is still in the design stage, ie. I can change this container without losing any records. I can live with either embedded or referenced files. What I need is the right way of inserting an image (big thumbnail) in my container so that I can call up the complete file by clicking on it.

Thanks loads for your help.

Posted

No Perform Script [] is a script step that calls another script, such as when you need s sub-script.

Those steps that I posted will have to be selected individually from the left navigation of the Script window. You can not copy and paste the whole thing.

  • 2 weeks later...
  • Newbies
Posted

I got the script to work and it went some way to resolving my problem.

First, there were some small differences between the script I managed to produce and the one suggested by John. I copy mine below in case any of these are critical:

Set Variable [$container; Value:GetAsText ( Spese::image )]

If [ ValueCount ($container) = 1 ]

   Set Variable [$path; Value:Case ( Abs ( Get (SystemPlatform)) = 1; "filemac:"; "filewin:" ) &  Get (TemporaryPath) & $container]

   Export Field Contents [ Spese::image; $path; Automatically open ]

Else If [ValueCount ($container) > 1]

   Go To Field [select/Perform; Spese::image]

End If

Now, when I click on the image in the container of my first record, the file opens exactly as I want. But other records don't open.

Also, I see that there is a 'repetition' setting for some parts of the script and this sets automatically to '1'. I tried changing this and the script stopped working.

David

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