Use fmp url to open a FileMaker file

Modified on September 13, 2014.

FileMaker Pro 13 fmp url location aware script for a FileMaker Pro database hosted on FileMaker server or served locally on Mac, Windows or FileMaker Go

Notes:
– requires FileMaker 13.0v2
– filenames are case-sensitive; script names are not case-sensitive.
– the filename extension .fmp12 is not required.
– you can define multiple variables in the same FMP protocol.
– if spaces are needed in a link, replace every space with %20 or a plus sign (+) if %20 doesn’t work.

To open a file named Demo.fmp12 on the host machine with an IP address of 127.0.0.1 and run a script named fmpURLResult, pass a parameter hello and a local variable $var with a value of 123:

Syntax for files shared on server:
fmp://MyAccount:MyPassword@127.0.0.1/Demo.fmp12?script=fmpURLResult&param=hello&$var=123

Syntax for files stored locally on iOS 6 or iOS 7:
fmp://MyAccount:MyPassword@%7e/Demo.fmp12?script=fmpURLResult&param=hello&$var=123

Syntax for files stored locally on a version 5 iOS device:
fmp://MyAccount:MyPassword@~/Demo.fmp12?script=fmpURLResult&param=hello&$var=123

Username and Password – MyAccount:MyPassword@ – are only required if needed to open the file/run the script.

If you want one script to trigger a script in/open your FileMaker database that is either open and shared on a FileMaker server or stored locally on your iPhone or iPad here are the FileMaker script steps:

#
#
# Abs(Get(SystemPlatform)) = 3 // iOS ;
# Abs(Get(SystemPlatform)) = 2 // Windows ;
# Abs(Get(SystemPlatform)) = 1 // Mac
# Get(ApplicationVersion) options = Pro, ProAdvanced, Runtime, Web Publishing Engine, xDBC,Server, Go, Go_iPad
#
#

If [ Abs(Get(SystemPlatform)) = 3 ]
# running script on iOS, assume iOS version 6 or iOS version 7

Set Variable [ $url; Value:”fmp://%24/” ]
Else

# running script NOT on an iOS 6 /7 device
# assume shared via server IF this file is opened on server

If [ PatternCount ( Get ( FilePath ) ; “fmnet” ) ]

# open from server

Set Variable [ $url; Value:”fmp://” & Get ( HostIPAddress ) & “/” ]

Else

# open from local hard drive

Set Variable [ $url; Value:”fmp://$/” ]
End If

End If

#

Open URL [ $url & Get ( FileName ) & “?script=fmpURLResult&param=hello&$var=123” ]
[ No dialog ]