Save to iCloud

Posted by drdrang, Last update 5 months ago - Unlisted

Find iCloud fileline in draft and run the shortcut that writes the contents of the draft to the given file.


  • script (iOS only)

    // Get the folder and filename from the dbox line.
    var d = draft.content;
    // Regex for fileline.
    var fileRE = /icloud:\s*(.+)\s*$/m;
    if (fileRE.test(d)) {
    	// Get the path. Add a slash to the front if I forgot.
    	var path = d.match(fileRE)[1];
    	if (path[0] != '/') {
    		path = '/' + path;
    	// Create a JSON template to pass to Scriptable via Shortcuts
      	var fileinfo = {"path":path, "text":d};
    	// Create a template tag from the dictionary.
    	draft.setTemplateTag("fileinfo", JSON.stringify(fileinfo))
    } else {
    	alert("No icloud: line");"No icloud: line");
  • runShortcut (iOS only)

    Save to iCloud


  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.