Script Region - Extends SMath Studio with a Script Region (c#, vb.net, python) - Messages
#21 Posted: 7/18/2018 2:46:46 PM
Updated. System.Diagnostics namespace added.
Script.Process.sm (4 KiB) downloaded 165 time(s).

Script.Process.sm (4 KiB) downloaded 165 time(s).
@echo off
echo Hello
exit
// Create a new process object.
var info = new ProcessStartInfo
{
// StartInfo contains the startup information of the new process.
FileName = @"cmd.exe ",
Arguments = @"/c c:\temp\run.cmd",
WorkingDirectory = Directory.GetCurrentDirectory(),
// These two optional flags ensure that no DOS window appears.
UseShellExecute = false,
CreateNoWindow = true,
// If this option is set the DOS window appears again :-/
// ProcessObj.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// This ensures that you get the output from the DOS application.
RedirectStandardOutput = true,
RedirectStandardInput = true,
RedirectStandardError = true
};
// Start the process.
using ( var process = Process.Start( info ) )
{
var output = process.StandardOutput.ReadToEnd();
var err = process.StandardError.ReadToEnd();
store.TraceData( output );
if ( err.Length > 0 ) store.TraceData( err );
// Wait that the process exits.
process.WaitForExit();
}
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
frapuano 7/18/2018 5:17:00 PM
#22 Posted: 8/15/2018 1:53:00 AM
Вячеслав благодарю за Скрипт регион. Этот инструмент делает возможности СМат Студии практически безграничными. Немного программирую на Python. Я так понимаю, что в Script Region используется
IronPython?
IronPython?
#23 Posted: 8/15/2018 4:32:44 AM
Да, используется IronPython.
Russia ☭ forever, Viacheslav N. Mezentsev
#24 Posted: 9/17/2018 12:22:21 AM
Updated.
- input placeholder removed;
- terms variable removed;
- SMath.Controls assembly added.
- input placeholder removed;
- terms variable removed;
- SMath.Controls assembly added.
Russia ☭ forever, Viacheslav N. Mezentsev
#25 Posted: 9/18/2018 10:26:21 AM
Updated. Version 0.2.x.x.
Changes:
- xml serialization format changed;
- reworked.
Old versions of the plugin will not be able to open files of a new format.
Disabled until the better implementation.
Changes:
- xml serialization format changed;
- reworked.
Old versions of the plugin will not be able to open files of a new format.
WroteYou can change font with mouse wheel and Control key when region selected.
Disabled until the better implementation.
Russia ☭ forever, Viacheslav N. Mezentsev
#26 Posted: 10/10/2018 5:36:37 PM
Hi,
With the last changes in the plugin, this simple script to get the filename of the current worksheet stop working:
The original question, and the script to get the filename its from this post:
https://en.smath.info/forum/yaf_postsm39408_MathcadFileAccess.aspx#post39408
Thanks for your help!
With the last changes in the plugin, this simple script to get the filename of the current worksheet stop working:
store.AddDefinition( terms[0].Text, new Term[0], new Entry( "\"" + store.FileName + "\"" ) );
The original question, and the script to get the filename its from this post:
https://en.smath.info/forum/yaf_postsm39408_MathcadFileAccess.aspx#post39408
Thanks for your help!
#27 Posted: 10/11/2018 3:54:40 AM
#28 Posted: 10/12/2018 12:35:58 PM
Thanks Uni! That change did the trick
#29 Posted: 11/14/2019 2:04:35 AM
I want to show you a video about the operation of the Script Region plugin
1 users liked this post
Вячеслав Мезенцев 11/14/2019 7:07:00 AM
#30 Posted: 3/4/2021 6:56:16 PM
What happened to this plugin? Seems like it had a lot of potential.
#31 Posted: 3/5/2021 1:03:05 AM
I don't have time to finalize his code editor. Now it is inconvenient to use it.
Russia ☭ forever, Viacheslav N. Mezentsev
#32 Posted: 3/8/2021 8:54:24 AM
Hi, uni!
I'm wondering if the script region for VB would allow me to access a COM engine.
I'm trying to use Autodesk Robot via SMath thorugh its API.
Is there any chance of success in this endeavour?
A simple example of what I've got:
Imports System
Imports RobotOM
Module Program
Sub Main()
Dim robapp As IRobotApplication
robapp = New RobotApplication
robapp.Project.CalcEngine.Calculate()
robapp.Project.Close()
robapp = Nothing
End Sub
End Module
I'm wondering if the script region for VB would allow me to access a COM engine.
I'm trying to use Autodesk Robot via SMath thorugh its API.
Is there any chance of success in this endeavour?
A simple example of what I've got:
Imports System
Imports RobotOM
Module Program
Sub Main()
Dim robapp As IRobotApplication
robapp = New RobotApplication
robapp.Project.CalcEngine.Calculate()
robapp.Project.Close()
robapp = Nothing
End Sub
End Module
#33 Posted: 3/8/2021 9:11:50 AM
As far as I know, there are theoretically no restrictions of any kind. But practically in the plugin code the list of used libraries is strictly specified. In order to use COM-objects, the text of the program is not enough. It is necessary to make it clear to the linker what this program is composed of. Therefore, it will definitely not work now, since even the import directive is not supported.
I can expand the script format like Jon Skeet did. I didn't find an example, but he suggested splitting the code into two parts: a header and a script. Three dots are used as a separator. The header consists of an import list. This list can be used to partially restore dependencies.
In general, it is possible to modify the plugin to do this kind of thing. But I have my own job and it is difficult for me to make significant changes in the existing code.
I can expand the script format like Jon Skeet did. I didn't find an example, but he suggested splitting the code into two parts: a header and a script. Three dots are used as a separator. The header consists of an import list. This list can be used to partially restore dependencies.
In general, it is possible to modify the plugin to do this kind of thing. But I have my own job and it is difficult for me to make significant changes in the existing code.
Russia ☭ forever, Viacheslav N. Mezentsev
#34 Posted: 3/8/2021 3:33:46 PM
Thanks for your reply, uni
I totally understand. I'll probably need to use the API via Excel then.
I totally understand. I'll probably need to use the API via Excel then.
#36 Posted: 11/30/2022 11:46:58 AM
#37 Posted: 12/2/2022 5:06:36 AM
The problem appeared, but its cause is not yet clear. I'll let you know when it's resolved.
Russia ☭ forever, Viacheslav N. Mezentsev
#38 Posted: 12/2/2022 1:41:05 PM
Viacheslav,
I was developing an plugin between v1.0 and v0.99 and while my plugin 'worked,' I noticed my region interfered with the graphics (local version, in debug mode), that is the graphics fail to print (and sometimes load) when the region was processed/drawn. I had to reference the version specific *.dlls and that solved my problem. As such, I also noticed that some of the properties/classes changed ever so slightly (not enough to fail a compile, but enough to interfere with operations).
I didn't document this in detail though. I'm just wondering if you have some elements tied to the v0.99- that the v1.00+ no longer implements.
This is an amazing tool; thank you for developing it and I hope you are able to restore its functionality!
-Kenny Lemens, P.E. ᵂᴵ
I was developing an plugin between v1.0 and v0.99 and while my plugin 'worked,' I noticed my region interfered with the graphics (local version, in debug mode), that is the graphics fail to print (and sometimes load) when the region was processed/drawn. I had to reference the version specific *.dlls and that solved my problem. As such, I also noticed that some of the properties/classes changed ever so slightly (not enough to fail a compile, but enough to interfere with operations).
I didn't document this in detail though. I'm just wondering if you have some elements tied to the v0.99- that the v1.00+ no longer implements.
This is an amazing tool; thank you for developing it and I hope you are able to restore its functionality!
-Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
#39 Posted: 9/15/2024 2:40:31 AM
Is there any plan to implement this plugin in Linux? For instance I have some chemical engineering python libraries & during calculation data exchange between SMath & terminal will be of great value.
#40 Posted: 9/16/2024 1:30:39 AM
I need to rewrite the code editor, the problem is in its use or I need to replace it with another one. This is a complex job requiring great attention to detail.
Using the built-in programming language in the document has not been needed by many people yet. I postponed the implementation until better times.
Using the built-in programming language in the document has not been needed by many people yet. I postponed the implementation until better times.
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Oscar Campo 9/18/2024 10:49:00 PM
-
New Posts
-
No New Posts