Quantcast
Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Showcase


Channel Catalog



Channel Description:

ClearScript is a library that makes it easy to add scripting to your .NET applications. It currently supports JavaScript (via V8 and JScript) and VBScript.

older | 1 | .... | 26 | 27 | (Page 28) | 29 | 30 | .... | 115 | newer

    0 0

    Using of CurrencyWrapper resolve this issue.

    0 0

    Hi Igor,

    Can you give me example?

    Sure. One thing you could do is use a host method to operate on decimal values:
    scripter.Script.add = new Func<decimal, decimal, decimal>((a, b) => a + b);
    Console.WriteLine(scripter.Evaluate("add(num1, num2)")); 
    Another possibility might be to use a host method to cast decimal values to a type that VBScript can deal with:
    scripter.Script.toDouble = new Func<decimal, double>(value => (double)value);
    Console.WriteLine(scripter.Evaluate("toDouble(num1) + toDouble(num2)"));
    Good luck!

    0 0

    Hi Igor,

    You have to use the IsNull function in this case:
    function Test
    if IsNull(Class1.Class2) then
        Test = true
    else 
        Test = false
    end if
    end function
    Thanks!

    0 0

    It's not solution for our legacy application, we can't fix all customer scripts.
    Anyway thanks a lot.

    0 0

    That break compatibility with legacy application. We can't change client scripts.

    0 0

    What VBScript data type do the scripts use for which you're trying to provide decimal values? Is it currency?

    0 0

    Understood. Unfortunately there seems to be no way to marshal nothing into the script engine. That is, there's no value we can return from the host that VBScript will interpret as nothing. We can marshal in null and empty, but not nothing. And marshalling nothingout of VBScript doesn't work; the result on the host is null.

    0 0

    Try use DispatchWrapper.

    0 0

    Yes, it's a currency

    0 0

    You're absolutely right! A value of new DispatchWrapper(null) is picked up as nothing on the VBScript side. Thank you!

    We'll be happy to add null<-> nothing marshalling to ClearScript, but it'll have to be optional to avoid breaking existing code. A new engine flag seems like a sensible approach.

    Thanks again!

    0 0

    We'll add decimal<-> currency marshalling to ClearScript. Thanks!

    0 0

    Thanks. Is there nightly builds of the ClearScript?

    0 0

    Added null and decimal marshaling options to WindowsScriptEngine.

    0 0

    Hi Igor,

    Is there nightly builds of the ClearScript?

    No, but we just posted a source code update that includes the new marshaling options. If you get a chance, please give them a try and let us know if they work for you.

    Thanks again!

    0 0

    Hi,

    It's work. Thanks a lot.
    If you have some progress with cloning of script engine, please update the source code. I use with source code of script engine and have modified version of the ClearScript.

    0 0

    Small question about setting global variables.
    Suppose I have following script that has account variable.
    dim account
    
    function GetAccountName()
    GetAccountName = account.Name;
    end function
    What is "true" way set this variable by reference?

    Thanks

    0 0

    Hello!

    Is there any plan to have more seamless exception handling between .NET and JS, even for V8 only?

    Currently there's no plan beyond adding a script-callable tryCatch() function on the host side. Generally we favor keeping the engine APIs uniform, but we agree that this may be worth doing anyway, so we've put it on our long-term to-do list.

    Thanks for your input!

    0 0

    Greetings!

    What is "true" way set this variable by reference?

    Sorry, please clarify. Are you asking how to set the account variable from the host?

    0 0

    Yes, that should be similar to
    set account = hostObject
    but not
    account = hostObject

    0 0

    Hi,
    I have following simple code. It works fine with MSScriptControl, but using VBScriptEngine it doesen't work:
        private void btnExecuteScript_Click(object sender, EventArgs e)
        {
            try
            {
                using (ScriptEngine engine = new VBScriptEngine())
                {
                    object[] array = new object[] { 1, 2, 3 };
                    engine.AddHostObject("arr", array);
                    var value = (string)engine.Evaluate("arr(1) = 1");  
                    MessageBox.Show(value.ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    
    Error message is: "Object does not support the requested invocation operation"

    I'm new to clearscript. What i#m doing wrong?

    Best regards
    nbgedo

older | 1 | .... | 26 | 27 | (Page 28) | 29 | 30 | .... | 115 | newer