Page 2 of 2

Re: Launch URL with tilde (~) ?

Posted: Thu Jul 07, 2016 4:51 pm
by Zax
[-hh] wrote:[Please tell us the versions you use: MacOS, Firefox, and LiveCode.]

Code: Select all

tell application "Safari" -- or "Firefox" or "Google Chrome"
   open location "http://ssl15.ovh.net/%7EmyDomain/myPage.html"
   -- open location "http://ssl15.ovh.net/~myDomain/myPage.html" -- works also
end tell
You could try it from the Applescript Editor to see if your LC version is the culprit. If not then you could try the different browsers if there are differences.

The Applescript solution works fine with

Code: Select all

open location "http://ssl15.ovh.net/~myDomain/myPage.html"
but it's not applicable with Windows.

I use:
  • LC 7.0 Community Edition
  • OS X 10.6.8
  • Firefox 45 (default browser)
  • Safari 5.1.10 (latest version for OS X 10.6)
My old Safari doesn't want "%7e" in URL, it converts it to "E8B3".

Re: Launch URL with tilde (~) ?

Posted: Thu Jul 07, 2016 6:48 pm
by [-hh]
1. Please try to use the *latest* stable LC 7, there were some Unicode issues with the first versions. May be this solves all problems.
2. In order to launch the URI with the *user's default browser* you may also try
(uses current system's launch services):

Code: Select all

-- launches myURL with user's default browser, works with LC 6/7/8
put "https://ssl15.ovh.net/~myDomain/myPage.html" into myURL
switch the platform
  case "MacOS"
    put shell ("open " & myURL) into nirvana
    break
  case "Win32"
    put shell ("explorer " & myURL) into nirvana
    break
  default
    launch URL myURL
    break
end switch

Re: Launch URL with tilde (~) ?

Posted: Fri Jul 08, 2016 8:41 am
by MaxV
Zax wrote:
MaxV wrote:What happen with this code

Code: Select all

put quote & "https://ssl15.ovh.net/~myDomain/myPage.html" & quote into myURL
put shell("/Applications/Firefox.app/Contents/MacOS/firefox " & myUrl)
??
If Firefox is already launched, Message Box contains:
...
If not, it works but it freezes LC.
OK, here the solution:

Code: Select all

put quote & "https://ssl15.ovh.net/~myDomain/myPage.html" & quote into myURL
put shell("/Applications/Firefox.app/Contents/MacOS/firefox " & myUrl & " &")
the space and & char after all permit to continue. It's a firefox on Mac behavviour.

Re: Launch URL with tilde (~) ?

Posted: Fri Jul 08, 2016 1:54 pm
by Zax
[-hh] wrote:1. Please try to use the *latest* stable LC 7, there were some Unicode issues with the first versions. May be this solves all problems.
2. In order to launch the URI with the *user's default browser* you may also try
(uses current system's launch services):

Code: Select all

-- launches myURL with user's default browser, works with LC 6/7/8
put "https://ssl15.ovh.net/~myDomain/myPage.html" into myURL
switch the platform
  case "MacOS"
    put shell ("open " & myURL) into nirvana
    break
  case "Win32"
    put shell ("explorer " & myURL) into nirvana
    break
  default
    launch URL myURL
    break
end switch
This code works! Thank you very much :)
BTW, I tried with the regular "launch URL" command with LC 7.14 but the problem is the same.

Re: Launch URL with tilde (~) ?

Posted: Fri Jul 08, 2016 2:21 pm
by [-hh]
Aha, your post revealed a text encoding problem of LC's "launch URL" with MacOS 10.6.
You could think about reporting this as bug. Also MaxV's solution (without his workaround) shouldn't freeze LC.

Let me denote for completeness another candidate for launching an URL with the default webbrowser in case "launch URL ..." doesn't work.
This works here with several linux flavours and also on MacOS and also on Win 7/10 (if Python is installed):

Code: Select all

put shell("python -m webbrowser " & myURL) into nirvana

Re: Launch URL with tilde (~) ?

Posted: Fri Jul 08, 2016 2:57 pm
by MaxV
[-hh] wrote: ... Also MaxV's solution (without his workaround) shouldn't freeze LC. ...
No without the " &" it must freeze livecode. The Firefox guideline on Mac requires to use " &", otherwise the shell freezes untill Firefox closes.