GetObjectText
Syntax
GetObjectText(name: string, isStatic: boolean = false): stringParameters
Return Value
Description
Example
// 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);
}Last updated