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

Как написать скрипт - 消息

#1 已发布: 2017/1/23 11:54:20
Krid

Krid

0个赞,共16个帖子。

组: 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 已发布: 2017/1/24 07:46:37
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: 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 已发布: 2017/1/24 11:51:37
Krid

Krid

0个赞,共16个帖子。

组: User

Hello [userlink]Davide Carpi[/userlink]

Thanks for the reply.

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

Krid

0个赞,共16个帖子。

组: User

Arose fair question.

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

explanation
#5 已发布: 2017/1/25 06:44:01
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: Moderator

Wrote

显示剧透



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 已发布: 2017/1/25 12:02:24
Krid

Krid

0个赞,共16个帖子。

组: 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 已发布: 2017/1/25 12:19:06
Krid

Krid

0个赞,共16个帖子。

组: 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 已发布: 2017/1/25 13:25:13
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: 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 已发布: 2017/1/25 13:49:07
Krid

Krid

0个赞,共16个帖子。

组: User

Thank you very much
Really works with the flags
  • 有新帖
  • 无新帖