Drafts Action Directory

Drafts 5 Scripting API Documentation

Posted by C Denton, Last update 3 months ago

Displays a menu for selecting Documentation page and opens an in app web browser to display selected page.

Install

Steps

  • script

    // See online documentation for examples
    // https://reference.getdrafts.com/
    
    var base = "https://reference.getdrafts.com/objects/";
    
    var opts = ["Action", "ActionGroup", "Alarm", "App", "Box", "Calendar", "CallbackURL", "Console", "Context", "Credential", "Device", "Draft", "Dropbox", "Editor", "Event", "FileManager", "Global", "GoogleDrive", "HTTP", "HTTPResponse", "Mail", "Message", "MultiMarkdown", "OneDrive", "Prompt", "Reminder", "ReminderList", "Things", "Todoist", "Twitter", "Wordpress", "Workspace", "XMLRPC", "XMLRPCResponse"];
    
    var p = Prompt.create();
    
    p.title = "Drafts 5";
    p.message = "Scripting documentation index";
    
    var i = 0;
    while (i < opts.length){
    	p.addButton(opts[i]);
    	i++;
    };
    
    var didSelect = p.show();
    
    var url = base + p.buttonPressed + ".html";
    
    if (didSelect) {
        app.setClipboard(url);
    } else {
        context.cancel();
    };
  • url

    template
    [[clipboard]]
    useSafari
    true
    encodeTags
    false

Options

  • After Success Nothing
    Notification Error
    Log Level Error

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.