applescriptjavascript-automation

How to convert "count of displays" from AppleScript to JXA?


I am learning JXA and I am a bit confused about even basic syntax.

I want to convert this very basic code from AppleScript to JXA. What to do?

tell application "Image Events"
    set countOfDisplays to count of displays
end tell

I can do this but I have no idea where is "displays" or "count" there...

var ie = Application("Image Events")
var d = ie.displays // no
var d = ie.display // no
var d = ie.displays() // no
var d = ie.display() // no

Solution

  • Solution:

    var ie = Application("Image Events")
    var d = ie.displays.length