Jump to content

Recommended Posts

  • Newbies

I have a FMP 15 Advanced product application with a few hundred entries. Most entries have a photo shown in a container field. The photo has been entered as reference only.

Most of the entries have multiple photos, showing multiple aspects of the item. For now, viewing the other photos in full size requires going into File Explorer and navigating to the directory holding the photos. Each item necessarily has it's own directory. This is cumbersome and seldom done unless absolutely necessary.

If I insert a document, I can double-click it to open it. I would like to be able to do this with the photo, or with a button on the layout.

I use Irfanview as my photo viewer and would either like to open that program with the photo (and thus be able to cycle through all the photos in the directory, or at least open the directory in Windows Explorer so I can browse the photos from there.

I have been researching and working on this for many days, many hours and no luck.

Using the Send Event step, open document, text, with bring target to foreground.

With:

"C:\Program Files\IrfanView\i_view64.exe" /(Replace ( GetValue ( GetAsText ( Table::field); 3); 1; 10; ""))

Irfanview will open, but generically with no relation to the photo or path.

By setting a global variable to:  (Replace ( GetValue ( GetAsText ( Table::field); 3); 1; 10; ""))   I have been able to see it is capturing the absolute path of the photo without the "imagewin:" prefix.

Can anyone help, please?

 

Link to post
Share on other sites

Try not to use a calculation in the final command, makes it harder to troubleshoot.  Calculate the full path ahead of time in a variable so that you can expect it and see if is what you expect it to be.

Note that since you're issuing a command line command, there are many characters that could break it, so vet your file names carefully.

Link to post
Share on other sites
  • Newbies

Thanks for your reply!

 

My filenames for the image files tend to be short and sweet, with no unusual characters. I have too many images to deal with to get too creative there.

If I create the global variable $$variable then substitute for the equation as /$$variable Irfanview opens as a program like before, but with no relationship to the photo.

If I remove the forward slash before the variable, Irfanview opens, but tries to open the variable directly as an image file, giving me the error message "Cant read file header, Unknown file format, empty/damaged file or file not found."

If I use the Set Field command to set GlobalField to the calculation of the photo address, the issue is the same. With the forward slash  as /GlobalField, Irfanview opens as a program, but with no relation to the image. Without the forward slash, Irfanview tries to open GlobalField directly as an image, giving me the same error message as above.

By the way, Irfanview is the program registered in Windows 10 as the image program. If I try to open the image without specifying Irfanview, I get a dialog telling me "You'll need a new app to open this link", giving me the option to download one from the Microsoft Store. If I follow that option, I get the message "No App available". It does not matter if I try the GlobalDir or the $$variable approach. The result is the same.

Surely I can't be the only one using FMP that wants to double-click a photo and have it open from the directory where it resides.

Thanks again for your reply. Any other thoughts? And did I miss something in your reply?

Anyone?

 

Edited by PapiTab Tab
Link to post
Share on other sites

Can you post a screenshot of the Send Event script step configuration?  I have a suspicion of what is going on but I need to see it confirmed in a screenshot

Link to post
Share on other sites
  • Newbies

Thank you for your interest in helping.

I have solved the problem!

I found in another database a test script where I had been working on the same problem (some time ago). At that time I was trying the Open Url script step. I don't know why I stopped, I guess because the missing piece was capturing the file path from the container field. I shied away from Open Url this time because initially I couldn't get it to work, plus I kept reading how it would open the file in a browser window, which is decidedly not what I wanted to do.

At any rate, Open Url was the way to go.

Solution:

•  Set Variable

         Name:  $$ItemPhoto

         Value:  Replace ( GetValue ( GetAsText (  <Table::ContainerField>  ); 3); 1; 10; "")

•  Open Url  [With dialog:off;  $$ItemPhoto]

I don't know that I needED to set the variable, but I like your idea of resolving the calculation ahead of the Open Url command.

I set a button on the layout to run the script. I don't have to point the script to the Irfanview program; Irfanview automatically opens as my Windows-default image program.

One issue I had, is that with some records the Irfanview program opened with the photo (and I could cycle through all the photos in the directory as I had wished to do). But with other records Irfanview would not open at all. And the variable $$ItemPhoto was not being updated to the new file path. Luckily the first time I tried this approach, I happened to be in a record where the photo would display in Irfanview, otherwise I might still be hacking away at script steps.

I don't know what the difference between records was, but reinserting the photo into the container field (always as a file reference, never embedded) resolved the issue. Now all records are performing.

Now to go back to the other database and fix the issue there!

Thanks again for your help!   🙂🙂🙂

Edited by PapiTab Tab
Minor corrections
Link to post
Share on other sites

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.