Action

Drafts 5 Scripting API Documentation

Posted by C Denton, Last update over 5 years ago

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

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
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.