Skip to content

Commit fa629ec

Browse files
committed
Merge pull request livecode#3885 from livecode/community-docs
Community docs merge 08.04.16
2 parents 22e098a + 9e19353 commit fa629ec

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

docs/dictionary/keyword/URL.lcdoc

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,41 @@ Example:
1818
get URL "http://www.xworlds.com/index.html"
1919

2020
Example:
21-
put URL "binfile:/Mac HD/Files/example.gif" into image "Example Logo"
21+
put URL "binfile:/Users/myuser/Files/example.gif" into image "Example Logo"
2222

2323
Example:
2424
post field "Results" to URL "http://www.example.org/current.txt"
2525

2626
Example:
2727
get URL "http://www.xworlds.com/index.html"
2828

29+
Example:
30+
put "Hello World" into URL "file:/Users/myuser/Documents/sample.txt"
31+
32+
Example:
33+
# Writing the contents of a field to an external file, preserving text encoding
34+
on textSave
35+
put "всем привет" into field "russiantext"
36+
put textEncode(field "russiantext","UTF-8") into "binfile:/Users/myuser/Documents/russtext.txt"
37+
end textSave
38+
# Reading contents of a file into LiveCode, preserving text encoding
39+
on textRead
40+
local tText
41+
put URL "binfile:/Users/myuser/Documents/russtext.txt" into tText
42+
put textDecode(tText,"UTF-8") into field "russiantext"
43+
end textRead
44+
2945
Description:
3046
Use the <URL> <keyword> to access the contents of a local <file> or a <file> accessible on the Web.
3147

32-
A <URL> is a method of designating a file or other resource. You can use a <URL> like any other container. You can get the contents of a <URL> or use its contents in any expression. LiveCode supports the following <URL> schemes:
48+
A <URL> is a method of designating a file or other resource. You can use a <URL> like any other container.
49+
You can get the contents of a <URL> or use its contents in any expression. LiveCode supports the following <URL> schemes:
3350

34-
http: a page from a web server
35-
ftp: a directory or file on an FTP server
36-
<file> : a text file on the local disk (not on a server)
37-
binfile: a binary file
38-
resfile: on Mac OS and OS X systems, the resource fork of a file
51+
* http: a page from a web server
52+
* ftp: a directory or file on an FTP server
53+
* file: a text file on the local disk (not on a server)
54+
* binfile: a binary file
55+
* resfile: on Mac OS and OS X systems, the resource fork of a file
3956

4057
All actions that refer to a <URL> container are blocking: that is, the handler pauses until LiveCode is finished accessing the <URL>. Since fetching a web page may take some time due to network lag, accessing URLs may take long enough to be noticeable to the user. To avoid this delay, use the load command (which is non-blocking) to cache web pages before you need them.
4158

@@ -49,4 +66,4 @@ From LiveCode 7.0.0, URL keyword has been upgraded to understand Unicode files w
4966

5067
References: HTMLText (property), URL (keyword), file (keyword), libURLSetAuthCallback (command), launch url (command), libURLSetExpect100 (command), load (command), container (glossary), keyword (glossary), resource (glossary)
5168

52-
Tags: networking
69+
Tags: networking,file system

0 commit comments

Comments
 (0)