Hello,
First: let me say that is impressive what the script compiler can do!
I have a few question about the new scripting support in X#:
- can we distribute the script compiler with our applications? Or move it even to other systems? What is the license of the script compiler?
- is it possible to embed the script compiler in our applications? This could be important because then scripts can be executed in the context of our program, using all classes and methods defined there.
- is there any documentation available?
Thank you very much!
Wolfgang
X# Scripting question
X# Scripting question
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
X# Scripting question
Wolfgang,
Valid questions.
1) Look at the "c:Program Files (x86)XSharpRedistRedist.txt"
It states that you can distribute the files
- Xsi.exe
- XSharp.Scripting.dll
- XSharp.CodeAnalysis.dll
and the support files (which are from Microsoft)
2) You can embed the scripting in your apps. The XIDE folder in the Scripting Examples folder shows many examples on how to do that
3) At this moment the docs are limited. Look at https://www.xsharp.eu/help/x-scripting.html for the text from the slides of the session that Nikos did in Cologne.
You can also look at the C# Roslyn scripting API examples on https://github.com/dotnet/roslyn/wiki/Scripting-API-Samples.
Our scripting is based on the same api. The only difference are the namespaces.
Where the C# examples require
we require
Robert
Valid questions.
1) Look at the "c:Program Files (x86)XSharpRedistRedist.txt"
It states that you can distribute the files
- Xsi.exe
- XSharp.Scripting.dll
- XSharp.CodeAnalysis.dll
and the support files (which are from Microsoft)
2) You can embed the scripting in your apps. The XIDE folder in the Scripting Examples folder shows many examples on how to do that
3) At this moment the docs are limited. Look at https://www.xsharp.eu/help/x-scripting.html for the text from the slides of the session that Nikos did in Cologne.
You can also look at the C# Roslyn scripting API examples on https://github.com/dotnet/roslyn/wiki/Scripting-API-Samples.
Our scripting is based on the same api. The only difference are the namespaces.
Where the C# examples require
Code: Select all
using Microsoft.CodeAnalysis.CSharp.Scripting
using Microsoft.CodeAnalysis.Scripting
Code: Select all
USING LanguageService.CodeAnalysis.Scripting
USING LanguageService.CodeAnalysis.XSharp.Scripting
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
X# Scripting question
Hi Robert,
thank you for pointing me to the help page - I hadn't searched there.
What you have accomplished with scripting is really great - I see a lot of things I can do with it (I have worked a lot with VOScript in the past).
Wolfgang
thank you for pointing me to the help page - I hadn't searched there.
What you have accomplished with scripting is really great - I see a lot of things I can do with it (I have worked a lot with VOScript in the past).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
X# Scripting question
Hi,
I'm trying to integrate scripting in my program. I need to evaluate simple expressions like
but I cannot even evaluate an expression like
This is my code:
(of course in a try/catch block!)
But it gives me an exception Can you give me an hint, please?
You can also find a viaef file of the application attached to this message.
Thank you very much!
Wolfgang
P.S. I need this in my Door Configurator and I would not add any dependency on Vulcan on this Core application
I'm trying to integrate scripting in my program. I need to evaluate simple expressions like
Code: Select all
length * price
Code: Select all
3 + 4
Code: Select all
method Process( cScriptCode as string ) as string
local cReturn as string
local oReturn as object
cReturn := ""
oReturn := XSharpScript.EvaluateAsync( cScriptCode, ScriptOptions.Default, _oParameters )
cReturn := oReturn:ToString()
return cReturn
But it gives me an exception Can you give me an hint, please?
You can also find a viaef file of the application attached to this message.
Thank you very much!
Wolfgang
P.S. I need this in my Door Configurator and I would not add any dependency on Vulcan on this Core application
- Attachments
-
- ScriptTest.zip
- (3.24 KiB) Downloaded 65 times
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
X# Scripting question
Sorry, no hint, but a confirmation
Karl
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
X# Scripting question
Hi Karl,
do you have played with this or only used my code?
I have now found an alternative tool:
https://ncalc.codeplex.com/releases/view/73656
And it seems to do what I need, had only to rebuild it for .NET 4.
Took me about 5 minutes to make it work.
Wolfgang
do you have played with this or only used my code?
I have now found an alternative tool:
https://ncalc.codeplex.com/releases/view/73656
And it seems to do what I need, had only to rebuild it for .NET 4.
Took me about 5 minutes to make it work.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
X# Scripting question
Hi Karl,
if you like playing with it a bit: please find attached a working sample.
Wolfgang
if you like playing with it a bit: please find attached a working sample.
Wolfgang
- Attachments
-
- ScriptTest_ncalc.zip
- (109.99 KiB) Downloaded 62 times
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
X# Scripting question
Played with your code, pure curiosity
Confirm, that the ncalc tool works. But would like to see, where the error in your first version comes from...
K.
Confirm, that the ncalc tool works. But would like to see, where the error in your first version comes from...
K.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
X# Scripting question
Hi Karl,
since I need a solution today, I'll go the NCalc route. But of course I would prefer the X# scripting engine...
Maybe I can replace NCalc later. It is interesting to see that it uses Antlr like the X# compiler and the Vulcan compiler.
Wolfgang
since I need a solution today, I'll go the NCalc route. But of course I would prefer the X# scripting engine...
Maybe I can replace NCalc later. It is interesting to see that it uses Antlr like the X# compiler and the Vulcan compiler.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
X# Scripting question
Hi Wolfgang,
I saw the same problem with your app, checked what's different with the samples I have from Nikos' session in Cologne and found out that you need to include a .exe.config file like the attached one.
This will take care of the problem loading the .dll, but now I see some other runtime issues with the newest x# dlls, while it worked ok with a previous version. We'll look into this ASAP.
Chris
I saw the same problem with your app, checked what's different with the samples I have from Nikos' session in Cologne and found out that you need to include a .exe.config file like the attached one.
This will take care of the problem loading the .dll, but now I see some other runtime issues with the newest x# dlls, while it worked ok with a previous version. We'll look into this ASAP.
Chris
- Attachments
-
- execonfig.zip
- (504 Bytes) Downloaded 63 times
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu