DonationCoder.com Forum

DonationCoder.com Software => Find And Run Robot => Mouser's Zone => FARR Plugins and Aliases => Topic started by: ecaradec on November 11, 2008, 10:18 AM

Title: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 11, 2008, 10:18 AM
FSubScript enable to load multiple javascript plugins in FARR without adding the FScript.dll for each. It should make it easier to write script plugins, share code between them and build a great FARR :)

The latest versions of FSubScript are maintained and improved by CZB. You can get it from the CZB with many plugins.
https://www.donationcoder.com/forum/index.php?topic=17153.0
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: mouser on November 11, 2008, 10:25 AM
wha?!?!?!?!?!!?!?!?!?!?! ALREADY!!?!?!?!  :o

(https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF) (https://www.donationcoder.com/forum/esmileys/gen3/1Small/HORSE2.GIF)
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: ewemoa on November 11, 2008, 10:53 AM
Why do I need to go to sleep now!

FWIW, loads and works here  :Thmbsup:

Oh, I completely forgot ... thank you so much!
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: Ampa on November 11, 2008, 10:58 AM
Wow - wow - wow!

This was unexpected - I thought that you might take a look over the weekend, and report back to us that the task was monsterously difficult, but that you might give it a go in the new year.

But no! Instead you whip up a complete solution and drop it on us like a 100 ton bomb of javascripting goodness :)

Congratulations on a supreme effort!
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: mouser on November 11, 2008, 11:04 AM
I think it needs a better name than "Scripter"..

Maybe EMSF (ecaradec's mutiscripter for farr)?
or FMS (farr multi-scripter)?
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: mouser on November 11, 2008, 11:11 AM
Couldn't get it to quite work here ...
i put Scripter and Colors both in a new parent directory.
Scripter was loaded by FARR, and it seems to have found the Colors script -- since if i typed scipter it listed "Colors"

but typing: colors

had no effect (just showed files with the word colors in them).
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: ecaradec on November 11, 2008, 12:51 PM
Sub-plugins are exposed as modifiers. You have to type : "scripter +colors". It also complete with tab.
I agree that scripter is a very bad name. I didn't change it because I hardcode it in many places.

I'll let everybody propose names for the plugins. FMS is nice by the way.
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: czb on November 11, 2008, 01:23 PM
Hi,
first of all, thank you for your share :Thmbsup: .I have also been thinking of providing similar solution, but I was waiting if you are going to solve it on dll basis, since such a solution is javascript limited.

I am not familiar with how the plugin system works, but I guess dll basis might involve direct modifications of FARR as well, which might be long run development.

Another semi-solution which comes into my mind as non C++ programmer might be to create a dll file which would just point to a real fscript.dll. So the pointer would take fscript.dll as some kind of library. Then under any modification of fscript.dll, the pointer would remain unchanged.
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: ecaradec on November 11, 2008, 02:00 PM
This is a FScript based plugin. Sub-plugins are in fact plugins for the scripter plugin, not directly FARR plugins. There isn't any support for regex based search, and I'm not sure that I could add it.

The nice thing is that it will allow to develop a librairies around the scripter plugin to help developpement of future sub-plugins.
The not the good is that all scripts are loaded in the same script engine (this is what will allow the first point ) and that means that plugins can interfer each others. It is relatively pointless to create plugins that would break the system so I hope that future plugins writers will take care of not breaking their environment. Currently plugins could remove others plugins, break them but also add them dynamically.
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: czb on November 11, 2008, 02:22 PM
Yes you are right that it brings quite significant advantages and can faster development of JS plugins.

For example I guess FARR update system will not work for it, but I can imagine script plugin to be used for new JS plugin installations, maintanace etc.

Well if you do not mind I can make my new goal to make kind of sofisticated JS plugin portal, or we can make it a colaborative work together with other JS coders (ewemoa etc) :)
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: mouser on November 12, 2008, 07:17 AM
This is a FScript based plugin. Sub-plugins are in fact plugins for the scripter plugin, not directly FARR plugins. There isn't any support for regex based search, and I'm not sure that I could add it.

Having looked at the code.. it really doesn't seem that hard to add all of these things:
1) regex support for each plugin
2) custom icons for each plugin
3) ability to disable and enable individual scripts

Because in essence you've showed how to make a set of functions as an array element that can be iterated through.
For example instead of using plugins["colors"]={..code..}
It could be done like plugins["colors"]["regex"]= "color .*" and then plugins["colors"]["icon"]="coloricon.ico" and plugins["colors"]["code"]={ .. code..}

Am i wrong?

And as for update support -- that's not a problem at all -- the updater doesnt care if it finds 20 different .dcupdate files in a plugin directory, so each little script can have its own update file.

Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: mouser on November 12, 2008, 07:21 AM
One downside.. this only works for javascript not the other fscript supported languages.
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: mouser on November 14, 2008, 02:02 AM
ecaradec has gotten us started with this and shown us the way to multiscripts.. now we need a javascript coder to pick up the ball and run with this.. to extend the concept to allow:
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: ewemoa on November 14, 2008, 07:32 PM
I'm willing to start taking a look.  To be frank though, I'm not clear currently on how all of the points you mention might be carried out.  Perhaps some of the details can be discussed here?

Below is an attempt at following up on some of the points mentioned so far.

Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: mouser on November 14, 2008, 07:41 PM
I didn't understand what you meant by "custom trigger handling" -- does this refer to onProcessTrigger(), onReceiveKey(), and the like?

Yep.  Basically the parent script has to iterate through each of the multiscripts and see if any want to handle each call.


I'm in the dark about regex pattern matching for each script.  Storing and referencing a regular expression string per-script seems straightforward, but how the resulting regex is used by Scripter to work with FARR is not clear to me.  If someone already has a clear idea of what to do, I'd be happy to hear it

Again basically the parent script needs to take each RAW search, and iterate through each of the multiscripts and see if any of them should handle it based on their own regex match.


As far as UI is concerned, a simple starting point might be a dialog box appearing via Scripter's "Configure Advanced Plugin Options" button.  However, does it seem doable to achieve per-script configuration via the Plugin Manager dialog box (at least eventually)?

I think we are on the same page.. basically when user says to do advanced config of the parent manager script, it should show a page of options.  this page might look like a checklist box of each multiscript plugin found, where individual scripts could be enabled or disabled.

If individual plugins wanted to have their own options.. there would be a few choices.. you could have a button next to each multiscript to show *ITS* options, or maybe a simpler method would involve each mutliscript providing some html text with some form inputs that would be for that scripts options, and the multiscripter would present all form htmls on one page.  And then let the multiscript save all the variables using the new UserVars option in FARR.

This is the most confusing and advanced part of multiscripts and i think for now these options ideas can just be ignored for version 1.


Do you think script management would be a matter of tracking an enabled/disabled value per script?  Is there an issue with asynchronous processing?  How might enabling/disabling a script be affected by this?

I really don't see any issue here -- all you are doing is telling the mutliscript supervisor to ignore certain scripts and not even bother to call them with a chance to match search or trigger result.. shouldnt be a big deal.
Title: Re: New FARR plugin : Scripter enable loading of multiple javascript plugins
Post by: mouser on November 14, 2008, 07:42 PM
One thing we should keep in mind -- i know ecaradec is doing a bit more work on this as we speak -- so it might make sense to hold off messing with the code until ecaradec is ready to pass the torch to someone else -- just to avoid duplication of effort.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 15, 2008, 06:31 PM
I'm broke :)

I improved the now renamed FSubScript. There was some bugs in icons, results triggering, that should be now fixed. I also added a system to handle settings using ahk plugins. I made some improvement to make the scripts look like more like normal plugins. There might be bugs. There are centainly bugs.
However FSubScript begin to be usable. I'll let the dc community write all those wonderful plugins for farr that I hope FSubScript will help.

Tips :
- The new alias is fssc : for FarrSubSCript. Type fssc +colors to try the useless sample plugin.
- Don't define an alias for the plugins. It doesn't work currently. I need to use the groupname to identify subplugins and groupname is overwritten when an alias is defined.

See the links in the first post for downloading the last version.   :-*
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 15, 2008, 09:46 PM
Thanks for your continued efforts!

I had some fun pasting RGB triples  ;)

Hope to have something more substantial to add before too long.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 16, 2008, 07:28 AM
Thanks ecaradec for:

function onProcessTrigger(path, title, groupname, pluginid, thispluginid, score, entrytype, args)

I am having more luck experimenting with file associations being handled by FARR (overriding / ignoring registry-based settings)  :Thmbsup:
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 16, 2008, 10:08 AM
I put together a FSubScript plugin - Akete (http://ewemoa.dcmembers.com/Plugins/Akete/Akete.zip).

Briefly, this allows one to customize launching of files via FARR.  A user can specify a file-extension -> executable association [1] via FARR's User Variable support.  The archive contains a README.txt with details.


[1] Live free of the registry -- long live portable apps :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 16, 2008, 10:17 AM
FSubScript: i like the new name.  And great progress!! The one thing i think is really key is being able to have the subscripts run using their own independent keywords and regexes.

ewe:  going to try Akete right now.  What is especially cool is that your script might be first plugin to actually take over launching of normal files, which would serve as a great example for others wanting to know how to do it.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 16, 2008, 10:19 AM
Where do we put the scripts? in a subdirectory of FSubScript?
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 16, 2008, 12:31 PM
The one thing i think is really key is being able to have the subscripts run using their own independent keywords and regexes.
Do you mean configuring them ? or using them ?
I tried to use aliases for the independent keywords but it does not work right now because the alias replace the group name. This is why I needed to use the void parameters but it does not seem to work right now as I said. This would be nicer because it would allow the subplugins to look more like ordinary plugins

I put together a FSubScript plugin - Akete (http://ewemoa.dcmembers.com/Plugins/Akete/Akete.zip).
Felicitation you are a pionner of a new era :)
For your question in the plugin about the settings : One way to create options is to send a autohotkey executable, however you can do it the way you like. You need to send a message WM_USER+1 to the window name FScript/FSubScript. Autohotkey program can do this. However an IE with a registered custom protocol could do it to. UI in javascript is a bit tricky. I think I like the autohotkey solution the more.

I don't know if it is better to set script plugins in a subdirectory of fsubscript, or in a subdirectory of plugins or directly with other plugins. I like the solution 3 because it mean that it is a normal plugin. However, they are not normal plugin. It may not be a good idea. I'm not sure what's best.




Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 16, 2008, 12:35 PM
i guess i dont know how to have a script actually be discovered by fsubscript..
it worked with early versions of multi script but not with current one.. when i bring up advanced options i just get empty list box.

i think it makes sense to have scripts be in subdirectory of fsubscript.

also i dont understand what you are saying about sending a windows message to fsubscript.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 16, 2008, 12:52 PM
ok i see why it wasnt finding the subscripts -- you have it looking in one directory deep inside the parent directory.
moving the scripts to the main Plugins directory makes it work.

i'll note that if you make it search arbitrarily deep in the parent Plugins\ directory, it would find subscripts whether they are in their own top level plugin directory, OR subdir of FSubScript, which would be nice and handle all cases.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 16, 2008, 02:06 PM
by the way -- this fsubscript thing is SOOO clearly a huge step forward for FARR plugins.. i mean just look at the sample color script: it's 30 short simple lines long, and it's just a .js file and an icon, as simple as can be.  really really going to make plugin writing accessible to a whole new group of people  :up: :up: :up:
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 16, 2008, 06:31 PM
FSubScript deserves a web page of its own.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 17, 2008, 12:15 AM
For your question in the plugin about the settings : One way to create options is to send a autohotkey executable, however you can do it the way you like. You need to send a message WM_USER+1 to the window name FScript/FSubScript. Autohotkey program can do this. However an IE with a registered custom protocol could do it to. UI in javascript is a bit tricky. I think I like the autohotkey solution the more.

Wow, thanks for responding to a question I put in the plugin's source!

At the moment, it seems enough to just use FARR's User Variable support for configuring Akete, but perhaps as time goes on I'll change my mind about this :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 17, 2008, 12:34 AM
I improved the now renamed FSubScript.

As an exercise in reviewing plugin functionality, understanding FSubScript a bit better, and becoming more comfortable w/ gvim, I filled in more of the skeleton functions in fscript.js:

a piece of FSubScript/fscript.js
function setStatusBar(txt) { FARR.setStrValue("statusbar", txt); }
function setSearch(txt) { FARR.setStrValue("setsearch", txt); }
function setSearchNoGo() { FARR.setStrValue("setsearchnogo", txt); }
function stopSearch() { FARR.setStrValue("stopsearch"); }
function hideWindow() { FARR.setStrValue("window.hide"); }
function showWindow() { FARR.setStrValue("window.show"); }
function toggleWindow() { FARR.setStrValue("window.toggle"); }
function setRichEditMode(txt) { FARR.setStrValue("window.richeditmode", txt); }
function setRichEditHeight(height) { FARR.setStrValue("window.richeditheight", height); }
function setRichEditWidth(width) { FARR.setStrValue("window.richeditwidth", width); }
function setShowAllMode() { FARR.setStrValue("setshowallmode"); }
function exit() { FARR.setStrValue("exit"); }
function reportError(txt) { FARR.setStrValue("reporterror", txt); }
function setCliboard() { FARR.setStrValue("clipboard"); }
function pasteClipboardToLastActiveWindow(txt) { FARR.setStrValue("PasteClipboardToLastActiveWindow", txt) }
function displayAlertMessage(txt) { FARR.setStrValue("DisplayAlertMessage", txt); }
function displayAlertMessageNoTimeout(txt) { FARR.setStrValue("DisplayAlertMessageNoTimeout", txt); }
function displayBalloonMessage(txt) { FARR.setStrValue("DisplayBalloonMessage", txt); }
function execWebbrowserEmbededJavascript(txt) { FARR.setStrValue("EmbeddedWb.ExecJavascript", txt); }

function paste(txt) { FARR.setStrValue("launch", "paste " + txt); }
function copyClip(txt) { FARR.setStrValue("launch", "copyclip " + txt); }
function restartSearch(txt) { FARR.setStrValue("launch", "restartsearch " + txt); }
function doSearch(txt) { FARR.setStrValue("launch", "dosearch " + txt); }
function doSearchOnTrigger(txt) { FARR.setStrValue("launch", "dosearchontrigger " + txt); }
// txt: text with \n as newlines
function showMemo(txt) { FARR.setStrValue("launch", "showmemo " + txt); }
function showFile(filename) { FARR.setStrValue("launch", "showfile " + filename); }
function showFileRTF(filename) { FARR.setStrValue("launch", "showfilertf " + filename); }
function showFileHTML(filename) { FARR.setStrValue("launch", "showfilehtml " + filename); }
function showHTML(txt) { FARR.setStrValue("launch", "showhtml " + txt); }
// txt: url
function htmlViewURL(txt) { FARR.setStrValue("launch", "htmlviewurl " + txt); }
// txt: searchedit, mainpanel
function setFocus(txt) { FARR.setStrValue("launch", "setfocus " + txt); }
// txt: list, memo, html, user, spreadsheet
function setViewMode(txt) { FARR.setStrValue("launch", "setviewmode " + txt); }
function pcommand(txt) { FARR.setStrValue("launch", "pcommand " + txt); }
function setSize(minwidth, minheight, maxwidth, maxheight) {
  FARR.setStrValue("launch", "setsize " +
                   minwidth + ", " + minheight + ", " +
                   maxwidth + ", " + maxheight);
}
// XXX: bool: 0 or 1?
function setHTMLSafe(bool) { FARR.setStrValue("launch", "sethtmlsafe " + bool); }
function showPleaseWait(txt) { FARR.setStrValue("launch", "showpleasewait " + txt); }
function hidePleaseWait() { FARR.setStrValue("launch", "hidepleasewait"); }
//function alert(txt) { FARR.setStrValue("launch", "alert " + txt); }
function sleep(ms) { FARR.setStrValue("launch", "sleep " + ms); }


Don't know if they work, but perhaps it will save ecaradec some drudgery  ;)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 17, 2008, 07:40 AM
There might be bugs. There are centainly bugs.

onSearchBegin() in FSubScript/fscript.js
Perhaps the following line:

  plugins.search(querykey, isExplicit, queryraw, modifier, triggermethod);

should be something like:

  plugins.search(querykey, isExplicit, queryraw, querynokeyword, modifier, triggermethod);


Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 17, 2008, 12:48 PM
ewe, it's fantastic seeing such progress  :up: :up:
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 18, 2008, 02:00 AM
ewemoa I've replaced my skeleton functions with those you did. Thanks.
The querynokeyword would probably a bit different from the farr one. I'll have to remove the whole "fssc +pluginAlias". If you do it I'll integrate it. Also the FARR querynokeyword seem broken : It always return the same thing as the queryraw.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 18, 2008, 02:54 AM
I've replaced my skeleton functions with those you did. Thanks.

Cool! I hope they work ;)

The querynokeyword would probably a bit different from the farr one. I'll have to remove the whole "fssc +pluginAlias". If you do it I'll integrate it.

In addition to what mouser mentioned earlier in this thread, he gave me some hints on the idea of being able to invoke FSubScript plugins w/o using "fssc +pluginAlias" syntax but rather "pluginAlias" syntax.  I am investigating this a bit and hope to report back with some results on this before too long.

Also the FARR querynokeyword seem broken : It always return the same thing as the queryraw.

I got the feeling querynokeyword seems broken too -- some of my querynokeyword-not-working experience is summarized at:

https://www.donationcoder.com/forum/index.php?topic=11804.msg136530#msg136530
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 18, 2008, 04:37 AM
It's a first attempt, but attached, please find an experiment with FSubScript's fscript.js and colors' fsubscript.js.

The idea here is to provide the plain plugin invocation syntax of "name" rather than "fssc +name".

I'm probably missing some important things, but may be the code is worth something ;)


P.S. I have limited screen space so I've reformatted -- hope that isn't a problem.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 19, 2008, 05:14 AM
Attached is a further refinement after discussion with mouser.  Check it out...or not  ;)

Some changes include:

Fubscript/fscript.js:

colors/fsubscript.js:

Both:
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 19, 2008, 01:25 PM
The stop search is a very good idea. I was painfully trying to have aliases without modifier. It just work now :) and its much better.

I think we should consider this version official. Thank you a lot!
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 19, 2008, 01:54 PM
I'm not sure how stopsearch work. What would occured if previous plugins generates results (plugins and subplugins ). Wouldn't there be some random results depending on order of execution ?
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 19, 2008, 02:13 PM
basically the first plugin that matches will prevent others from generating results.  but thats the way all plugins work.

alternatively if you think some plugins want to generate results and not stop others from making results, you could have a per-plugin option to say whether to stop or not.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 19, 2008, 04:06 PM
I may be wrong but it seem that the plugin is now doing the filtering. Is there a way to keep FARR doing the filtering ? I would like to avoid burden plugins dev with the filtering except when they don't need it. That was the reason I used modifiers : they didn't affect the filtering.

Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 19, 2008, 04:26 PM
ecaradec is right -- the plugins should not do the filtering -- farr can do a smarter job (or else farr should be fired!)

i think it just requires an extra function for me to write that the plugins can call.

Let me explain:

There are two ways that a plugin normall gets called:
1) either because its keyword is typed by the user
2) or what user types matches a regular expression.

in case 1, usually what farr does is automatically filter the results returned by the user based on subsequent words on the search string after the first keyword that matched plugin name.

in case 2, usually you do not want subsequent filtering, since presumably you are catching other text on the line besides just the one keyword at the front.

---

now i think the problem with fsubscript is that the parent fsubscript script basically has to match on the raw string (or by matching .* regex) -- so farr doesnt know how to do subsequent filtering.

so i think what i need to add is a pluginp->set_strvalue("filteron",rest of typed search to filter on)

and then fsubscript can call this function with search words after the first matching keyword.

does that make sense?
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 20, 2008, 02:19 AM
Yes, it make sense for me.
Shouldn't we continue calling all the plugins even if one is explicit ? Why stopping the search ?
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 20, 2008, 03:19 AM
Attached is a "sketch" of further ideas -- I think mouser may be the only one with a FARR that can execute the code appropriately (I know I don't have one yet).

Some changes include:

Fubscript/fscript.js:

colors/fsubscript.js:

Both:

Regarding why search stops -- I don't have a clear memory of the reasons.  I think it might have had something to do with FARR's current behavior for non-FScript plugins, but it's probably best for mouser to answer this question :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 20, 2008, 11:07 AM
cool, trying now.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 21, 2008, 08:23 AM
been tweaking a tiny bit and talking to ewemoa about how some things work and he is making great progress extending fsubscript to let each plugin script be triggered normally like all other plugins.  I'd say in very short time fsubscript scripts will be 100% as powerful and flexible as normal fscript plugins.  This is truly a great thing  :-* :-* :Thmbsup: :Thmbsup: :Thmbsup: :-* :-*
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 21, 2008, 09:45 AM
Good news I'm just waiting for the next farr that will add support for it.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 21, 2008, 09:53 AM
ecd,
take a well deserved rest until ewe has finished a round of work on your masterpiece  :up:
-mouser
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 21, 2008, 05:59 PM
I think that we are going to see the ability to use dqsd searches (https://www.donationcoder.com/forum/index.php?topic=13266.0) in FARR come pretty soon based on the work on fsubscript.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 22, 2008, 06:57 AM
I hope ecaradec has gotten his hands on a version of FARR that can do ForceResultFilter :)

Attached, please find the latest attempt.

Some changes include:

Fubscript/fscript.js:

colors/fsubscript.js:

Both:

Revision control, anyone?
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 22, 2008, 10:42 AM
Attached, please find attempt after mouser's corrective suggestions  ;)

Some changes include:

Fubscript/fscript.js:

Recursively searching for fsubscript.js to some depth has not been implemented yet.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 22, 2008, 05:53 PM
Attached, please find an attempt at recursively searching for fsubscript.js to a limited depth.

Some changes include:

Fubscript/fscript.js:

For testing purposes, I put the colors subdirectory inside a subdirectory of the FSubScript directory.
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: mouser on November 22, 2008, 06:42 PM
please find an attempt at recursively searching for fsubscript.js to a limited depth.

great!
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 25, 2008, 07:14 AM
Attached, please find the latest.

Some changes include:

Fubscript/fscript.js:

3 plugins are bundled with this archive:

ecaradec, I had a question about some of the code in FSubScript/fscript.js -- specifically the .showSettings() and .settingsChanged() lines that sit outside of the for () {} constructs, but as I was composing this post, I think I figured out that I was confused, so please disregard the comments there :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: czb on November 27, 2008, 03:37 AM
Could you pls create a txt help file with all functions and other calls that fsubscript coder can use?
also pls bundle fscript.dll :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 27, 2008, 06:02 AM
May be ecaradec wouldn't mind updating his "fingers in the nose" guide :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: czb on November 27, 2008, 07:23 AM
I must say it is a great plugin  :Thmbsup:

Just an idea:


Here is my corrected fsubscript plugin
http://dl.getdropbox.com/u/4571/FARR/FSubScript.zip
and JScalc:
http://dl.getdropbox.com/u/4571/FARR/JScalc.zip

fsubscript changes:
JSCalc changes:
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 27, 2008, 08:43 AM
Haven't tested yet, but hope to soon.

ecaradec: czb and I were chatting and started to wonder about extending things via prototypes -- e.g. String and trim.  Do you have any good ideas about how this might be managed to reduce (or eliminate?) conflicts among code produce by various plugin authors?
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 27, 2008, 09:54 AM
Some initial comments on a few things I've looked at so far:

I noticed that for onSearchBegin(), a sub-plugin (?) defines search(), for onReceiveKey(), a sub-plugin defines receive(), and for onProcessTrigger(), a sub-plugin defines trigger().  I found it a little odd that for onInit(), a sub-plugin defines onInit() -- similarly for onSetStrValue().  I think init() [if that's possible] seems somehow better-fitting in terms of naming -- either that or change all of the other things to match the names used by fscript.js.  Or may be some other idea?  What do you think?

I'm not so clear on how fscript.js/onSetStrValue() should behave -- specifically, the return value seems to get decided purely on whether a single sub-plugin returns true.  Is that what we want?  What if more than one sub-plugin returns a value and one returns true while another returns false?  May be the current implementation is what we want -- which would be fine by me, I just don't currently have a sense of what it should be :)

onInit() in the original fscript.js took a single parameter iirc, in the most recent code candidate the sub-plugin's onInit() doesn't take a parameter. I wonder whether mirroring the original interface is preferable or not.  May be it's not a big deal.  Any thoughts?

I'm not sure about loading all fsubscript*.js files -- I wonder whether the loading order might matter in some cases and with the way the code is currently, a sub-plugin writer can only control this based on coming up with appropriate filenames.  I hadn't really thought about multiple files per sub-plugin so I start to wonder about the potential consequences and alternative designs :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ecaradec on November 27, 2008, 04:24 PM
I think sub-plugins should not extend global state. fsubscript could expose many useful functions so that plugin developers have less need for sharing things.
Inclusion of other files can be done with eval(getTextFile("json.js")) if your plugin is too big to practically work in one file.
I found it a little odd that for onInit(), a sub-plugin defines onInit() -- similarly for onSetStrValue().  I think init() [if that's possible] seems somehow better-fitting in terms of naming -- either that or change all of the other things to match the names used by fscript.js.  Or may be some other idea?  What do you think?
Given it's done one way, I prefer it to stay the same so that we don't loose time talking about useless guidelines.

I'm please to see you on board czb :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: ewemoa on November 28, 2008, 08:16 AM
I didn't exactly follow what you meant about the naming of things, but thanks for the review and feedback.

Since my experience and understanding of FARR and FScript is rather limited, I guess my comments are likely to be too :)
Title: Re: New FARR plugin : FSubScript enable loading of multiple javascript plugins
Post by: czb on November 28, 2008, 08:58 AM
hi,

onInit() onSetStrValue()
Yes you are right, that it should be unified. I will leave all naming upon you so I will definitely change it into Init() and SetStrValue

I'm not so clear on how fscript.js/onSetStrValue() should behave -- specifically, the return value seems to get decided purely on whether a single sub-plugin returns true.
 
Well this behaviour is for pcommand where you have to tell FARR that at least 1 plugin treated it so FARR would not display error message. I do not know other usage of returning value to FARR from OnSetStrValue, so if you know of any we can implement it ;) But at least some implementation is necessary because pcommand is used quite often.

onInit() in the original fscript.js took a single parameter iirc, in the most recent code candidate the sub-plugin's onInit() doesn't take a parameter. I wonder whether mirroring the original interface is preferable or not.  May be it's not a big deal.  Any thoughts?
I did it so because there is already curdir implementation via directory variable, so why to have it twice? So I would keep it without any parameter :)

I'm not sure about loading all fsubscript*.js files -- I wonder whether the loading order might matter in some cases and with the way the code is currently, a sub-plugin writer can only control this based on coming up with appropriate filenames.  I hadn't really thought about multiple files per sub-plugin so I start to wonder about the potential consequences and alternative designs smiley
Inclusion of other files can be done with eval(getTextFile("json.js")) if your plugin is too big to practically work in one file.

Well aceradec showed one way which is in fact very easy and straitforward, but still I would keep name variation just for the case when you want to have several small subplugins in one directory which can easily occur. But we can discuss that and if we find it as "baad" idea we can always erase it ;)

I think sub-plugins should not extend global state. fsubscript could expose many useful functions so that plugin developers have less need for sharing things.

Yes exactly that is what I proposed to ewemoa. To have list of useful functions which make js developers life easier. The problem is to decide which to add on the list ;)

I have also one request to ewemoa and aceradec and maybe mouser. Could one of you pls create any environment where we could colaborate on fsubscript plugin? Like propose new modifications etc... I have no experience with that so I will leave it on somebody else :)