Question about add Fantastical Events action


#1

Hi,

Im using the Fantastical add multiple events action. I notice that when I run this action, I need to manually accept each calendar entry in fantastical. This isn’t a big deal if I’m adding 2 or 3 calendar entries, but sometimes I’m adding 12 or more. Is there anyway to change the setting so that all entries are added without my intervention?


#2

Fantastical also accepts an add parameter on it’s URL actions that tells it to go ahead and accept the input and not wait for user confirmation. You can alter the URL in the default Fantastical action to add this parameter like:

fantastical2://x-callback-url/parse/?sentence=[[draft]]&add=1

#3

Thanks Greg,

I tried this…

// split draft into lines
const lines = draft.content.split("\n");
const baseURL = “fantastical2://x-callback-url/parse/?sentence=[[draft]]&add=1”;

… but i got an error. What am I missing? I’m not a coder so sorry if this is a basic question.


#4

It looks like you are setting up ‘lines’ but then using the whole draft (’[[draft]]’) in what you pass to Fantastical. I assume from the above that you are wanting to pass each line to Fantastical one at a time.

Maybe review an action like (this)[https://actions.getdrafts.com/a/1JL] for a way of doing something against various lines in a draft. There are a few ways you could do this, just find one that you can make sense of.

I’d also suggest looking at (tags)[http://getdrafts.com/actions/templates.html] page and the tag functions in the Drafts documentation for switching out the Drafts tag in the Fantastical URL.

Also when you get an error, it is useful to post the details of the error (text and/or screenshot) to help others in debugging what is going on.


#5

I missed that you were using the scripted multi-event action, sorry about that…to use the “add” parameter in that action, you will need to edit this portion of the script to add the parameter:

// create and configure callback object
var cb = CallbackURL.create();
cb.baseURL = baseURL;
cb.addParameter("sentence", line);
cb.addParameter("add", "1"); // <<<< ADD THIS LINE

#6

Thanks Greg. Worked great. Just posted to action directory.