Clipboard Retrieval

#1

Hello, is there a way to access iOS clipboard from JavaScript to have inserted into a draft.setTemplateTag entry? If so, how would I do so? I tried using [[clipboard]] and “[[clipboard]]” and it doesn’t work. Thank you.

#2

I may be wrong, but I think you may have things a little muddled up around template tags and draft tags.

Assuming that is the case, I’ll try and clarify with a few examples,

If you use the Insert Text action for example, with [[clipboard]] (a template tag), this will insert the clipboard at the current cursor position.

If you use draft.setTemplateTag("colour", "red"); in a JavaScript step, this will create a custom template tag called ‘colour’. If you subsequently use an Insert Text step (for example) in your action, and use [[colour]] within it, it will output ‘red’.

If you use draft.addTag(app.getClipboard()); within a JavaScript acton, and you have an appropriate string of text in the iOS clipboard, then you will create a new tag on the draft named with the content of your clipboard.

Note, when changing the draft object in JavaScript, you should follow any changes with draft.update(); to apply the changes.

Hope that helps, but if it doesn’t please clarify exactly what you are attempting to do.