'How do I create textbox dynamically in jxa?
New at javascript, trying to create a dynamic textbox in pages but it keeps getting an error.
var app = Application('Pages');
var doc = app.document;
var pages = doc.pages;
var newTextbox = pages[0].make({
new:'textItem', at: pages[0], withProperties: {position:{"x":0, "y":0}, objectText:"sample text", height:20, width:20}
});
error log Error -1700: Can't convert types.
here's is the equivalent in AppleScript
set thisStory to "sample test"
tell application "Pages"
activate
tell the front document
tell current page
set thisTextItem to ¬
make new text item with properties ¬
{height:240, width:240, position:{0, 0}}
set object text of thisTextItem to thisStory
end tell
end tell
end tell
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
