Brian Dunning's FileMaker Custom Functions

TroiToFMP ( TroiPath, FileOrImage )

Converts TROI File Plug-in paths to FMP Paths

  Average rating: 4.4 (32 votes) Log in to vote

Don Wieland   Don Wieland - Show more from this author
DW Data Concepts
http://dwdataconcepts.com

Share on Facebook Share on Twitter

  Sample input:
TroiToFMP("Macintosh HD:TestFolder:TestFile.txt", "File")

TroiToFMP("C:\Documents and Settings\TestImage.jpg", "Image")
  Sample output:
filemac:/Macintosh HD/TestFolder/TestFile.txt

imagewin:/C:/Documents and Settings/TestImage.jpg

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Converts TROI File Plug-in paths to FMP Paths. If this path is a FILE or FOLDER, use "file" as the FileOrImage value. If this path is an IMAGE, use "image" as the FileOrImage value.

Takes into consideration MAC and WINDOWS platforms.

 

Comments

Gregg Holbert   Gregg Holbert, Fort Worth, Texas
Jan 17, 2017
/*Did not work for UNC filepaths on Windows for me. I added the last Substitute to fix it.*/

Let([
x = TroiPath;
a=FileOrImage;
p=Abs(Get(SystemPlatform)) = 1;
mr=If(a = "File"; "filemac:/"; "imagemac:/") & Substitute(x; ":"; "/");

wr=If(a = "File"; "filewin:/"; "imagewin:/") & Substitute(x; "\\"; "/")

]
;

If( p ; mr; (Substitute(wr; "filewin:///"; "filewin://") ) )
)
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: