GetObjectName
Syntax
GetObjectName(index: number, isStatic?: boolean, window?: number): stringParameters
Return Value
Description
Example
Last updated
GetObjectName(index: number, isStatic?: boolean, window?: number): stringLast updated
// Get name of first object
const firstName = this.api.GetObjectName(0);
console.log(`First object name: ${firstName}`);
// Get name of first static object
const firstStaticName = this.api.GetObjectName(0, true);
console.log(`First static object name: ${firstStaticName}`);
// List all objects
const count = this.api.GetObjectCount();
for (let i = 0; i < count; i++) {
const name = this.api.GetObjectName(i);
const type = this.api.GetObjectType(name);
console.log(`Object ${i}: Name=${name}, Type=${type}`);
}
// List all static objects
const staticCount = this.api.GetObjectCount(true);
for (let i = 0; i < staticCount; i++) {
const name = this.api.GetObjectName(i, true);
const type = this.api.GetObjectType(name, true);
console.log(`Static object ${i}: Name=${name}, Type=${type}`);
}
// List objects from MainChart (window = 0)
const mainChartCount = this.api.GetObjectCount(false, 0);
for (let i = 0; i < mainChartCount; i++) {
const name = this.api.GetObjectName(i, false, 0);
console.log(`MainChart object ${i}: ${name}`);
}