On 2024-07-30 4:29 p.m., Valentin Abrutski wrote:
Hi Mark.

I double checked what I did with my previous attempt. And still can't get success. Probably you can give me an idea of what I'm doing wrong.

I am working on an application(.Net) which provides scripting capabilities via AcriveScript Engine. With the ability to debug script step by step and etc. And we provide a standard set of languages VBScript and JScript. And now we want to provide Python support.

Obviously I need to add a new ActiveScript Engine for Python. to system

What I did. I installed python and installed the pywin32 package.
Then I found this script Python311\Lib\site-packages\win32comext\axscript\client\pyscript.py and run it :
python pyscript.py
Requesting elevation and retrying...
Registered: Python

After that, I go to my application code and do the same we already do for Standard JScript or VBScript engines.
For example, import of COM JScript class  is defined
    [ComImport, Guid("F414C260-6AC0-11CF-B6D1-00AA00BBBB58")]
    public class JScript
    {
    }

So I defined import class for Python using GUID from python class implementation
    [ComImport, Guid("DF630910-1C1D-11d0-AE36-8C0F5E000000")]
    public class PythonScript
    {
    }

Then my expectation is that I can cast it to IAcriveScript and IActiveScripParse (like I do with standard languages)
    _engine = new PythonScript();
    _iap = _engine as IActiveScriptParse;
    _ias = _engine as IActiveScript;

But IActiveScriptParse still is null, IActiveScript - is good.
I suppose that probably I did initialization in wrong way? or something like that?

My best guess is that the "as" isn't working due to a lack of a typelib for the engine - but a QueryInterface(IID_IActiveScriptParse) on the IActiveScript interface should work.

HTH,

Mark





On Tue, Jul 30, 2024 at 10:54 PM Valentin Abrutski <v...@zaptest.com> wrote:

    Hi Mark

    Appreciate for fast response. I will look into it. Thank you.


    On Tue, Jul 30, 2024 at 5:56 PM Mark Hammond
    <mhamm...@skippinet.com.au> wrote:

        IActiveScriptParse is supported - check out the
        com/win32comext/axscript directory.

        Cheers,

        Mark

        On 2024-07-30 10:14 a.m., Valentin Abrutski wrote:
        Hello all,

        Hopefully somebody can help me.

        Microsoft provides implementations for Microsoft Scripting
        Engine - VbScript and JScript.
        I need to add Python Script Engine support. I see that
        pywin32 already has a component for that(COM object). But it
        exposes only the IActiveScript interface. For my needs I also
        need IActiveScriptParse interface.

        please advise me if pywin32 implements it also and I just
        missed something? or if you have an idea what to do to get..
        I will appreciate for your help.

        _______________________________________________
        python-win32 mailing list
        python-win32@python.org
        https://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to