Quantcast
Channel: ClearScript
Viewing all 2297 articles
Browse latest View live

New Post: Decimal values problems

$
0
0
Using of CurrencyWrapper resolve this issue.

New Post: Decimal values problems

$
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!

New Post: Problem with nullable property of object

$
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!

New Post: Decimal values problems

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

New Post: Problem with nullable property of object

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

New Post: Decimal values problems

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

New Post: Problem with nullable property of object

$
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.

New Post: Problem with nullable property of object


New Post: Decimal values problems

New Post: Problem with nullable property of object

$
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!

New Post: Decimal values problems

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

New Post: Problem with nullable property of object

$
0
0
Thanks. Is there nightly builds of the ClearScript?

Source code checked in, #7df5fa298b6449386dc0beace2f87f789118b476

$
0
0
Added null and decimal marshaling options to WindowsScriptEngine.

New Post: Problem with nullable property of object

$
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!

New Post: Problem with nullable property of object

$
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.

New Post: Parent-child script relation

$
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

New Post: Getting JS exception

$
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!

New Post: Parent-child script relation

$
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?

New Post: Parent-child script relation

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

New Post: Problem dealing with arrays in VBScript

$
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
Viewing all 2297 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>