I try to Open a CSV file (and then Export that one) using JavaScript for Automation (JXA).
Using OmniPlan v2.
When I manually open (import) a CSV file a popup appears to map the columns.
The mapping that is shown is fine, so all I have to do is press OK (or press Enter).
How do I achieve this using JavaScript for Automation?
When I try this the app.open()
call is stuck until I manually press ok for the popup.
What I tried:
var systemEvents = Application('System Events')
var app = Application("OmniPlan")
app.open(Path("~/Documents/omniplan_import.csv"))
// popup appears: "Map Columns" ← how to select "OK"?
console.log("import completed") // only reaches this one after manually closing the popup
systemEvents.keyCode(36); // therefore sending Enter keycode has no effect