next up previous contents
Next: Using shared objects in Up: Tutorials Previous: Opening pdf files   Contents

Calling Active scripting languages

By using the ScriptHost object in SWFKit Pro, you can call Active scripting languages such as jscript, vbscript, perlscript, pythonscript, rubyscript, etc. Please read more details about the ScriptHost object from the FFish scripting language manual of SWFKit Pro. At here we just show how to use the ScriptHost object in Action script.
    import SWFKit.*;

    var sh = new ScriptHost;
    sh.open("perlscript");
    sh.runScriptFile("c:\\test.pl");
    sh.close();
    sh.open("jscript");
    sh.runScript("function add(a, b) {return a + b;}");
    var ax = ActiveXObject.fromID(sh.getScriptObject());
    var value = ax.callMethod("add", "Hello,", "world");
    _root.strace(value);
    sh.Release();
As you can see from the above code, the "getScriptObject" method returns an ActiveXObject object, which contains the global functions and variables in the running script.



Copyright ©2000-2010 Shanghai TopCMM Software Technologies. All Rights Reserved.