I would like to use JavaScript for automation (mac JXA) to make a NSWindow and show it to the user.
I tried following this example, but it crashes when I run it in the Script Editor app.
Then I tried to make my own using barebones. As a start I just want a window with a title in it.
ObjC.import("Cocoa")
var window = $.NSWindow.alloc.init
window.setContentSize($.NSMakeSize(500, 500))
window.title = "hello world"
window.makeKeyAndOrderFront(window)
When I try to run this in Script Editor the app crashes right away. It appears to be crashing when I try to initialize the NSWindow Object.
Am I doing something wrong?