![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I decided to try writing a scripting engine in C#. I've written some code, put in the annotations for ComInterop, added the regsitry settings and it *almost* works. CScript, WScript, and IE can all find the script engine and call the first few methods correctly. It is clear that they are correctly getting a hold of both the IActiveScript and IActiveScriptParse interfaces. But after the first few method calls, they all quit. CScript raises this error: CScript Error: Can't find script engine "LScript" for script "hello.ls". WScript raises an analagous error, and IE calls InitNew, SetScriptSite, GetScriptState, SetScriptState, and Close. None of the hosts seem to call AddNamedItem, which is what I expect would be next. When I write my own scripting host in C++, there is no problem --- everything works just fine. Anyone have any suggestions? |
#3
| |||
| |||
|
|
I decided to try writing a scripting engine in C#. When I write my own scripting host in C++, there is no problem --- everything works just fine. |
#4
| |||
| |||
|
|
I decided to try writing a scripting engine in C#. When I write my own scripting host in C++, there is no problem --- everything works just fine. So why would you try to do it in C#, adding up to 100 MB of dependencies and slowing down script even worse than it is already? One doesn't write a script enigine in .Net for the same reason that one doesn't write most desktop software, drivers, disk uitilities, etc. in .Net or Java: It's slow, uncompiled, and once removed from the API. It's software running software running software. |
#5
| |||
| |||
|
|
Well, PowerShell is a pretty nice scripting engine and it's written in C#. That 100MB of dependencies includes some very useful stuff. |

#6
| ||||
| ||||
|
| Well, PowerShell is a pretty nice scripting engine and it's written in C#. That 100MB of dependencies includes some very useful stuff. Are you sure it's not actually written in C++? I know the "cmdlets" are .Net classes, but I would guess that the shell itself is actual compiled software. |
|
I don't know much about Powershell, as it requires XP SP2, .Net 2.0, and also requires submitting to the installation of the WGA spyware. So far I haven't had any reason to deal with any of those things. I guess that Powershell must have some useful things for network administrators, but frankly I'm baffled at why any significant number of people would actually want to revert to the primitive inconvenience of a DOS/UNIX-style command line interface. (That's what I'm waiting for Linux to outgrow. ![]() Especially when it involves so many limitations and dependencies, and also involves learning yet again another new syntax and set of keywords. Maybe it's nostalgia? Maybe people just feel like they're running "close to the metal" when they type abstruse commands into black windows? |
|
And you yourself are running on Vista. You've paid an extra $300+- to get 3-D techno-kitsch graphics on your Desktop, yet you prefer to work out of a terminal window? I don't get it. |
|
In any case, creating "DOS 2.0" as a set of something akin to Java applets doesn't strike me as a particularly clever design. |
#7
| |||
| |||
|
|
I decided to try writing a scripting engine in C#. I've written some code, put in the annotations for ComInterop, added the regsitry settings and it *almost* works. CScript, WScript, and IE can all find the script engine and call the first few methods correctly. It is clear that they are correctly getting a hold of both the IActiveScript and IActiveScriptParse interfaces. But after the first few method calls, they all quit. CScript raises this error: CScript Error: Can't find script engine "LScript" for script "hello.ls". WScript raises an analagous error, and IE calls InitNew, SetScriptSite, GetScriptState, SetScriptState, and Close. None of the hosts seem to call AddNamedItem, which is what I expect would be next. When I write my own scripting host in C++, there is no problem --- everything works just fine. Anyone have any suggestions? |
#8
| |||
| |||
|
|
On Sep 10, 3:40 pm, eval.ap... (AT) gmail (DOT) com wrote: I decided to try writing a scripting engine in C#. I've written some code, put in the annotations for ComInterop, added the regsitry settings and it *almost* works. CScript, WScript, and IE can all find the script engine and call the first few methods correctly. It is clear that they are correctly getting a hold of both the IActiveScript and IActiveScriptParse interfaces. But after the first few method calls, they all quit. CScript raises this error: CScript Error: Can't find script engine "LScript" for script "hello.ls". WScript raises an analagous error, and IE calls InitNew, SetScriptSite, GetScriptState, SetScriptState, and Close. None of the hosts seem to call AddNamedItem, which is what I expect would be next. When I write my own scripting host in C++, there is no problem --- everything works just fine. Anyone have any suggestions? I'm not quite sure what you're doing, but I'll throw in my two cents. 1. First off, yes you can create a scripting engine in C#. I've even seen some incomplete examples on the web for just this, though I don't remember the sites. Since you can multithread in C#, you should also be able to integrate the IActiveScriptDebug interfaces as well. 2. If you have the engine already built in C++ why not just make this an OLE object and use this from your C#. 3. There is a lot of negative issues with the script engine - its depracating technology and any .NET objects passed to the script need to be visible via COM interop. 4. A better scripting solution would be to just use the .NET designer/ compilation objects provided in the framework to create true .NET code and execute that. 5. If you're die-hard set to use a scripting engine I'd purchase one - several are available. The one I wrote is available atwww.orangesoftwaredesigns.com, though I've not got the site completed yet - I've only recently decided to start selling the engine. Let me know if you're interested in that option.- Hide quoted text - - Show quoted text - |
#9
| |||
| |||
|
|
On Sep 19, 8:53 am, Ken Foust <ken_fo... (AT) hotmail (DOT) com> wrote: On Sep 10, 3:40 pm, eval.ap... (AT) gmail (DOT) com wrote: I decided to try writing a scripting engine in C#. I've written some code, put in the annotations for ComInterop, added the regsitry settings and it *almost* works. CScript, WScript, and IE can all find the script engine and call the first few methods correctly. It is clear that they are correctly getting a hold of both the IActiveScript and IActiveScriptParse interfaces. But after the first few method calls, they all quit. CScript raises this error: CScript Error: Can't find script engine "LScript" for script "hello.ls". WScript raises an analagous error, and IE calls InitNew, SetScriptSite, GetScriptState, SetScriptState, and Close. None of the hosts seem to call AddNamedItem, which is what I expect would be next. When I write my own scripting host in C++, there is no problem --- everything works just fine. Anyone have any suggestions? I'm not quite sure what you're doing, but I'll throw in my two cents. 1. First off, yes you can create a scripting engine in C#. I've even seen some incomplete examples on the web for just this, though I don't remember the sites. Since you can multithread in C#, you should also be able to integrate the IActiveScriptDebug interfaces as well. 2. If you have the engine already built in C++ why not just make this an OLE object and use this from your C#. 3. There is a lot of negative issues with the script engine - its depracating technology and any .NET objects passed to the script need to be visible via COM interop. 4. A better scripting solution would be to just use the .NET designer/ compilation objects provided in the framework to create true .NET code and execute that. 5. If you're die-hard set to use a scripting engine I'd purchase one - several are available. The one I wrote is available atwww.orangesoftwaredesigns.com, though I've not got the site completed yet - I've only recently decided to start selling the engine. Let me know if you're interested in that option.- Hide quoted text - - Show quoted text - For examples that work Google the following: C# Script, Dot Net Script, NScript. Or you could just go to www.codeproject.com. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |