Global Properties for Working with URLs and Sockets

If you are working with URLs, sockets, and processes in your SenseTalk scripts, the following global properties let you change timeout values and cache behavior.

For information about working with URLs and sockets in SenseTalk, see Socket, Process, and Stream Input and Output and URL Transactions and Formatting.

For additional information about working with local and global properties, see Local and Global Properties in SenseTalk.

the URLCacheEnabled Global Property

Values: True, False

Default: True

Behavior: This global property controls whether the contents retrieved from a URL resource can be cached. When set to True (the default), URL contents can be cached by the system and retrieved from the cache rather than being fetched remotely each time. To force a fresh copy of the URL to be loaded, set the URLCacheEnabled property to False before accessing a URL.


set the URLCacheEnabled to false


set the URLCacheEnabled to false

put url "" into appleHomePage -- Get a fresh copy

set the URLCacheEnabled to true -- Restore caching

the URLTimeout Global Property

Values: A time value, in seconds

Default: 30 seconds

Behavior: This global property specifies the maximum time allowed before a URL resource request times out. If this time limit is exceeded or there is no Internet connection available, or if some other error occurs, the result() function returns an exception object identifying the error, which can be accessed on the next line of the script.


set the URLTimeout to 45


set the URLTimeout to 10

put url ""

the URLErrorLevel Global Property

Values: An integer

Default: 400

Behavior: This global property value indicates the lowest URL status code that is treated as an error when fetching the contents of a URL. The default value is 400, so a returned status value of 400 or above either throws an exception or sets the result() function to an exception (depending on the current setting of the throwExceptionResults global property). You can set the URLErrorLevel to zero (or to any sufficiently large number) to prevent this type of exception from being generated.


set the URLErrorLevel to 450


set the URLErrorLevel to 300

set the throwExceptionResults to false

put url "http://localhost:8080/api/test"

put the result into Problem

if Problem Contains "401" then

log "Unauthorized."

else if Problem Contains "307" then

log "Redirected"

end if

the readTimeout Global Property

Values: A time value, in seconds

Default: 30 seconds

Behavior: This property sets the maximum time a socket read request waits for data to become available. If the socket is unavailable within the time limit, an exception is thrown. If the requested data is not read within the time specified by the readTimeout, whatever has been read is returned and the result() function is set to indicate time out.


set the readTimeout to 60


set the readtimeout to 5

open process "skype"

read from process "skype" until end // Tries reading the process for 5 seconds

put the result // Displays 'time oseut'

close process "skype"



This topic was last updated on August 19, 2021, at 03:30:51 PM.

Eggplant icon | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant