I try to get all my iMessage contacts from the app "Messages" via JXA scripting. When I assign the array to a variable I can only work with the first 40 objects. But the array has a length of 147.
var Messages = Application("Messages")
var buddies = Messages.buddies()
console.log(buddies.length) // == 147
When I go to "replies" tab at the bottom of the script editor, I can see all 147 buddies:
app.buddies()
--> [app.buddies.byId(...), ...]
But when I try to work with an object from the array with index greater than 39, I get an error -1728 (Object not found) e.g.
console.log(buddies[45].id())
Whats wrong? And what is the proper way to get the ids of all buddies?