# GetObjectText

Returns the text content of a chart object.

## Syntax

```typescript
GetObjectText(name: string, isStatic: boolean = false): string
```

## Parameters

| Parameter | Type    | Description                                                  |
| --------- | ------- | ------------------------------------------------------------ |
| name      | string  | The name of the object                                       |
| isStatic  | boolean | Optional. Whether to look in static objects (default: false) |

## Return Value

Returns a `string` containing the object's text content.

## Description

The `GetObjectText` method retrieves the text content of a specified chart object. This is primarily used with text-based objects like labels, but can also be used with other objects that have text properties.

## Example

```typescript
// Get text from a text label
const labelText = this.api.GetObjectText('MyLabel')
console.log(`Label text: ${labelText}`)

// Get text from a static label
const staticText = this.api.GetObjectText('MyStaticLabel', true)
console.log(`Static label text: ${staticText}`)

// List all text objects with their content
const count = this.api.GetObjectCount()
for (let i = 0; i < count; i++) {
    const name = this.api.GetObjectName(i)
    if (this.api.GetObjectType(name) === TObjectType.TEXT) {
        const text = this.api.GetObjectText(name)
        console.log(`Text object ${name}: "${text}"`)
    }
}

// Error handling example
try {
    const text = this.api.GetObjectText('NonExistentObject')
} catch (error) {
    console.log('Error getting object text:', error.message)
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fto-2.gitbook.io/fto-indicators-docs/access_to_objects/get-object-text.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
