Tips_todo   >   Internet   >   Internet Misc

Internet Misc

This section covers odds and ends of internet related programming for Omnis Studio.

If you are looking for Web Client and Web Server information see the Internet > Web Client tab.

Open Web Browser to URL

This tip provides cross platform code for opening the default web browser and pointing it to a specified URL. The Go to URL button in the StudioTips Browser window uses this code.

You can copy the sample code included with this tip to your library.

; Open the default browser to a specified URL.
Switch sys(6)
      
   Case 'M','X' ;; Mac, Mac OS X
      
      Calculate ScriptText as con('open location "',iMyURL,'"')
      Calculate ScriptText as con('$runapplescript(',chr(39),ScriptText,chr(39),')')
      Calculate #F as [ScriptText]
      
   Case 'W','N' ;; Windows, Windows NT or 2000
      
      ; Register DLL (parameters) (command not visible by Mac users)
      X250825050 ('Shell32.dll','ShellExecuteA','JJCCCCJ') Returns ErrorCode
      ; Call DLL (parameters) (command not visible by Mac users)
      X250825051 ('Shell32.dll','ShellExecuteA',0,'#NULL#',iMyURL,'','#NULL#',1)
      
   Default
      
      OK message [sys(85)] (Icon) {Sorry I don't know how to open your Internet browser}
      
End Switch