Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Sets the user's preferred handler for the specified URL scheme to point to the current application.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
URLScheme | 2.0 | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |
(old name: SetDefaultHandlerForURLScheme)
Parameter | Description | Example | Flags |
---|---|---|---|
scheme | The schema name. | "http", "https", "mailto" or something else | |
bundleID | Available in MBS FileMaker Plugin 7.5 or newer. The bundle ID for the application. If empty, we use the one of the current application. |
Optional |
Returns OK or an error message on failure.
Set runtime to be default email application:
MBS("URLScheme.SetDefaultHandler"; "mailto")
Register URL scheme for runtime:
If [MBS("IsMacOSX") and MBS("IsRuntime")]
# make us the default app for FMP URL scheme
Set Variable [$vorher; Value:MBS( "URLScheme.GetDefaultHandler"; "fmp" )]
Set Variable [$setResult; Value:MBS( "URLScheme.SetDefaultHandler"; "fmp" )]
Set Variable [$r; Value:MBS( "URLScheme.GetDefaultHandler"; "fmp" )]
# okay or failure?
If [$r ≠ "com.filemaker.client.runtime12.Test"]
# Register by using lsregister tool on command line
Set Variable [$r; Value:MBS( "RunTask.NewTask" )]
Set Variable [$r; Value:MBS( "RunTask.SetLaunchPath"; "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister")]
Set Variable [$path; Value:MBS( "App.GetProcessPath" )]
Set Variable [$r; Value:MBS( "RunTask.SetArguments"; "-f"; $path /*"/Applications/Test/Test.app" */)]
Set Variable [$r; Value:MBS( "RunTask.Launch")]
# wait until finished
Loop
Pause/Resume Script [Duration (seconds): ,1]
Exit Loop If [MBS("RunTask.IsRunning") ≠ 1]
End Loop
# Check again
Set Variable [$setResult; Value:MBS( "URLScheme.SetDefaultHandler"; "fmp" )]
Set Variable [$r; Value:MBS( "URLScheme.GetDefaultHandler"; "fmp" )]
End If
End If
Select this FileMaker Pro to receive fmp URLs:
MBS("URLScheme.SetDefaultHandler"; "fmp")
Set fmp handler to FMP Advanced:
MBS( "URLScheme.SetDefaultHandler"; "fmp"; "com.filemaker.client.advanced12")
This function checks for a license.
Created 18th August 2014, last changed 22nd October 2018