| 1234567891011121314151617181920212223242526 |
- /*---
- title: Share a file and notify
- group: Data
- summary: Create a share link, schedule a task and send a desktop notification.
- ---*/
- requirelib("share");
- requirelib("scheduler");
- requirelib("notification");
- var file = "user:/Documents/scores.csv";
- var uuid = share.fileIsShared(file) ? share.getFileShareUUID(file) : share.shareFile(file, 0);
- console.log("Share id: " + uuid);
- // A task the user approves; it runs the script every hour.
- var task = "playground-report";
- if (!scheduler.registered(task, "Playground")) {
- scheduler.register(task, "Playground", 3600, "Rebuild the score report", "main.agi");
- }
- notification.send("Report shared", "scores.csv is now shared as " + uuid, notification.PRIORITY_MEDIUM);
- sendJSONResp({
- share: uuid,
- link: "/share/" + uuid,
- taskRegistered: scheduler.registered(task, "Playground")
- });
|