Hi there!
I'm trying insert a new image in a Pages document with Javascript JXA.
In AppleScript work properly:
tell application id "com.apple.iWork.Pages"
activate
if not (exists document 1) then error number -128
tel document 1
tell page 1
set targetImageFilePath to "/Users/gasparekferenc/Documents/GitHub/OSX-Automation/AKG-189060_samples.jpg"
set targetImageFile to targetImageFilePath as POSIX file
set thisImage to make new image with properties {file:targetImageFile, width:100, height:100, position:{100, 100}}
end tell
end tell
end tell
But, I could't found the right systax in JXA.
app = Application('Pages');
doc = app.documents[0]
fn = "/Users/gasparekferenc/Documents/GitHub/OSX-Automation/AKG-189060_samples.jpg"
f = Path(fn).toString();
img = doc.Image.make({file:f,width:100,height:100,position:{x:100,y: 100}});
What"s the wrong?
Could enyone help me?