Quantcast
Channel: ClearScript
Browsing all 2297 articles
Browse latest View live
↧

New Post: add function to scriptengine

thanks but it desnt work correctly. i use this:var mf = new MethodFunc(me.Invoke); se.AddHostObject(mi.Name, mf);it throws an Comexception when i run the script who is calling the function via:var host...

View Article


New Post: add function to scriptengine

Hi again, Can you provide more information? The two code blocks above appear to be unrelated, with several variables that aren't defined anywhere (mi, func, p). If you could post a complete test...

View Article


New Post: add function to scriptengine

publicstaticclass ModuleLoader { publicdelegateobject MethodFunc(object target, paramsobject[] args); publicstaticvoid Load(WindowsScriptEngine se, Type t) { var ca =...

View Article

New Post: add function to scriptengine

It looks like ModuleLoader is designed to install functions and other data into a script engine, but how are you using it? If possible, please post the code that actually executes script code and...

View Article

New Post: add function to scriptengine

ModuleLoader.Load(se, Assembly.LoadFile(Application.StartupPath + "\\Std.dll")); se.Evaluate(File.ReadAllText(p)) var fs = PluginLoader.Call("init"); // run init function who run the imported function

View Article


New Post: add function to scriptengine

Unfortunately we can't help you without knowing more about the contents of Std.dll, the script code being executed, PluginLoader, the "init function", the exception stack and message, etc. If you'd...

View Article

New Post: add function to scriptengine

i thin the problem is the delegate. i want to call the delegate myfunc(object,params) as filesize("filename")

View Article

New Post: add function to scriptengine

Can you post the definition of the .NET method you're calling from script code? The method signature should be enough.

View Article


New Post: add function to scriptengine

[ScriptFunction(Name = "filesize")] publicint FileSize(string filename)

View Article


New Post: add function to scriptengine

OK, thanks. Note that this is an instance method (as opposed to a static method), so it requires a target (a this reference). When script code calls this method, what should the target be? There are...

View Article

New Post: add function to scriptengine

i changed all methods to static but now i have a new exception: object expected *ive steped through the code, the functions are not added. there are static in the signature but in reflection is...

View Article

New Post: add function to scriptengine

i want to know both

View Article

New Post: add function to scriptengine

In JScript, "Object expected" can indicate an attempt to call an undefined function. This seems likely given your statement that "the functions are not added". Can you confirm that? As for why you...

View Article


New Post: Global camel case support

+1 for this feature (different cases would confuse any users who are editing scripts and do not have a lot of experience with many languages). It would also be nice to have options for blocking all...

View Article

New Post: add function to scriptengine

thanks i forgot to rebuild, but i have the same error like first: The type must be inferred from the delegate se.AddHostObject(meca.Name != null ? meca.Name : me.Name, me.CreateDelegate(t));

View Article


New Post: add function to scriptengine

Right, that won't work, assuming your code is as you posted it earlier. If me represents a static method, first declare an appropriate delegate type:publicdelegateobject StaticMethodFunc(paramsobject[]...

View Article

New Post: add function to scriptengine

thanks it works

View Article


New Post: add function to scriptengine

Glad to hear it, thanks!

View Article

New Post: Passing Action/Func into JS?

I am trying to pass a C# delegate/Func/Action as a parameter to a Javascript function (on('event',handler)). Right now, the thing that shows up in the JS side is not a function. What is the expected...

View Article

New Post: Passing Action/Func into JS?

Hello! What you're doing should work. The delegate may not appear to be a JavaScript function (that is, the typeof operator would return "object" rather than "function"), but it should be invocable...

View Article
Browsing all 2297 articles
Browse latest View live


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