// script "ironpython.cs" /*/ r Libraries\IronPython.dll; r Libraries\Microsoft.Scripting.dll; r Libraries\Microsoft.Dynamic.dll; /*/ //.
using Au; using System; using Microsoft.Scripting.Hosting;
partial class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args) { //;;;
// script "" /*/ r Libraries\IronPython.dll; r Libraries\Microsoft.Scripting.dll; r Libraries\Microsoft.Dynamic.dll; /*/ //.
using Au; using System; using Microsoft.Scripting.Hosting;
partial class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args) { //;;;
// script "ipy_code2.cs" /*/ r Libraries\IronPython.dll; r Libraries\Microsoft.Scripting.dll; r Libraries\Microsoft.Dynamic.dll; /*/ //.
using Au; using System; using Microsoft.Scripting.Hosting;
using System.Collections.Generic;
partial class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args) { //;;;
AOutput.RedirectConsoleOutput=true;
// Now modify the search paths to include the directory from
// which we execute the script
searchPaths.Add("..\\..");
pythonEngine.SetSearchPaths(searchPaths);
// Execute the script
// We execute this script from Visual Studio so the program will executed from bin\Debug or bin\Release
Microsoft.Scripting.Hosting.ScriptSource pythonScript = pythonEngine.CreateScriptSourceFromFile("..\\..\\HelloWorld.py");
pythonScript.Execute();
}
}
Found a small problem, com lists, if do not select item, can not close it
I found the file path:
C:\Users\Administrator\Documents\Aedit\Main\files
// script "ipy_code3.cs" /*/ r Libraries\IronPython.dll; r Libraries\Microsoft.Scripting.dll; r Libraries\Microsoft.Dynamic.dll; /*/ //.
using Au; using System; using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
using System.Collections.Generic;
using System.Linq;
partial class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args) { //;;;
AOutput.RedirectConsoleOutput=true;
source.Execute(scope); // class object created
object classObject = scope.GetVariable("MyClass"); // get the class object
object instance = op.Invoke(classObject); // create the instance
object method = op.GetMember(instance, "myMethod"); // get a method
List<string> result = ((IList<object>)op.Invoke(method)).Cast<string>().ToList();
// script "ipy_code3.cs" /*/ r Libraries\IronPython.dll; r Libraries\Microsoft.Scripting.dll; r Libraries\Microsoft.Dynamic.dll; /*/ //.
using Au; using System; using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
using System.Collections.Generic;
using System.Linq;
partial class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args) { //;;;
AOutput.RedirectConsoleOutput=true;
source.Execute(scope); // class object created
object classObject = scope.GetVariable("MyClass"); // get the class object
object instance = op.Invoke(classObject); // create the instance
object method = op.GetMember(instance, "myMethod"); // get a method
List<string> result = ((IList<object>)op.Invoke(method)).Cast<string>().ToList();
// script "ipy_code3.cs" /*/ r Libraries\IronPython.dll; r Libraries\Microsoft.Scripting.dll; r Libraries\Microsoft.Dynamic.dll; /*/ //.
using Au; using System; using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
using System.Collections.Generic;
using System.Linq;
partial class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args) { //;;;
AOutput.RedirectConsoleOutput=true;
source.Execute(scope); // class object created
object classObject = scope.GetVariable("MyClass"); // get the class object
object instance = op.Invoke(classObject); // create the instance
object method = op.GetMember(instance, "myMethod"); // get a method
List<string> result = ((IList<object>)op.Invoke(method)).Cast<string>().ToList();
AOutput.Write(result);
}
/// <summary>
/// Gets full path of caller's C# source file.
/// </summary>
/// <param name="f">Don't use.</param>
public static string ScriptFile([System.Runtime.CompilerServices.CallerFilePath] string f = null) => f;
/// <summary>
/// Gets filename of caller's C# source file.
/// </summary>
/// <param name="f">Don't use.</param>
public static string ScriptFilename([System.Runtime.CompilerServices.CallerFilePath] string f = null) => APath.GetName(f);
/// <summary>
/// Gets folder path of caller's C# source file.
/// </summary>
/// <param name="f">Don't use.</param>
public static string ScriptFolder([System.Runtime.CompilerServices.CallerFilePath] string f = null) => APath.GetDirectory(f);
}
// script "ipy_code3.cs" /*/ r Libraries\IronPython.dll; r Libraries\Microsoft.Scripting.dll; r Libraries\Microsoft.Dynamic.dll; resource script.py /string; /*/ //.
using Au; using System; using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
using System.Collections.Generic;
using System.Linq;
partial class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args) { //;;;
AOutput.RedirectConsoleOutput=true;
source.Execute(scope); // class object created
object classObject = scope.GetVariable("MyClass"); // get the class object
object instance = op.Invoke(classObject); // create the instance
object method = op.GetMember(instance, "myMethod"); // get a method
List<string> result = ((IList<object>)op.Invoke(method)).Cast<string>().ToList();