Action

Wikipedia

Posted by @danny_ledesma, Last update over 6 years ago

Prompts to search EN Wikipedia or ES Wikipedia

Steps

  • script

    // See online documentation for examples
    // http://getdrafts.com/scripting
    //Search Wikipedia
    /* Action created by Danny Ledesma, based on actions and scripts created/developed by Jimmy Reekes & Tim Nahumck  */
    
    var actions = ["EN Wikipedia","ES Wikipedia"];
    
    var p = Prompt.create();
    p.title = "Select Wikipedia Site";
    for (i = 0; i < actions.length; i++) {
      p.addButton(actions[i]);
    }
    var con = p.show();
      //Actions based on button presses
      if (con) {
      var input = p.fieldValues["search"];
      
    var content = draft.processTemplate("[[selection]]")
    var output = encodeURIComponent(content)
      if (p.buttonPressed == "EN Wikipedia") {
        var ENWiki = "https://en.wikipedia.org/wiki/Special:Search?search="+output;
     
      var result = app.openURL(ENWiki);
      }
        if (p.buttonPressed == "ES Wikipedia") {
        var ESWiki = "https://es.wikipedia.org/wiki/Special:Search?search="+output;
        var result = app.openURL(ESWiki);
        }
     
        }
    else {
      context.cancel();
    }

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.