-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nothing #106
Comments
Hi Nick, That's correct. ClearScript marshals If passing Good luck! |
Hi, Thanks for getting back to me. I've already worked round it, but wanted to check that I wasn't missing something. As you state, VBScript supports 'Nothing'. Thanks again. :) |
No problem at all! Please reopen this issue if you have more questions on this topic. |
Hi, I have a Host method that returns nothing in some instances and a COM object in others. I would like to trap for the value returned to check if it is valid. With EnableNullResultWrapping set to false, the VB script throws an error 'Object Required'. With EnableNullResultWrapping set to true, the function succeeds but I am unable to check whether the value is null or not. Set obj = MyHostObject.GetCOMObject() If IsNull(obj) then IsNull never seems to return true, even thought obj is nothing. BTW I have also added a Host object instance. scriptEngine.AddHostObject("host", HostItemFlags.GlobalMembers, New HostFunctions()) Any help would be appreciated. Thanks |
Hi Nick, You can make one of two changes to get the desired behavior:
Good luck! |
Thanks for the reply. Thanks :-) |
It's VBScript that executes script code, not ClearScript. The Unfortunately things get murkier with .NET in the mix. As marshaled by ClearScript, most .NET objects can be used with both normal and To help resolve this we've added things like
Apparently not, as VBScript doesn't seem to allow hosts to override its built-in Good luck! |
Thanks for the detailed explanation :-) |
The next ClearScript release will allow .NET methods and properties to explicitly return the value |
That's great news. Would it also be possible to support the Nothing keyword in VBScript? At the moment Null appears to be the closest match. When can we expect the next release? Thanks |
Hi Nick, VBScript is supported in its entirety today, including the If script code passes On the other hand, it is possible for the host to pass In ClearScript 5.5.6 you'll be able to use something like ClearScript 5.5.6 should be out within several weeks. Good luck! |
Thanks, I have noticed that passing Null from script to a host method appears to work. Where as Nothing does not... |
Version 5.5.6 includes the |
Brilliant, that's great news. Thank you :-) |
When a VB.NET method returns Nothing, should Given the following code:
If I Execute
|
VB.NET's However, you can get the behavior you're looking for by passing Good luck! |
This saves me a lot work, thanks for your help! |
This is still the case with version 7.3.0 correct? I am getting the following exception, which is consistent with your statement:
This is something that is possible with the MSScriptControl though. |
Hello @EtienneLaneville,
VBScript and .NET behave as before, but some clarification might be helpful. Here's how VBScript's special values are handled as they move from script code to the host application:
You can change
Please clarify. What doesn't work as you expect with ClearScript? Thanks! |
That table was very helpful. I have set |
Hello,
I am using the VB Script engine and am trying to pass Nothing (Null) to one of the functions in an exposed host object. However it appears as Nothing is undefined?
m_scriptEngine.script.nothing = {[undefined]}
How to resolve this?
Many Thanks
Nick
The text was updated successfully, but these errors were encountered: