Lingo Dictionary > G-K > getNetText() |  |

getNetText()

Syntax

    getNetText(URL {, serverOSString} {, characterSet})
    getNetText(URL, propertyList {, serverOSString} {, characterSet})

Description

Function; starts the retrieval of text from a file usually on an HTTP or FTP server, or initiates a CGI query.

The first syntax shown starts the text retrieval. You can submit HTTP CGI queries this way and must properly encode them in the URL. The second syntax includes a property list and submits a CGI query, providing the proper URL encoding.

Use the optional parameter `propertyList` to take a property list for CGI queries. The property list is URL encoded and the URL sent is `(urlstring & "?" & encodedproplist).`

Use the optional parameter `serverOSString` to encode any return characters in `propertylist`. The value defaults to `UNIX` but may be set to `Win` or `Mac` and`` translates any carriage returns in the `propertylist` argument into those used on the server. For most applications, this setting is unnecessary because line breaks are usually not used in form responses.

The optional parameter `characterSet` applies only if the user is running Director on a `shift-JIS` (Japanese) system. Possible character set settings are `JIS`, `EUC`, `ASCII`, and `AUTO`. Lingo converts the retrieved data from `shift-JIS` to the named character set. Using the AUTO setting, character set tries to determine what character set the retrieved text is in and translate it to the character set on the local machine. The default setting is ASCII.

For a movie that plays back as an applet, the `getNetText` command retrieves text only from the domain that contains the applet. This behavior differs from Shockwave and is necessary due to Java's security model.

Use `netDone` to find out when the `getNetText` operation is complete, and `netError` to find out if the operation was successful. Use `netTextResult` to return the text retrieved by `getNetText`.

The function works with relative URLs.

To see an example of `getNextText()` used in a completed movie, see the Forms and Post movie in the Learning\Lingo Examples folder inside the Director application folder.

Note: Executing any network Lingo operations concurrently with a Shockwave Audio (SWA) stream can cause interruptions in the playback of the SWA stream.

Example

This script retrieves text from the URL http://BigServer.com/sample.txt and updates the field cast member the mouse is on when it's clicked:

    property spriteNum
    property theNetID

    on mouseUp me
    	theNetID = getNetText ("http://BigServer.com/sample.txt")
    end

    on exitFrame me
    	if netDone(theNetID) then
    		sprite(spriteNum).member.text = netTextResult(theNetID)
    	end if
    end

Example

This example retrieves the results of a CGI query:

    getNetText("http://www.yourserver.com/cgi-bin/query.cgi?name=Bill")

Example

This is the same as the previous example, but it uses a property list to submit a CGI query, and does the URL encoding for you.

    getNetText("http://www.yourserver.com/cgi-bin/query.cgi", [#name:"Bill"])

See also

`netDone()`, `netError()` , `netTextResult()`