Action

Events in Fantastical

Posted by agiletortoise, Last update almost 3 years ago

Send each line of the current draft to Fantastical to be parsed as an event. Return to Drafts when complete.

Note: This action only works on iOS, due to differences in the URL scheme support between the iOS and Mac version of Fantastical.

Steps

  • script (iOS only)

    // split draft into lines
    const lines = draft.content.split("\n");
    const baseURL = "fantastical2://x-callback-url/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;
    		}
    	}
    }
  • prompt (macOS only)

    promptKey
    prompt
    promptTitle
    Prompt
    promptMessage
    This action is available only on iOS, due to differences between the iOS and Mac version of Fantastical.
    promptButtons
    OK
    includeTextField
    false
    textFieldDefault
    includeCancelButton
    false

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.