---
title: "createShelfButton"
canonical: "https://help.vicon.com/space/Shogun16/13339806/createShelfButton"
format: markdown
---
# Description

Creates a button on the named tab. If the called tab doesn't exist, it creates a new tab.

Shelf buttons are interface objects that contain script commands. The scripts contained in them may be invoked by pressing the button. Shogun Post saves the current button shelf configuration in a script called *ScriptShelves.hsl*.

## Functional area

Interface

# Command syntax

## Syntax

|  |
| --- |
| `createShelfButton "TabName"[-group string] [-label string] [-script string] [-tip string] [-icon string] [-iconIndex integer] [-language string] [-update]` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `TabName` | string |  | String name of tab to place button on |

### Flags

> Macro (scroll-tablelayout)

| **Name** | **Flag arguments** | **Argument type** | **Exclusive to** | **Comments** |
| --- | --- | --- | --- | --- |
| `group` | 1 | string | — |  |
| `label` | 1 | string | — | Gives the button this label. Should be 8 characters or less |
| `script` | 1 | string | — | String arguments in your script text should be preceded by the escape character \ as in \"string argument\" |
| `tip` | 1 | string | — | Sets the tip text that will appear when the mouse hovers over the button |
| `icon` | 1 | string | — | Specifies the path to the icon file |
| `iconIndex` | 1 | integer | — | Deprecated. (Icons cannot be picked by index.) |
| `language` | 1 | string | — | Sets whether the script used by the button is Python or HSL. |
| `update` | 0 | — | — | Deprecated. (Shelf now always redrawn). |

## Return value

void

## Examples

```plaintext
createShelfButton -label "getBones" -script "string $bones[]; 
$bones  = `getModules -type \"BoneNode\"`; 
int $num = `getCount $bones`; 
print $num;"-tip "This command will return the number of BoneNodes in the scene";
 
// This script creates a button called "getBones" and adds it to the
// last button group. When invoked, it returns the number of BoneNodes
// in the scene. Note that the string after -script is contained within quotes. 
// The \" means that there is a special character. In this case it is a 
// quotation mark ""`. 
```

# Additional information

## Related commands

- [createShelfGroup](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13366205)
- [createShelfTab](https://vicon-help.atlassian.net/wiki/spaces/Shogun16/pages/13339809)