tablacus / TablacusScriptControl

Script Control for 64-bit platforms
https://tablacus.github.io/scriptcontrol_en.html
MIT License
62 stars 17 forks source link

The method or operation is not implemented: set_UseSafeSubset #18

Closed hwfy closed 4 years ago

hwfy commented 4 years ago

Due to the need to assign a value to UseSafeSubset, but the runtime prompt: set_UseSafeSubset is not implemented, check the source code and find that all methods only implement get and put, can you implement set method? thank you

tablacus commented 4 years ago

Let me know what your environment is, and what is the host program. Anyway, I have adjusted it on Tablacus Script Control 64 1.2.1.0. Please try to install it.

Regards,

hwfy commented 4 years ago

My system is windows10 64 bit. When I register version 1.2.1.0, there is an error:

Unable to cast COM object of type 'MSScriptControl.ScriptControlClass' to interface type 'System.Runtime.InteropServices.ComTypes.IConnectionPointContainer'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B196B284-BAB4-101A-B69C-00AA00341D07}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Thank you

tablacus commented 4 years ago

I would like a little more information. I have no problem with VBScript(WSH) or JScript(WSH), but what host program do you use?

Regards,

hwfy commented 4 years ago

My project is asp.net webapi, and the script engine is VBScript. There is no problem using msscript.ocx on iisexpress 32-bit. Switching to iisexpress 64 bit will cause problems. Some codes are as follows:

` using MSScriptControl;

namespace ScriptEval { public class ScriptEngine { private ScriptControl msc; public event RunErrorHandler RunError; //public delegate void RunErrorHandler(); public event RunTimeoutHandler RunTimeout; //public delegate void RunTimeoutHandler();

    public ScriptEngine()
    {
        msc = new ScriptControlClass();
        msc.UseSafeSubset = true;
        msc.AllowUI = true;
        msc.Language = "VBscript";
        ((DScriptControlSource_Event)msc).Error += ScriptEngine_Error; //The error occurred in this line
        ((DScriptControlSource_Event)msc).Timeout += ScriptEngine_Timeout;
    }

    private void ScriptEngine_Error()
    {
        if (this.RunError != null)
        {
            this.RunError();
        }
    }

    private void ScriptEngine_Timeout()
    {
        if (this.RunTimeout != null)
        {
            this.RunTimeout();
        }
    }
}

}

` Thank you.

tablacus commented 4 years ago

I have adjusted it on Tablacus Script Control 64 1.2.2.0. Please try to install it.

Regards,

hwfy commented 4 years ago

Perfect, problem solved, thank you very much!

tablacus commented 4 years ago

Thank you for the report.