Setting url of browser widget, incompatible characters
Peter TB Brett
peter.brett at livecode.com
Wed Mar 23 08:22:50 EDT 2016
On 23/03/2016 12:11, Tore Nilsen wrote:
> This would work unless the file name contained space characters. Changing the script to replace space characters with %20 would rectify this problem.
>
> on mouseUp
>
> answer file "Choose file"
>
> put "file://"& it into tPath
>
> repeat with i = 1 to the number of chars of tPath
>
> if char i of tPath is space then
>
> put "%20" into char i of tPath
>
> end if
>
> end repeat
>
> put tPath into field "url"
>
> set url of widget "browser" to tPath
>
> end mouseUp
Hi Tore,
You should use URLEncode(). For example:
on mouseUp
answer file "Choose file"
put "file://" & URLEncode(it) into tUrl
put tUrl into field "url"
set url of widget "browser" to tUrl
end mouseUp
I'm just in the process of updating the documentation for the browser
widget to make this clearer.
Peter
--
Dr Peter Brett <peter.brett at livecode.com>
LiveCode Open Source Team
LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/
More information about the use-livecode
mailing list