Working Copy round trip : put
This script will allow you to send a file to Working Copy that you have previously fetched via this Drafts action:
Because of the universal url in the first line of your file, you won’t be prompted to manually select the file and location.
// Working Copy commit // Commits file grabbed from earlier action. Uses the URL in the title line to determine which file to commit to const credential = Credential.create("Working Copy Key", "The URL key for Working Copy"); credential.addTextField("key", "URL key"); credential.authorize(); const key = credential.getValue("key"); const baseURL = "working-copy://x-callback-url/write/?"; var cb = CallbackURL.create(); cb.baseURL = baseURL; cb.addParameter("key", key); cb.addParameter("url", draft.processTemplate("[[title]]")); cb.addParameter("text", draft.processTemplate("[[body]]")); cb.addParameter("askcommit", "1"); let success = cb.open();
After Success Default Notification Error Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.