Updating "Events in Fantastical" action for macOS (as with the single-item, "Event in Fantastical")

Greg (the mighty @agiletortoise himself) has updated the “Event in Fantastical” action so that it runs differently on macOS and iOS, as required. But it’s not yet been updated for the multiple-line version “Events in Fantastical”. I can’t figure out how to get it to work for macOS. I took the most recent version of “Events in Fantastical” (which works on iOS), duplicated the single step, setting one to “Step enabled in macOS” and one to “Step enabled in iOS”. Then I tried to modify the step for macOS (see below), but it fails to run.

Any help would be much appreciated!

Joel

// split draft into lines
const lines = draft.content.split("\n");
const baseURL = "x-fantastical2://parse?";

// loop over lines and send each to Fantastical
for(var line of lines) {
	if (line.length == 0) { continue; }
	// create and configure callback object
	var cb = CallbackURL.create();
	cb.baseURL = baseURL;
	cb.addParameter("sentence", line);
	// open and wait for result
	var success = cb.open();
	if (!success) {
		if (cb.status == "cancel") {
		   context.cancel();
		   break;
		}
		else {
			context.fail();
			break;
		}
	}
}

I do not believe the Mac version of Fantastical supports any sort of callback URLs, so it would not be possible to handle more than one event this way.

Ah, well that explains it! Thanks.