Welcome Guest.   Make a donation to an author on the site December 20, 2014, 02:43:31 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Read the full one-year retrospective report on DonationCoder.com.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 3 4 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: FScript Javascript SDK - Write FARR plugins in javascript and more.  (Read 47164 times)
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: February 09, 2008, 04:24:35 PM »

Fscript is a plugin that allow to write FARR plugin in javascript natively (and in others languages if they are correctly set up ). The principle is to copy the fscript.dll in a plugin folder, to add a file named fscript.js in the same folder (or fscript.rb, fscript.pl, fscript.py for others languages ).

Rem : If you are only interested in writing Javascript plugins you should consider using FSubScript plugin that does the same as FScript (actually FSubScript is itself a FScript plugin ) but can host many plugins simultaneously thus reducing the memory usage.
There is at least two version of FSubScript and the most up to date is CZB version available at : http://www.donationcoder....m/index.php?topic=17153.0

The FScript SDK is available at :
http://e.craft.free.fr/fa...samples/FScriptSample.rar
The last FScript.dll is downloadable at :
http://e.craft.free.fr/fa.../FScript/1.20/fscript.dll
A somewhat incomplete documentation is available at :
http://e.craft.free.fr/farr/FScript/help.html

Here is a basic javascript plugin :
Formatted for Javascript with the GeSHI Syntax Highlighter [copy or print]
  1. // plugin script :
  2. displayname="FScript";
  3. versionstring="1.0.0";
  4. releasedatestring="Jan 1st, 2008";
  5. author="Author";
  6. updateurl="";
  7. homepageurl="";
  8. shortdescription="FScript";
  9. longdescription="FScript";
  10. advconfigstring="FScript";
  11. readmestring="FScript";
  12. iconfilename="FScript.ico";
  13.  
  14. aliasstr="fscript";
  15. regexstr="";
  16. regexfilterstr="";
  17. keywordstr="";
  18. scorestr="300";
  19.  
  20. // type
  21. UNKNOWN=0; FILE=1; FOLDER=2; ALIAS=3; URL=4; PLUGIN=5; CLIP=5;
  22. // Postprocessing
  23. IMMEDIATE_DISPLAY=0; ADDSCORE=1; MATCH_AGAINST_SEARCH=2;
  24. // search state
  25. STOPPED=0; SEARCHING=1;
  26.  
  27. function onSearchBegin(querykey, explicit, queryraw, querynokeyword, modifier, triggermethod) {    
  28. if(!explicit) {
  29. return;
  30. }
  31. FARR.setState(querykey,SEARCHING);
  32. FARR.emitResult(querykey,"Hello", "Hello", iconfilename,UNKNOWN,IMMEDIATE_DISPLAY,1000);
  33. FARR.setState(querykey,STOPPED);
  34. }

The full documentation is available on the aliases and scripts plugins wiki : http://farr.dcisv.com/dok...?id=fscript_documentation

Changelist
1.19
- restore the compatibility with previous versions. onProcessTrigger is emulated when the version of FARR use onProcessTriggerV2.
- increase the getStrValue buffer to 1 Mo allow to read bigger string
1.18 [warning incompatible change]
- onProcessTriggerV2 has change to onProcessTrigger to allow FARR plugins to behave the same way on new and old FARR versions.
=> the incompatible change is of interest for plugins writers, just rename the function in the script to get precedent behavior.
1.17
- fix a crash with the KlipKeeper plugin in AllowProcessTriggerV2.
1.16
- fix a crash in AllowProcessTrigger
1.15
- add socket support (string only, this is suitable for doing telnet like things )
1.14
- increase the size of getStrValue that could be bigger than expected
1.13
- add support for onProcessTriggerV2
1.12
- add the getObject function to access WMI facilities
1.11
- enable interprocess communication with the plugins through WM_USER+1 messages
- add support to read the keyboard state
- add support to read the current query in the input box
1.10
- add groupname and args to emitResults function and triggerResults
- add help file
- add onDoShowReadMe callback
1.8
- return a correct value on onStrValue Callback
- add ability to read .INI file (for easing compatibility with ahk )
1.6
- add support for onGetStrValue callback
- allow to not close FARR on onProcessTrigger
1.5
- support for api evolutions of FARR
- support callback for onDoAdvConfig
- support for onSearchBeginV2 and onRegexSearchMatchV2 callbacks
- support for onIdleTime
- support for onReceiveKey
- fix an incompatibility when multiple fscript plugins where loaded at the same time
- support for timers
- support for xml generated options (deprecated )


I released the sources of FScript if you want to throw an eye at it. You can grab a copy of the latest sources at http://github.com/ecaradec/fscript/tree/master. Adding function should not be very hard if you need them. Just look at other functions and add new ones. The scripts interface are exposed via COM so don't forget to edit the idl to add your functions too. You can ask questions too. I will certainly answer.
« Last Edit: January 12, 2011, 08:34:03 AM by ecaradec » Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
mouser
First Author
Administrator
*****
Posts: 33,786



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: February 09, 2008, 08:07:45 PM »

wow  ohmy
Logged
Armando
Charter Member
***
Posts: 2,683



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #2 on: February 09, 2008, 09:39:48 PM »

Hi Ecaradec, the download link doesn't seem to be working... Is it because you're already torturing and updating the poor thing ?  Wink
Logged

"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
taichimaster
Charter Member
***
Posts: 159



View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: February 09, 2008, 09:51:51 PM »

WOW nice!!!  Thmbsup  The SDK link seems to be broken though.

For plugins developed using scripting languages (ruby, perl, python) that aren't included in WSH by default, do the users need to have the ActiveState engines installed on their machines?

Logged

ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: February 10, 2008, 04:23:31 AM »

Ok the url is fixed.
For plugins developed using scripting languages (ruby, perl, python) that aren't included in WSH by default, do the users need to have the ActiveState engines installed on their machines?
Yes the active scripting engines must be installed. Look at : http://www.mvps.org/scripting/languages/
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
vitalyb
Supporting Member
**
Posts: 141



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: February 10, 2008, 06:28:50 AM »

Oh man, I should really catch up with the .NET SDK

Great work mate!
Logged
rbeeger
Charter Member
***
Posts: 72


View Profile Give some DonationCredits to this forum member
« Reply #6 on: February 10, 2008, 09:55:22 AM »

Hi Ecaradec,

looks like you are scanning for a fixed set of suffixes (js, rb, vbs, py and pl). So you don't allow for other scripting languages that are integrated into the windows scripting host.
Could you change that and make the plugin try to execute any fscript.* that exists in the same directory the DLL is in.
Or there could be a config file that specifies which script to call.

Cheers,
  Robert
Logged
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: February 10, 2008, 01:10:41 PM »

Quote
Looks like you are scanning for a fixed set of suffixes (js, rb, vbs, py and pl).
I could search for fscript.* but it would not give me the language that I need to tell to the script control. I could set it in the config file, but I like beeing able to just define a file and have a working plugin. If you want to write a plugin in a language not the list, tell me and I'll add it.
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
rbeeger
Charter Member
***
Posts: 72


View Profile Give some DonationCredits to this forum member
« Reply #8 on: April 21, 2008, 01:50:21 PM »

Hi ecaradec,

As I tried out the todoTXT plugin which is based on Python and FScript, I discovered that it didn't work, it didn't even show up in the plugin list. The page at mvps.org lists the python.org-variant of Python which I have installed and prefer over the ActiveState variant as a valid Windows scripting language.
I don't know anything about how you enable a scripting language in FScript but I suspect that the python and ActiveState variants use different ids or names or something like that and that FScript only checks for the ActiveState ones. Would it be hard to make it configurable what veriant of Python is used or release a version of fscript that uses the python.org variant?

Cheers,
  Robert
Logged
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: April 23, 2008, 07:05:35 AM »

The normal Python installation do not install automatically the activescripting support. You must install the Python for windows extension. Download it at :

http://sourceforge.net/pr...wfiles.php?group_id=78018

However I tried this and the activestate python and I wasn't able to make the plugin work in any case. How did you install your python czechboy ?
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
czb
Moderator
*****
Posts: 335



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #10 on: April 23, 2008, 07:21:06 AM »

Well I downloaded ActivePython 2.5.2.2 for Windows (x86) and then just pressing next all the time during installation Wink I must say that before ActivePython I had there normal python for a while (like two hours smiley ) which I have uninstalled before ActivePython installation. I have WinXP SP2 Wink I have also installed Kudos or how it is called (from the same site) but it was just because I wanted somehow to turn JIT debugging on for python - was not succesful. But python script was working even without it...
Logged

My open-source online piano game: http://musicope.com/
rbeeger
Charter Member
***
Posts: 72


View Profile Give some DonationCredits to this forum member
« Reply #11 on: April 24, 2008, 03:06:50 PM »

Yes, with ActiveState Python it also works here.
Logged
mouser
First Author
Administrator
*****
Posts: 33,786



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #12 on: May 06, 2008, 08:01:04 PM »

Download link seems to be down..
Logged
reckoner
Supporting Member
**
Posts: 16

View Profile Give some DonationCredits to this forum member
« Reply #13 on: May 08, 2008, 12:31:10 PM »

Hi,

I am interested in getting this working with Python. I have followed the instructions exactly and created both a fscript.rb and fscript.py in the directory

C:\Program Files\FindAndRunRobot\Plugins\FScript

that contains the  following:

FScript.dll
fscript.rb
fscript.js
fscript.py

However, it only recognizes the fscript.js plugin and not the ruby or python one. I got the ruby script from your example above. I uninstalled and re-installed activestate python and installed ruby, but these had not effect.

I'm getting the feeling that there is something else missing here, maybe some kind of SDK that I don't have installed. I have the NET 2.0 framework installed on my Windows XP(SP2).

Little help?
Logged
mouser
First Author
Administrator
*****
Posts: 33,786



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #14 on: May 09, 2008, 02:01:49 AM »

Hi Reckoner and welcome!! Nothing makes me happier than seeing new potential plugin coders post.  Ecaradec is the coder who wrote this fscript sdk, and i know he will be by soon to help answer this and also release an update to the sdk soon i think.
Logged
czb
Moderator
*****
Posts: 335



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #15 on: May 09, 2008, 03:00:04 AM »

reckoner: Do you have one fscript file in the folder? I do not think you can have py,js,rb together. Try to take a look at my TodoTXT plugin => it is python plugin Wink
Logged

My open-source online piano game: http://musicope.com/
ecaradec
Honorary Member
**
Posts: 408



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #16 on: May 09, 2008, 03:37:51 AM »

reckoner: Do you have one fscript file in the folder? I do not think you can have py,js,rb together. Try to take a look at my TodoTXT plugin => it is python plugin Wink
Yes. You must remove the fscript.js and put a fscript.py. It should work. Happy coding smiley
Logged

Blog & Projects : Blog | Qatapult | SwiffOut | FScript
reckoner
Supporting Member
**
Posts: 16

View Profile Give some DonationCredits to this forum member
« Reply #17 on: May 12, 2008, 07:25:45 AM »

thanks for your feedback.

I downloaded TodoTXT and put in in the plugins folder and refreshed the plugins. I'm having the same problem however: td is not recognized as a plugin.

I would say there's something weird with my python installation, but I did reinstall the activestate version and I did install Ruby for the first time to try the above example.

Any other ideas?
Logged
Perry Mowbray
N.A.N.Y. Organizer
Charter Member
***
Posts: 1,807



Thoughtful Scribbles

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #18 on: June 21, 2008, 09:46:13 AM »

1. Is it possible to stop FARR closing when a result is double-clicked?

What I'm wanting to do is have the ability to further define the search in the edit box by the item clicked on.

2. Can I get information from the found item into the EditBox?
  • When I select the item's context menu and select "Jump to directory in EditBox" nothing happens  undecided
  • When I drag the item to the EditBox the correct "path" is entered BUT it's prefixed with a "/", which I don't want.

So what's happening is I've entered a search "tz .*" which matches stuff, I'd like to select one of the matches and "search" again with that.
  • My Alias String is tz.
  • The path for both of #2 items is something like "TZ Pacific/Auckland": I added the Alias String to the path in the hope that I could get that data into the edit box.
Logged

Perry Mowbray
N.A.N.Y. Organizer
Charter Member
***
Posts: 1,807



Thoughtful Scribbles

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #19 on: June 21, 2008, 10:03:28 AM »

Another quick question:

I'm not sure what the effects of the PostProcessing options are:
Quote
IMMEDIATE_DISPLAY=0; ADDSCORE=1; MATCH_AGAINST_SEARCH=2
Logged

mouser
First Author
Administrator
*****
Posts: 33,786



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #20 on: June 21, 2008, 10:35:30 AM »

When a plugin returns a result item, it gives it a score.  The score determines where the result is ranked in the result list.  The PostProcessing option tells FARR how to use this score:

  • IMMEDIATE_DISPLAY=0 -- this tells FARR to use the plugin's score directly and do nothing more with the score
  • ADDSCORE=1 -- this tells FARR to take the score given by the plugin and then add its own score to it based on how well it matches other stuff, BUT also instructs FARR to never reject the result (it will be shown no matter what the score)
  • MATCH_AGAINST_SEARCH=2 -- this tells FARR to add it's own score to the plugin score and to reject the result if it doesnt match the rest of the search string.  this would be the method of choice if you want FARR to figure out whether to show the result or not based on the search string.  i guess this option is the most common and useful one.
Logged
mouser
First Author
Administrator
*****
Posts: 33,786



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #21 on: June 21, 2008, 10:42:01 AM »

Quote
1. Is it possible to stop FARR closing when a result is double-clicked?
add " /stayopen" to the end of the launch result to tell FARR to stay open after launching.

Quote
2. Can I get information from the found item into the EditBox?
there may be something i can do to improve the case of dragging and dropping into edit box or chooding jump to directory for these cases, but regardless, i think what you are wanting to, if i understand it which i might not, is to populate your results like this:
choice 1 | restartsearch tz pacific/auckland
choice 2 | restartsearch tz usa
etc

the restartsearch launch command will put the text that follows into the edit box when the item is selected, so it lets you build things like menus in FARR results.
Logged
Perry Mowbray
N.A.N.Y. Organizer
Charter Member
***
Posts: 1,807



Thoughtful Scribbles

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #22 on: June 21, 2008, 09:31:34 PM »

Quote
1. Is it possible to stop FARR closing when a result is double-clicked?
add " /stayopen" to the end of the launch result to tell FARR to stay open after launching.

OK: pretty sure that that option is not available in this Plugin? Could onProcessTrigger return a result??

Quote
2. Can I get information from the found item into the EditBox?
there may be something i can do to improve the case of dragging and dropping into edit box or chooding jump to directory for these cases, but regardless, i think what you are wanting to, if i understand it which i might not, is to populate your results like this:
choice 1 | restartsearch tz pacific/auckland
choice 2 | restartsearch tz usa
etc

the restartsearch launch command will put the text that follows into the edit box when the item is selected, so it lets you build things like menus in FARR results.

yes, that sounds perfect: but again, I'm pretty sure that that command is not available in the Fscript plugin?

ecaradec?? I'd love to have that command  Kiss
Logged

mouser
First Author
Administrator
*****
Posts: 33,786



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #23 on: June 22, 2008, 05:08:35 PM »

couple of things:
you can create an .alias file and include it inside your plugin directory.
this can be extremely useful in terms of building helper menus like those shown above to work hand-in-hand with your plugin.

as far as stayopen not being available in the plugin, two things:
you specify /stayopen when you call from the plugin the set_strval("launch","file_to_launch /stayopen") like that
or add it to the end of your result that you return from your plugin.

OR if you are doing a takeover of the OnProcessTrigger, ecaradec just added the ability to tell farr not to close -- you return a value of 1 from that event function. BUT BUT BUT -- i don't think ecaradec has made that new version of fscript public yet (1.6) so you need that first.
Logged
Perry Mowbray
N.A.N.Y. Organizer
Charter Member
***
Posts: 1,807



Thoughtful Scribbles

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #24 on: June 22, 2008, 09:01:36 PM »

Thanks for the tip on .alias files. Wasn't aware.

What I'm trying to do is present some matches from the user entered query. The user can select one of the matches, which will be added to the EditBox (Like what happens when you are browsing the FileSystem in FARR). Then FARR reSearches on the new string and presents other options. So very similar to browsing the filesystem in FARR.
Logged

Pages: [1] 2 3 4 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.066s | Server load: 0.07 ]