Writing a script to add a note to Bear app

@martinperry

CallbackURL will return to Draft regardless of this parameter,
but you could add: app.openURL('bear://'); afterwards when you need to open bear.

Or like this:

  ...
  cb.addParameter("text", draft.content);
  // app.setClipboard(cb.url); For testin/debuging url.
  
  let success = false;
  if (edit) {
    // will stay in Bear:
    success = app.openURL(cb.url); 
    // alternatively, but will flash screen:
    // success = cb.open(); // returns to Draft
    // app.openURL('bear://'); // return to Bear
  } else {
    // will return to Drafts:
    success = cb.open();
  }

  if (success) {
    ... 

Yes, you are right: ‘true/false’ is not accepted by Bear, it should be ‘yes/no’:

See the updated action: https://actions.getdrafts.com/a/16G with the new switches.

Also, at ‘create new’ and your draft already have a # heading, title is not neccesary in the prompt.

PS. Thanks, I had fun – learning as I go.
Have a good evening/night/morning
:mask:

1 Like