RoboTask object for Python

<< Click to Display Table of Contents >>

Navigation:  Actions > Script tools > Python Script >

RoboTask object for Python

RoboTask object is similar in functionality to the built-in COM object RoboTaskApp, but there are major differences. Please note that Python is case-sensitive.

Here is an example of how to use the object:

 

from robotask import *

rt = RoboTask()

print(rt.version)

print(rt.version['plain'])

 

The basic Python package doesn't contain a Windows COM object support module. However, you can use your Python with pywin32 support (see here) and use the RoboTaskApp object directly. Code example:

 

import win32com.client as win32

rt = win32.Dispatch('RoboTask.App')

print(rt.Version)

print(rt.TaskCount)

 

 

RoboTask()

Constructor.

Creates RoboTask object.

Use:

rt = RoboTask()

 

version

Property.

Returns dictionary with fields:

plain - RoboTask text version. For example, "8.3"

major - major version (8)

minor - minor version (3)

 

task_count

Property.

Returns the number of registered tasks in RoboTask.

 

expand_text(text)

Method.

Expands a string containing RoboTask variables and returns it.

For example, expression

rt.expand_text('Date and time now: {DateTimeToFormat({DateTime},yyyyy-mm-dd hh:nn:ss)}')

Will return a value like this:

Date and time now: 2021-04-01 17:57:35

 

log(text)

Method.

Outputs the specified text to the task log in user message mode.

 

log_info(text)

Method.

Outputs the specified text in the log in system message mode.

 

log_warning(text)

Method.

Outputs the specified text in the log in warning mode.

 

log_error(text)

Method.

Outputs the specified text to the task log in error message mode

 

add_user_var(name, value)

Method.

Creates RoboTask variable with NAME name and VALUE value.

 

set_user_var(name, value)

Method.

Sets the VALUE to RoboTask variable with name NAME.

 

del_user_var(name)

Method.

Deletes RoboTask variable named NAME.

 

task_info(num)

Method.

Returns task information by number or name (external name).

Method returns dictionary with fields:

name - task name (title).

ext_name - external name. You can use this name to refer to the task in the script

enabled - True or False

state - task state. Can have 5 values:

manual - the task has no triggering events, or its triggering events are disabled (see the enabled property). It waits to be run manually or from another task;

idle - the task has some enabled triggering events. It waits to be run automatically,

disabled - the task is disabled while editing,

running - the task is started and in progress,

stopped - the task received the stop command, but it is yet running. After the task is completely stopped, its status becomes either "manual" or "idle".

 

current_task()

Method.

Returns information about the current task.

The result is exactly the same as task_info method except that it returns information about the current task.

 

start_task(ext_name, params = '')

Method.

Start task by number or External Name.

Parameters

ext_name - task number or external name

params - parameters of the task to be launched. Empty string by default. Parameters can be set as text, one parameter per line :

parameter_name=parameter_value

 

stop_task(ext_name)

Method.

Stops task with a specified number or External Name

Note that RoboTask only sends a signal to stop the task. The task will stop when the step that is currently in progress is completed.

 

enable_task(ext_name)

Method.

Changes task state by number or External Name to "enabled" and starts all "enabled" task triggers.

 

disable_task(ext_name)

Method

Changes task state by number or External Name to "disabled" and stops all active task triggers.

 

service_mode

Property

Returns logical value.

True - RoboTask is running in service mode.

False - RoboTask is running in normal app mode.

 

window_handle

Property

Returns the RoboTask's window handle that receives system messages.

 

 

note Related Topics

Python Script

JavaScript/Node.js script

RoboTask object for node.js

PowerShell script

JS script

JS Evaluate

VB Script

VB Evaluate

RoboTaskApp object