Action
Example - Captain's Log (for Siri)
Steps
-
script
//Load the last modified draft let allDrafts = Draft.query("", "all", []); allDrafts = allDrafts.sort(function(draftA, draftB) { return draftB.modifiedAt - draftA.modifiedAt }); editor.load(allDrafts[0]); //Get the current log content let fmCloud = FileManager.createCloud(); let strLogPath = "/Logs/Log-" + draft.processTemplate("[[date|%Y-%m]]") + ".txt"; let strLogContent = fmCloud.read(strLogPath); //Append the new log content to the existing content strLogContent += draft.processTemplate("[[date]]"); strLogContent += " "; strLogContent += draft.processTemplate("[[time|%R]]"); strLogContent += " "; strLogContent += draft.processTemplate("[[tags]]"); strLogContent += " : "; strLogContent += allDrafts[0].content; strLogContent += "\n"; //Write the revised content back to the log file fmCloud.write(strLogPath, strLogContent);
Options
-
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.