URL on a PC bug?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

URL on a PC bug?

Post by lohill » Fri Jan 15, 2016 5:57 pm

I have come across what appears to be a bug using "URL" on a PC and I would like confirmation that what I am seeing is what others see. If it really is a bug rather than my problem then it should be reported immediately because it is definitely a game breaker. The code below is an example of how to create the error:

Code: Select all

on mouseUp
   answer file "Locate a text file for opening." with "OK" or "Cancel"
   if It = "Cancel" then exit mouseUp
   put "file:/" & it into tFile
   put URL tFile into tData
   answer tData
end mouseUp
On a Mac in LC 7.1.1 it runs just fine, both in the IDE and in a standalone. On a PC in either environment, the statement "put URL tFile into tData" fails and nothing is put in tData. There are no error messages just nothing in the "answer dialog".

I have only been able to test it on the PC side in two different Parallels virtual machines, one in Windows 7 and one in Windows 10. Am I making any errors here or is this a real problem?

Larry

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: URL on a PC bug?

Post by FourthWorld » Fri Jan 15, 2016 6:08 pm

With many commands in LiveCode it's useful to check "the result" immediately after the command should anything go wrong. Any file I/O operations are good candidates, even better when accompanied by a call to sysError so the OS can tell you more specifically what's going on, e.g.:

Code: Select all

   put URL tFile into tData
   if the result is not empty then
       answer the result &"("& sysError() &")"
       exit to top
   end if
   answer tData
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: URL on a PC bug?

Post by Klaus » Fri Jan 15, 2016 6:32 pm

Hi lohill,

remove the SLASH and try again:
...
if It = "Cancel" then exit mouseUp
## put "file:/" & it into tFile
put "file:" & it into tFile
put URL tFile into tData
answer tData
...
You can also have it much shorter:
...
if It = "Cancel" then exit mouseUp
answer url("file:" & it)
...
:D


Best

Klaus

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: URL on a PC bug?

Post by lohill » Fri Jan 15, 2016 6:45 pm

Thanks guys. What a relief.

Larry

Post Reply