Task Object

Methods

task:browserdostring(luacode)

Runs a Lua script in the browser process.

task:dopackfile(pakfilename,scriptfilename)

Loads and runs a Lua script that is inside an extension package.

task:logrequest(json)

Can be used to manually log a request from a custom HTTP client class to the Live Headers list.
See Request for details.

task:getpackfile(pakfilename,filename)

Gets the contents of a file that is inside the specified extension package.
returns: string

task:sendrequest(json)

Performs a custom HTTP request in the tab that launched the task and adds the request to the Live Headers list..
See Request for details.

task:setprogress(position,max)

Updates the progress bar from the task progress monitor panel. If the second parameter is omitted, 100 is used as maximum value.

task:setscript(event,luacode)

Sets a Lua code to be executed during specific task progress monitor panel events (eg: onclick, ondblclick, onstop).

task:showmessage(s)

Displays a message to the user

task:stop(reason)

Manually stops the task. Sandcat will automatically call this method at the end of the task execution (if the method has not been called before).

Properties

captionstringGets or sets the task caption
idstringGets the unique ID of the task
pidstringGets the process ID of the task
statusstringGets or sets the task status text

Other Functions

getappdir()

Returns the Sandcat installation directory
returns: string

parambool(key,defaultvalue)

Returns the value of a parameter key as a boolean value. If the supplied key is not found and a default value has been supplied, returns the default value.
returns: boolean

paramint(key,defaultvalue)

Returns the value of a parameter key as an integer value. If the supplied key is not found and a default value has been supplied, returns the default value.
returns: integer

paramstr(key,defaultvalue)

Returns the value of a parameter key as a string. If the supplied key is not found and a default value has been supplied, returns the default value.
returns: string

print(v)

Prints a line to the task log

printfailure(v)

Prints a line to the task log and paints the task progress monitor panel in red color

printsuccess(v)

Prints a line to the task log and paints the task progress monitor panel in green color

All functions from the Selenite Library are also available from within a Sandcat Task.

Page last modified on October 23, 2015, at 10:53 PM
2013 Syhunt