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

Any "easy" way to create ActiveX objects (for use with JScript)?

<< < (2/2)

ewemoa:
I thought to use the lib_ffi (which is a wrapper that allow script language to call native code ) to allow jscript to call any native functions. However this is a bit laborious to bind with active scripting since nobody seem to have done that before. I'm not sure there is that many functions that would be useful.
-ecaradec (March 04, 2009, 05:38 AM)
--- End quote ---

This sounds interesting.  May be I will try to find out more about it.

You also have the FARR.getObject function available that give you access to the wmi objects.

--- End quote ---

I guess if I understood WMI better I might find this attractive :)  Perhaps it is worth learning more about.

You also have sockets in the recent version. You could implement the functionnalities in a server and communicate via sockets.

--- End quote ---

Hmm, may be -- I don't suppose you have some sample code? ;)

You could also use another script language that come with libraries that allow many more things than the jscript allow.

--- End quote ---

This was my original leaning, but the main problem w/ this in my opinion is that the attractive languages to me would be Python, Perl, or Ruby (possibly a few others) -- but none of them ship w/ Windows.  That seems to imply one of:


* users installing the languages
* providing plugins that contain code created w/ things like py2exe, perl2exe, rubyscript2exe, and the like
The former I can say from experience working on another FARR-like project that it doesn't tend to work out so well.  The latter I am guessing tends to create rather large plugins (and possibly bloating FARR's runtime footprint?).

I'd be glad to be wrong about using other scripting languages -- may be there is something I'm missing.

ecaradec:
You can find a socket sample in the fftab plugin. Here is an untested approximative sample :

--- ---function write(txt) {
    var sock=FARR.newTCPSocket("localhost",4242);
    sock.write(txt);
    sock.close();
}
function read(txt) {
    var sock=FARR.newTCPSocket("localhost",4242);
    do {
        var fragment=sock.read();
        content+=fragment;
    } while(!content.match(/END_OF_TRANSMISSION$/))
    sock.close();
}

You have to test for something while reading to detect when stopping to read since a read of 0 length can be caused by latency. Note that the loop will use maximum cpu. It would probably better to read asynchronously in a timer.

Navigation

[0] Message Index

[*] Previous page

Go to full version