Script to open an image in a calculated container
I have a calculated field that gives the filepath for an image stored on the local hard drive. The result of the calculation is imagemac:/.... or imagewin:/ depending on the OS. This works fine, and the image can be seen in the database record.
I am trying to develop a script that would enable me to open the same image in an image viewer outside of filemaker.
I have worked out that I can get the filepath using GetValue (Table::ContainerField ; 1)
But just cannot manage to make a script step to open the file. I have tried PhilModJunks script:
SetVariable [$FilePath ; value:
Let ( [ path = GetValue ( Photo::PhotoContainer; 3 ) ;
L = Lenght ( path ) ;
F = Right ( path ; L - Position ( path ; "/" ; L ; -1 ) ) ] ;
"file:" & Get ( TemporaryPath ) & F
) // let
Followedd by Export Field Contents, but this gives a text file in the temporary path that has the name of the image file, but actually contains a snipped of text! Preview of course cant open this.
Grateful for any assitance