Action

Drafts Scripting Reference v2

Posted by Mudman, Last update over 5 years ago - Unlisted

This script is based on @jtokash’s Drafts 5 Scripting Documentation Action
It augments the list of topics in the original script with those which are available in the Drafts Scripting Reference Page
It also uses a picker to select the desired topic, as the number of buttons would have become too many
Mudman 2018

Steps

  • script

    // This script is based on @jtokash's Drafts 5 Scripting Documentation Action
    // It augments the list of topics in the original script with those which are available in the Drafts Scripting Reference Page
    // It also uses a picker to select the desired topic, as the number of buttons would have become too many
    // Mudman 2018
    
    
    const urls = {
    			"Home":"https://github.com/agiletortoise/drafts-documentation/wiki",
                "Action":"https://github.com/agiletortoise/drafts-documentation/wiki/Action",
                "ActionGroup":"http://reference.getdrafts.com/objects/ActionGroup.html",
                "Alarm":"https://github.com/agiletortoise/drafts-documentation/wiki/Alarm",
                "App":"https://github.com/agiletortoise/drafts-documentation/wiki/App",
                "Box":"http://reference.getdrafts.com/objects/Box.html",
                "Calendar":"https://github.com/agiletortoise/drafts-documentation/wiki/Calendar",
                "CallbackURL":"https://github.com/agiletortoise/drafts-documentation/wiki/CallbackURL",
                "Console":"https://github.com/agiletortoise/drafts-documentation/wiki/Console",
                "Context":"https://github.com/agiletortoise/drafts-documentation/wiki/Context",
                "Credential":"https://github.com/agiletortoise/drafts-documentation/wiki/Credential",
                "Device":"https://github.com/agiletortoise/drafts-documentation/wiki/Device",
                "Draft":"https://github.com/agiletortoise/drafts-documentation/wiki/Draft",
                "Dropbox":"https://github.com/agiletortoise/drafts-documentation/wiki/Dropbox",
                "Editor":"https://github.com/agiletortoise/drafts-documentation/wiki/Editor",
                "Event":"https://github.com/agiletortoise/drafts-documentation/wiki/Event",
                "FileManager":"https://github.com/agiletortoise/drafts-documentation/wiki/FileManager",
                "Global":"https://github.com/agiletortoise/drafts-documentation/wiki/Global",
                "GoogleDrive":"http://reference.getdrafts.com/objects/GoogleDrive.html",
                "HTTP":"https://github.com/agiletortoise/drafts-documentation/wiki/HTTP",
                "HTTPResponse":"http://reference.getdrafts.com/objects/HTTPResponse.html",
                "Mail":"https://github.com/agiletortoise/drafts-documentation/wiki/Mail",
                "Message":"https://github.com/agiletortoise/drafts-documentation/wiki/Message",
                "MultiMarkdown":"https://github.com/agiletortoise/drafts-documentation/wiki/MultiMarkdown",
                "OneDrive":"http://reference.getdrafts.com/objects/OneDrive.html",
                "Prompt":"https://github.com/agiletortoise/drafts-documentation/wiki/Prompt",
                "Reminder":"https://github.com/agiletortoise/drafts-documentation/wiki/Reminder",
                "ReminderList":"https://github.com/agiletortoise/drafts-documentation/wiki/ReminderList",
                "Things":"https://github.com/agiletortoise/drafts-documentation/wiki/Things",
                "Todoist":"http://reference.getdrafts.com/objects/Todoist.html",
                "Twitter":"http://reference.getdrafts.com/objects/Twitter.html",
                "Working with Dates":"https://github.com/agiletortoise/drafts-documentation/wiki/Working-with-Dates",
                "Workspace":"http://reference.getdrafts.com/objects/Workspace.html"
    };
    
    var p = Prompt.create();
    p.title = "Drafts 5";
    p.message = "Scripting Documentation Index";
    let keys = Object.keys(urls);
    p.addPicker("myKey","Topic",[keys],[0])
    p.addButton("Open Reference Page");
    var didSelect = p.show();
    app.openURL(Object.values(urls)[p.fieldValues.myKey]);

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.