# Class: oTool

## $. oTool

#### new $.oTool(id, name)

openHarmony/openHarmony_tool.js, line 82
  The constructor for the $.oTool class

  Name | Type | Description
  --- | --- | ---
  `id` | int | The id of the tool
  `name` | name | The name of the tool

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `id` | int | The id of the tool
  `name` | name | The name of the tool

  ##### Example

      // Access the list of currently existing tools by using the $.app object
      var tools = $.app.tools;

      // output the list of tools names and ids
      for (var i in tools){
        log(i+" "+tools[i].name)
      }

      // To get a tool by name, use the $.app.getToolByName() function
      var brushTool = $.app.getToolByName("Brush");
      log (brushTool.name+" "+brushTool.id)            // Output: Brush 9

      // it's also possible to activate a tool in several ways:
      $.app.currentTool = 9;         // using the tool "id"
      $.app.currentTool = brushTool  // by passing a oTool object
      $.app.currentTool = "Brush"    // using the tool name

      brushTool.activate()           // by using the activate function of the oTool class

### Members

#### stencilsArray.<$.oStencil>

  The list of stencils this tool can use. Not currently supported by custom tools.

### Methods

#### activate()

openHarmony/openHarmony_tool.js, line 124
  Activates the tool.