Click or drag to resize

RapidGetTask Method

Gets a Task object referencing a specific task.

Namespace:  ABB.Robotics.Controllers.RapidDomain
Assembly:  ABB.Robotics.Controllers (in ABB.Robotics.Controllers.dll) Version: 6.5.129.0
Syntax
C#
public Task GetTask(
	string taskName
)

Parameters

taskName
Type: SystemString
Name of the task.

Return Value

Type: Task
A Task object to access the task. If the task does not exist, the return value is null.
Exceptions
ExceptionCondition
GeneralExceptionA General Exception has occurred.
Remarks
NOTE:When the returned instance is no longer needed you must call its Dispose method.
Examples
The example below gets an instance of TaskT_ROB1, uses its method GetRapidData(String) to create a RapidData object of the RAPID variable reg1, which is declared in the USER module. The value reg1 is displayed in a textbox.
private void DisplayValueOfReg1()
{
    Task t;
    RapidData rdReg1;
    try
    {
        Create Controller if not created
        if (_controller == null)
            _controller = new Controller();

        // Create a Task object
        t = _controller.Rapid.GetTask("T_ROB1");

        // Create RapidData object for reg1
        rdReg1 = t.GetRapidData("T_ROB1","USER","reg1");

        // Get value of reg1 as a Num 
        Num nValOfReg1 = (Num) rdReg1.Value;

        // Display value of 
        textBox1.Text = nValOfReg1.ToString();
    }
    catch (GeneralException ee)
    {
        // TODO: Implement error handling here
    }
    catch (System.Exception ee)
    {
        // TODO: Implement error handling here
    }
    finally
    {
        // Make sure rdReg1 is dispoed
        if (rdReg1 != null)
            rdReg1.Dispose();

        // Make sure t is dispoed
        if (t != null)
            t.Dispose();
    }    
}
See Also