I have a two step script. Step 1 runs a shortcutthat puts its output on clipboard.
Step two is the script.
var $content, cursorStart, cursorLength, cb;
$content = draft.content;
cursorStart = draft.selectionStart;
cursorLength = draft.selectionLength;
cb = app.getClipboard();
draft.content = $content.substr(0, cursorStart) + cb + $content.substr(cursorStart + cursorLength, $content.length)
draft.update();
The script pastes the contents of the clipboard before running the shortcut.
When the script is finished I can paste the correct contents. It’s as though step 2 starts before the Shortcut has finished.
If I run this multiple times in succession it pastes in the previous Shortcut result every time.
What could I be doing wrong?