ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > FARR Plugins and Aliases

FARR plugin: Akete

<< < (2/14) > >>

ewemoa:
i can add this easily in the new version to be released this week.
-mouser (December 15, 2008, 11:12 PM)
--- End quote ---

That'd be great!

Upon further reflection on the matter though, I think it is the case that enumeration may not be necessary.  If the plugin can access the current set of keywords (which I believe it can via Search.keywords), it can attempt to access User Variables of specific names based on the set.

I intend to try this idea out.

ewemoa:
Below is an initial implementation -- all that is needed to try it is to replace the content of the existing fscript.js.  Ah, and depending on one's environment, perhaps it is necessary to fill in aliasstr (still don't know what the issue is with that).

I was surprised to see that retrieving keywords via Search.keywords seems to give lowercased keywords.  Consequently, it looks like it's currently easier to use "openwith<string>" (all in lowercase) inside User Variables -- in fact, the current Akete code assumes this.


--- Code: Javascript ---/*global FARR, dan */var displayname = "Akete",    versionstring = "1.0.0.4",    releasedatestring = "Dec 16th, 2008",    author = "ewemoa",    updateurl = "",    homepageurl = "",    shortdescription = "Akete",    longdescription = "FARR-specific file associations",    advconfigstring = "",    readmestring = "FScript",    iconfilename = "Akete.ico",    //    aliasstr = "",    regexstr = "",    regexfilterstr = "",    keywordstr = "",    scorestr = "";// SEE THE BOTTOM OF THE FILE FOR MAKING GLOBAL ENTRY POINTS//// dan - (d)estructuring (a)ssignment (n)eeded :)// XXX: why the parens surrounding the function () { ... } below?//           seems to help notepad++'s Function List plugin// XXX: dan is not preceded by 'var' because then delete will fail...dan = (function () {      // emitResult() / onProcessTrigger() types  var UNKNOWN = 0, FILE = 1, FOLDER = 2, ALIAS = 3, URL = 4,       PLUGIN = 5, CLIP = 6, ALIASFILE = 7,      // postprocessing for emitResult()      IMMEDIATE_DISPLAY = 0, ADD_SCORE = 1, MATCH_AGAINST_SEARCH = 2,      // search state      STOPPED = 0, SEARCHING = 1,      // trigger results      HANDLED = 1, CLOSE = 2;  function onProcessTrigger(path, title, groupname, pluginid, thispluginid,                             score, entrytype, args) {    var i, ma, apppath, launchstr, kwds, owre, uvname;    switch (entrytype) {      case FILE:        kwds = FARR.getStrValue("Search.keywords").split(" ");        owre = /(openwith[^=]+)/;        for (i = 0; i < kwds.length; i += 1) {          ma = owre.exec(kwds[i]);          if (ma !== null) {            uvname = ma[1];            break; // XXX: end on first match          }        }        if (uvname === undefined) {          // XXX: dot inside square brackets escaping?          ma = /\.([^\.]+)$/i.exec(path);           // XXX: in general, better to handle an alias string w/           //      $$1-style interpolation, but not doing that yet          if (ma === null) {            return;          }          uvname = ma[1];        }        try {          apppath = FARR.getStrValue("uservar.Akete." + uvname);        } catch (e) {          // XXX: log or feedback?          return;        }        // XXX: check whether path makes sense?        if (apppath !== "") {          launchstr = apppath + " " + "\"" + path + "\"";          FARR.setStrValue("launch", launchstr);          return HANDLED | CLOSE;        }        return;        //break;      default:        return;    }    return;  }  return [onProcessTrigger];} ());// defined entry pointsvar onProcessTrigger = dan[0]; // jslint complains, but mdc documentation on delete suggests this should workdelete dan; // Local Variables:// c-basic-offset: 2// End:

phitsc:
Works perfectly! Even with an empty aliasstr now which is really strange.

Concerning parsing FARR's ini file: I agree that it's probably not a good idea. I am nevertheless doing it currently in my never released Windows Search plugin to query the max. entries to display values. It would really be good to have an officially supported way to query some FARR settings (sorry, just wanted to use this chance to repeat that yet again ;))

ewemoa:
Glad to hear it's working for you!

I have my fingers crossed for the enumeration feature :)

ewemoa:
With the latest FARR beta (2.42.03), it is possible to have custom context menu items per result.

I have modified Akete to make use of this functionality.

If anyone is interested, I can upload my latest -- if there is no hurry, there may be a few more things I might attend to before releasing another version.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version