Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need scriptlet for double-click of a mouse

Featured Replies

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

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.

  • Author

Worked like a charm--thanks!

  • Newbies

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

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

  • Newbies

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?

  • Author

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

Edited by Guest
Firmly embedded foot into mouth

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

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.

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

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

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.