How do I modify the position property of textItems in Keynote using JavaScript for applications?

57 Views Asked by At
var Keynote = new Application("Keynote")
var itemPosition = Keynote.documents[0].slides[1].textItems[2].position

get the itemPosition coordinates Keynote.documents[0].slides[1].textItems[2].position()

Keynote.documents[0].slides[1].textItems[2].position()

the result is below

app = Application("Keynote")
app.documents.at(0).slides.at(1).textItems.at(1).position = {"x":0, "y":0}

create the variable with new properties position

var newPositionItem = [150, 400]

apply the value to the element with asignment

Keynote.documents[0].slides[1].textItems[1].position = newPositionItem

Result: nothing changes...

1

There are 1 best solutions below

1
On

try using .setLeft() for Horizontal position, and .setTop() for vertical position on the text item.

var textItem = slide.textItems()[0];

// Sets the horizontal position 100 pixels from the left edge of the slide
textItem.setLeft(100);

// Set the vertical position 200 pixels from the top edge of the slide
textItem.setTop(200);