Как написать скрипт

Как написать скрипт - Messages

#1 Posted: 1/23/2017 11:54:20 AM
Krid

Krid

0 likes in 16 posts.

Group: User

Собственно несколько вопросов, как:
1. Написать скрипт
2. Внутри тела скрипта использовать переменные Smath
3. Запускать скрипт по кнопке из exe представления Smath

Код на C# - примерный

using Kompas6API7;
using System.Runtime.InteropServices;
  
         
 try
            {
                    Kompas6API7.IApplication kompas = (_Application)Marshal.GetActiveObject("KOMPAS.Application.7";
                    IKompasDocument doc =  kompas.App.Documents.Open("test", true, true);
                    IKompasDocument3D doc3D = kompas.App.ActiveDocument as IKompasDocument3D;

                    doc.Close(DocumentCloseOptions.kdDoNotSaveChanges);
                    doc3D.Close()

            }
            catch (Exception)
            {
                kompas = null;


            }
kompas = null;

С уважением!
#2 Posted: 1/24/2017 7:46:37 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Hello [userlink]Kriss[/userlink],

It might worth the effort to take a look at the code of existing plugins in our SVN. Some of them:

File import/export/read/save:
- ExcelFileType, XMCDFileType, XlsxImportExport,DataExchange;

Communication between applications:
- XLSXupdate (this is written in VB.NET), Maxima;

Database:
- SQLite;
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 1/24/2017 11:51:37 AM
Krid

Krid

0 likes in 16 posts.

Group: User

Hello [userlink]Davide Carpi[/userlink]

Thanks for the reply.

I'll try workarounds,
if that happen I will try to put.
#4 Posted: 1/24/2017 12:34:47 PM
Krid

Krid

0 likes in 16 posts.

Group: User

Arose fair question.

How to close the Preview window (*.exe file)
after clicking links

explanation
#5 Posted: 1/25/2017 6:44:01 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

Show Spoiler



I guess it is the hyperlink region.

Alignment feature of hyperlinks is not available; I'll take a look on it when possible.

I'm not able to reproduce the 2nd issue, anyone else experienced this?
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#6 Posted: 1/25/2017 12:02:24 PM
Krid

Krid

0 likes in 16 posts.

Group: User

Hello Davide Carpi

I decided to use Smath Studio (Smath Viewer) as form to enter and calculate data.
The user then presses the Start button (as shown in the picture) and then start my program.
So I would like not to confuse the user and close the data entry form, ie Smath Viewer (executable file *.exe)

With best wishes
#7 Posted: 1/25/2017 12:19:06 PM
Krid

Krid

0 likes in 16 posts.

Group: User

And another question

since You are a developer Hyperlink Region

It is possible to expand the possibilities of this Extensions:
Add command-line arguments when you start the program

For example:
"CalcMass.exe - ExchangeData.ods"
#8 Posted: 1/25/2017 1:25:13 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

Hello Davide Carpi

I decided to use Smath Studio (Smath Viewer) as form to enter and calculate data.
The user then presses the Start button (as shown in the picture) and then start my program.
So I would like not to confuse the user and close the data entry form, ie Smath Viewer (executable file *.exe)

With best wishes


Ah, ok!

Sometimes is not possible to close the viewer because internal exceptions, so I've thought about a bug.

I'll check if there is a safe way to kill the application within the hyperlink.
You can always add a text to ask the users that after clicking the link they can safely close the program.

Wrote

It is possible to expand the possibilities of this Extensions:
Add command-line arguments when you start the program

For example:
"CalcMass.exe - ExchangeData.ods"



You already can; right click on the region, choose "Flags..." from the context menu, and then add the arguments you need.

2017-01-25 17_25_33-SMath Studio - [Page1_].png

2017-01-25 17_21_08-SMath Studio - [Page1_].png

2017-01-25 17_24_10-SMath Studio - [Page1_].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#9 Posted: 1/25/2017 1:49:07 PM
Krid

Krid

0 likes in 16 posts.

Group: User

Thank you very much
Really works with the flags
  • New Posts New Posts
  • No New Posts No New Posts