Page 1 of 1

Native Open URL

Posted: Fri Sep 19, 2025 5:20 pm
by mrbungle
One can use the RunProgram() command to open a URL, but sometimes using a native function is faster. This will allow you to open any URL from your PB apps:

Code: Select all

Procedure OpenURL(URL.s)
  Protected NSURL = CocoaMessage(0, 0, "NSURL URLWithString:$", @URL)
  If NSURL
    Protected workspace = CocoaMessage(0, 0, "NSWorkspace sharedWorkspace")
    CocoaMessage(0, workspace, "openURL:", NSURL)
  EndIf
EndProcedure

Foo.s = "https://www.google.com")
OpenURL(Foo)