Action

Wikipedia DE

Posted by @appils, Last update 4 months ago

Prompts to search DE Wikipedia or EN 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 = ["DE Wikipedia","EN 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 == "DE Wikipedia") {
        var ENWiki = "https://de.wikipedia.org/wiki/Special:Search?search="+output;
     
      var result = app.openURL(ENWiki);
      }
        if (p.buttonPressed == "EN Wikipedia") {
        var ESWiki = "https://en.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.