MoI discussion forum
MoI discussion forum

Full Version: Modified version of Max's Scripts menu

Show messages:  1-12  13-31

From: Larry Fahnoe (FAHNOE)
20 Jun   [#13] In reply to [#12]
Hi SUIYAN,

Glad that Michael's fix resolves the issue you noted.

As mentioned, I wanted to avoid having the hard-coded list of internal commands but that turned out to be more of a challenge than I had time for. Are you able to rename the other script files in the commands directory and have the international characters display properly in the menu? I never thought about that particular use-case.

--Larry
From: 大道刀 (SUIYAN)
21 Jun   [#14] In reply to [#13]
HI Larry

我想是支持的。如图我测试了,一般符号+中文+俄文+越南文+日文,也测试了希腊字母它们的显示和调用脚本的能力是正常的,但请注意,不要使用*等等的特殊符号,这些会造成命名的脚本无法显示在菜单上。(I think it is supported. As shown in the figure, I tested the display and script calling ability of the general symbols+Chinese+Russian+Vietnamese+Japanese, as well as the Greek letters. It is normal, but please note not to use special symbols such as*, which will cause the named script to not be displayed on the menu.)






请注意命名的方法1.请保证在extra.htm文件中的目标插件名称,与commands目录中的对应脚本的.js .htm两个文件的名称完全相同,这在符号复杂,语种多样时最为重要,一个空格都不要缺失或多余。2、以UTF-8编码保存,3个人不保证所有语言都能正常使用,因为可能有特殊符号,命名不一致等原因造成。
1:Please note the naming method 1. Please ensure that the target plugin name in the extra.htm file is exactly the same as the names of the corresponding script's. js.htm files in the commands directory. This is most important when symbols are complex and languages are diverse, and not a single space is missing or redundant

2: Save UTF-8 encoding,
3. I cannot guarantee that all languages can be used normally due to special symbols, inconsistent naming, and other reasons.

另外我想问:如何在显示的插件中的特定位置加分割线,横向的和纵向的____________|Also, I would like to ask: How to add dividing lines, horizontal and vertical, at specific positions in the displayed plugin

Image Attachments:
1.png  2.png  3.jpg 


From: Larry Fahnoe (FAHNOE)
21 Jun   [#15] In reply to [#14]
Hi SUIYAN,

Thank you for the testing and confirmation of how the international characters are working. Possibly related to character sets, Max used the leading underscore "_" character in certain scripts and I made a small change in my Extras to ignore those underscores when sorting the names. I offer that since it seems you might like to tweak the code.

As to adding horizontal or vertical dividing lines, that would require a significant change to the script's logic. My goal was to have as few special cases in the script as possible so that it would require minimal maintenance as MoI changes and evolves while still providing access to whatever scripts the user has added. The code is there and you can certainly make your own version (hopefully you choose a new name for it) with additional dividing lines. Depending on what you want to do, you would need to modify makeList() which is mostly just the code I borrowed from Max's Scripts.

--Larry
From: 大道刀 (SUIYAN)
21 Jun   [#16] In reply to [#15]
我还是不添加下划线了。您采用的编写形式,让我这个对编写程序完全空白的人,能够尽情的尝试,不必担心调用出现错误而无法恢复。我将把如何修改菜单显示的方法告诉了一些有需要的使用者,让他们自己能够自由的定制需要的脚本菜单这比max的菜单容易得多。
(max实现下划线功能可能是使用了多个var internalcmd 我无法弄清楚这和下划线的位置规则具体的关联)
I still won't add an underline. The writing style you have adopted allows me, as someone who is completely blank in programming, to try it out without worrying about errors in the calls and being unable to recover. I will tell some users in need how to modify the menu display, so that they can freely customize the script menu they need, which is much easier than Max's menu.
(Max's implementation of the underline function may be due to the use of multiple var internalcmd, and I cannot figure out the specific association between this and the position rule of the underline)

再次感谢您制作的菜单。简便而明确。(Thank you again for creating the menu. Simple and clear.)
From: Frenchy Pilou (PILOU)
21 Jun   [#17]
I believe that the first underscore was just for see Native Scripts (or commands) / No Native Scripts ;)
So the Max Smirnov scripts against Michael ;)
From: 大道刀 (SUIYAN)
21 Jun   [#18]
HI every one

请看如何使用 Larry的插件菜单定制自己需要的插件菜单。
1将下载的压缩包的Extras.htm、Extras.js文件放置在C:\Users\Administrator(username)\AppData\Roaming\Moi\startup
2:将Extras.htm使用记事本打开,并按图片所演示的进行定制修改:

1-蓝底部分是需要修改的部分,红色箭头部分需要在Extras.js的相同位置修改 是图标显示的名称,默认名称为Extras红色方框部分的分隔符不要做任何更改,橙色部分也是分隔符号,注意不要遗漏分隔符这样就可以自由更改所需要的脚本:分隔符—名称—分隔符(一个分隔符由三个独立的符号组成,如果默认分离,可以缩进到紧挨着,避免修改过程中的错误)将修改的Extras.htm Extras.js都替换保存为utf-8编码,让菜单能够显示其他语言。

The blue bottom section is the part that needs to be modified, and the red arrow section needs to be modified in the same position as Extras.js to display the name of the icon. The default name is Extras. The delimiter in the red box section should not be changed, and the orange section is also the delimiter. Be careful not to miss the delimiter so that you can freely change the required script: delimiter name delimiter (a delimiter is composed of three independent symbols, and if it is separated by default, it can be indented adjacent to avoid errors during the modification process). Replace and save the modified Extras.htm Extras.js with UTF-8 encoding, so that the menu can display other languages.


2-将moi安装目录内的目标脚本的.js .htm文件改为在Extras.htm刚写入的名称(主要是其他语言的名称)注意完全一致不要出现空格,不要填写*之类的特殊符号
Change the. js. htm file of the target script in the Moi installation directory to the name just written in Extras.htm (mainly for names in other languages), ensuring complete consistency without any spaces or special symbols such as *


3:-如果一切无误,您得到了定制菜单并能够正常使用脚本。If everything is correct, you have a customized menu and can use the script normally.


方法二:1:将Extras.htm中的var additional函数中的值全部删除,最终保留 var additional = [ ];(注意不要丢失;符号),这会让Extras.js不要读取moi安装目录/commands路径中的脚本。(Method 2: 1: Delete all values in the var additional function in Extras.htm, and ultimately keep var additional=[]; (Be careful not to lose; symbols), this will prevent Extras.js from reading scripts in the moi installation directory/commands path)

2:将需要的目标脚本.js,目标脚本.htm文件复制存入%AppData%\Moi\commands (C: \ Users \ Administrator (username) \ AppData \ Roaming \ Moi \ commands)路径,并修改你想要的任何语种,菜单将实时更新。
(Copy the required target script. js and target script. htm files into the path of% AppData% \ Moi \ commands (C: \ Users \ Administrator (username) \ AppData \ Roaming \ Moi \ commands), and modify any language you want. The menu will be updated in real-time.)
3:此方法适用于任何脚本,包括moi自带脚本以及没有htm配置文件的.js单文件脚本,仍需要注意文件名称不要出现空格,双文件版本的插件需要两个文件的名称保持一致。
(This method is applicable to any script, including a. js script with the moi itself and a. js single file script without an htm configuration file. It is still important to note that the file name should not contain spaces, and the dual file version of the plugin requires the names of the two files to be consistent.)

这个方法更为简明。This method is more concise.

Attachments:
插件管理菜单(支持多语言版本).rar

Image Attachments:
1.png  2.png  3.png 


From: Larry Fahnoe (FAHNOE)
22 Jun   [#19] In reply to [#18]
Hi SUIYAN,

I'm glad that the script is helpful for you. I must say that you are to be commended in your efforts to make changes to the script, especially because you are unfamiliar with programming and because you must try to make sense of this mixture of English and Chinese characters. If I were you, I would be confused just looking at your screen!

A suggestion to make it easier to share programming information with others on the forum here is to enclose sections of code in "<code>program statements</code>" so that the formatting of the lines is preserved. This will be much easier to read than the screenshot. For example, the sections you are explaining needing a change:

This part is not code but instead a comment to provide information to others (it does not effect how the script executes):
code:
         /*
            Extras
            8/20/2022, Larry Fahnoe, fahnoe@FahnoeTech.com

            A modification of Scripts.menu.htm from Max Smirnov's
            CustomUI but intended for those who do not use CustomUI.

            Copy the Extras.htm and .js files to your personal startup
            folder.

            It would be nice if additional[] was not hard coded, but
            have not figured out a simple way to generate it.  These
            commands do not have buttons in the UI and are copied from
            the Additional Commands section of MoI's Command Reference.
          */


This is the section you are highlighting in blue:
code:
         var additional = [ 'ArrayGem', 'BoundingBox', 'BoundingBoxCenter',
                            'ExplodeMove', 'Flip', 'IncrementalSave', 'Make2D',
                            'Merge', 'Rebuild', 'RemoveDuplicates',
                            'ShrinkTrimmedSrf', 'ViewProject' ];
         var maxlines = 40;


Hopefully this will make the code portion clearer.

--Larry
From: 大道刀 (SUIYAN)
22 Jun   [#20] In reply to [#19]
HI, Larry
我修改成了这样,并上传了附件。增加了留白的行数,方便找到修改的位置。但仍缩减了插件名称之间的行数,我想,需要让人们知道,分隔符号应该是完整的,这对编程空白的人,能够不出现错误的修改尤为重要。
(I have modified it to this and uploaded the attachment. Added the number of blank lines for easy positioning. But it still reduces the number of lines between plugin names. I think it's important to let people know that the delimiter should be complete, which is especially important for those who have programming blanks to avoid making incorrect modifications.)

Attachments:
插件管理菜单(支持多语言版本).rar

Image Attachments:
1.png 


From: Larry Fahnoe (FAHNOE)
22 Jun   [#21] In reply to [#20]
Hi SUIYAN,

I'm not sure that I am following what you mean about a delimiter. Perhaps you are misunderstanding that in javascript, statements can be continued over multiple lines? (the purpose is to make the code more easily read and understood)

Also, I noticed that you deleted a couple of the commands from the list (Flip and IncrementalSave) so I put them back in. See the attached file.

The lines beginning with - are the original lines, those with + are the modified lines.
code:
% diff -u ../Extras.htm Extras-SUIYAN.htm 
--- ../Extras.htm	2022-08-20 12:34:03
+++ Extras-SUIYAN.htm	2024-06-22 09:43:07
@@ -19,8 +19,8 @@
           */
 
 	 var additional = [ 'ArrayGem', 'BoundingBox', 'BoundingBoxCenter',
-                            'ExplodeMove', 'Flip', 'IncrementalSave', 'Make2D',
-                            'Merge', 'Rebuild', 'RemoveDuplicates',
+                            'ExplodeMove', '管道', 'Flip', 'IncrementalSave',
+                            'Make2D', 'Merge', 'Rebuild', 'RemoveDuplicates',
                             'ShrinkTrimmedSrf', 'ViewProject' ];
 	 var maxlines = 40;
 


--Larry

Attachments:
Extras-SUIYAN.zip


From: pressure (PEER)
22 Jun   [#22] In reply to [#20]
Hi Suiyan,

Re:
> Added the number of blank lines for easy positioning. But it still
> reduces the number of lines between plugin names.

Blank lines in code have no effect on how javascript or html works. They will not become blank lines in the graphic display that the code generates.

Adding blank lines to the displayed list would require many changes to the .htm file to make it work in a different way that allows blanks. Right now there are multiple steps that either discard blanks or will put them in a different position from where you want them.

- Peer
From: 大道刀 (SUIYAN)
22 Jun   [#23] In reply to [#21]
HI Larry @ pressure

我重新打开了我原本的Extras.htm文件和您的Extras-SUIYAN中的Extras.htm需要用户修改的地方做了对比(I have reopened my original Extras.htm file and compared it with the parts of Extras.htm in your Extras SUIYAN that require user modification)



显然空白的部分在我的Extras.htm中得以保留,并且菜单的功能是正常的。请相信这对编程空白的人来说能起到更容易找到需要做修改的位置的作用。
(Obviously, the blank parts have been preserved in my Extras.htm, and the functionality of the menu is normal. Please believe that this can make it easier for those who do not understand programming to find the areas that need to be modified.)
我对您的文件只是做了3个小修改,这在中国的大多数人看来恐怕都不是修改1:将文件保存为UTF-8编码而不是默认的ANSI编码,要知道不是所有人都知道需要更改保存时的编码才能支持他的语言。但他一定会把相应位置名称改为自己的语言。2:增加一个中文的脚本名称(不同语言),是为了告诉需要的人,这个菜单天然支持多语言。3,缩进var additional = 部分的脚本名称是为了告诉编程空白的人,只需要注意 [ 'XX', 'YY', ' ZZ' ];只要分隔符的形式不发生改变,随意更改名称,增加、删除脚本名称都难以出错。
(I have only made three minor modifications to your file, which most people in China may not consider as modification 1: Save the file in UTF-8 encoding instead of the default ANSI encoding. It should be noted that not everyone knows that changing the encoding at the time of saving is necessary to support their language.But he will definitely change the corresponding location name to his own language. 2: Adding a Chinese script name (Different languages) is to inform those in need that this menu naturally supports multiple languages. 3. Indenting the var additional=section of the script name is to inform programming whitespace users that they only need to pay attention to ['XX ',' YY ',' ZZ ']; As long as the form of the delimiter remains unchanged, it is difficult to make mistakes by arbitrarily changing the name, adding or deleting script names.)
我的想法是,所有的更改为了使弄不懂编程的人能够修改和使用,正如您将max版本中的硬编码形式改为了生成式编码(在Michael的讨论中我大概知道 max版本怎么修改,可它仍然不能简明以修改),修改排版样式能让原本不会修改这个文件的人,能够更容易的修改。绝大多数人只使用操作系统自带的记事本来编辑修改,而不使用其他编辑程序。
(My idea is to make all the changes so that people who don't understand programming can modify and use them, just like how you changed the hard coding format in the max version to generative coding (in Michael's discussion, I roughly know how to modify the max version, but it still cannot be modified concisely). Modifying the layout style can make it easier for people who originally wouldn't modify this file to make changes.The vast majority of people only use the built-in notepad of the operating system to edit and modify, without using other editing programs)

Image Attachments:
1.png  2.png  3.png 


From: Larry Fahnoe (FAHNOE)
23 Jun   [#24] In reply to [#23]
Hi SUIYAN,

I think that I'm understanding your desire to make it easier for people to make changes, thus your changes to the formatting. However after rereading your previous messages, I don't think you really need to make any changes to Extras.

Going back over your screen shots, it appears you are making changes to the files in the MoI installation directory (D:\Program Files\MoI 5.0 beta Apr-13-2023\commands). But that's NOT where Extras is looking for the commands to add to the menu. Extras is looking in your %AppData%\Moi\commands directory which is where any custom scripts are supposed to live so that you can easily upgrade versions of MoI without loosing your custom scripts.

The additional[] array is a special case (really a hack that I'm not pleased with) and is only intended to hold the list of commands that are built-in to MoI, but do not have icons in the UI. This is intended to be a very small list of commands and it should only need to be changed when Michael adds another of this type of command, NOT where you add your own custom commands.

You are adding either Pipe管道 or 管道 to the additional[] array. Instead, if you want to add a Pipe管道 or 管道 Extras menu item, put those files into your %AppData%\Moi\commands directory and Extras should display them without any changes to its code.

The only part I am a bit uncertain about however is if you need to save Extras.htm as a UTF-8 encoded file with byte order mark as Michael mentioned in order for it to properly display your Chinese file names. I would be interested in knowing if my original Extras from Extras-003.zip properly displays the Chinese file names in your %AppData%\Moi\commands directory.

If it is your intention to translate the names of the 12 (currently) commands in additional[], then you would edit only those command names in BOTH Extras and rename the files in the MoI installation directory. However I do NOT recommend making any changes to the files in the MoI installation directory.

--Larry

Message 10353.25 was deleted


From: 大道刀 (SUIYAN)
23 Jun   [#26] In reply to [#24]
HI Larry Fahnoe
IS GREAT
语言显示也没问题,无论是ANSI还是UTF-8编码请将Extras-003.zip 中的Extras.htm文件var additional = [ ];部分的值删减为空白,不然就会出现这种情况。(There is no problem with the language display, whether it is ANSI or UTF-8 encoding, please add var additional=[] to the Extras.htm file in Extras-003.zip; Delete some values to blank, otherwise this situation will occur,)

菜单会同时显示var additional的值中MoI 5.0\commands的部分和%AppData%\Moi\commands 的部分。(The menu will display both the MoI 5.0 \ commands section and the% AppData% \ Moi \ commands section in the value of var additional.)

2:我之前那种修改方式只支持UTF-8编码。(My previous modification method only supported UTF-8 encoding.)

3:请编辑您的第一个讨论添加脚本放置的位置位置为:C:\Users\Administrator(username)\AppData\Roaming\Moi\commands可以同时兼容%AppData%\Moi\commands 的表述

Please edit your first discussion and add the script to the following location: C: \ Users \ Administrator (username) \ AppData \ Roaming \ Moi \ commands, which can be compatible with both% AppData% \ Moi \ commands

Image Attachments:
1.png 


From: Michael Gibson
23 Jun   [#27] In reply to [#24]
re: Saving as UTF-8 with Byte Order Mark - that's only needed if there is unicode text directly contained in the .htm file.

It isn't needed if the text is being generated at runtime like from moi.filesystem.getFiles().

- Michael
From: Larry Fahnoe (FAHNOE)
25 Jun   [#28] In reply to [#26]
Hi SUIYAN,

Thank you for confirming that Extras properly displays the Chinese characters from the scripts in your personal commands folder.

> please add var additional=[] to the Extras.htm file in Extras-003.zip; Delete some values to blank, otherwise this situation will occur,)

I'm sorry, I do not understand, what situation or problem are you saying results from using the Extras from Extras-003.zip? I do not read or understand the Chinese characters in your example screen shot, so I do not understand what you are trying to report.

I just tested with an empty personal commands directory and it just displayed the entries in the additional array, as it should have. When I use it with all my normal scripts in my personal commands directory, they show up in addition to those in the additional array. As far as I know Extras works fine for myself and many others, but you're running into something new. I suspect it may have something to do with your system, but I do not know what changes you have made.

--Larry
From: 大道刀 (SUIYAN)
25 Jun   [#29] In reply to [#28]
HI Larry
现在Extras非常好用了。简单的说菜单会同时显示 var additional=[] 中的脚本名称值(首先moi安装目录/commands 路径下对应的脚本名称。)和 %AppData%\Moi\commands 中所存储的脚本名称值。(Now Extras is very useful. Simply put, the menu will display both the script name value in var additional=[] (first, there is a corresponding script name in the/commands path of the moi installation directory) and the script name value stored in% AppData% \ Moi \ commands.)


我之前的修改方式是先在添加 var additional=[]中添加所需脚本名称的值,用utf-8编码存储,然后将moi安装目录/commands 路径下的相应脚本改为var additional=[]中的对应值,这样就可以得到我想要的显示的语言和名称。而现在只需要将脚本复制到%AppData%\Moi\commands中,改为我需要显示的名称。(My previous modification method was to first add the value of the required script name in var additional=[], store it in UTF-8 encoding, and then rename the corresponding script in the/commands path of the Moi installation directory to the corresponding value in var additional=[], so that I can obtain the language and name I want to display. And now all I need to do is copy the script to% AppData% \ Moi \ commands and change it to the name I need to display.)

Image Attachments:
1.png  2.png  3.png 


From: Larry Fahnoe (FAHNOE)
26 Jun   [#30] In reply to [#29]
Hi SUIYAN,

I think that you are misunderstanding the intended function of this script, so maybe an example of what it looks like on my system would help:



The dividing line is intentional because the commands above it are those that are built-in to MoI, but do not have icons in the UI; these are the contents of the additional array. The commands below are the scripts in my personal commands directory. The separator serves to remind about the two categories of commands beyond what is already provided by MoI's UI. Now maybe it will make sense why I do not want to change the way Extras works. You of course are welcome to take the code and adjust it as you see fit. I would only request that you call your version something other than Extras.

--Larry

Image Attachments:
Extras example.png 


From: 大道刀 (SUIYAN)
27 Jun   [#31]
HI EVERYONE

我上传了我的插件管理菜单版本,它支持多语言,删除了var additional中的值让它们不再显示C:\Users\Administrator\AppData\Roaming\Moi\commands之外的插件,方便管理。增加了表头的显示和定制,去除了关闭按钮,下划线,并且可根据安装说明、注释,按需要恢复完全它们。
(I uploaded a version of my plugin management menu, which supports multiple languages. I removed the value in var addition to make them no longer display plugins other than C: \ Users \ Administrator \ AppData \ Roaming \ Moi \ commands, making it easier to manage. Added display and customization of the header, removed the close button and underline, and can be fully restored according to installation instructions and comments as needed.)

在#18的讨论中可以下载到它(It can be downloaded in the discussion of # 18&# 20)




我想继续改进它,增加一个或几个额外的调用路径有可能在菜单中按所在文件夹的名称分类显示,方便脚本的分类管理,我对编程了解的非常少,请问我该怎么做?(I would like to continue improving it by adding one or several additional call paths that may be displayed in the menu according to the name of the folder they are located in, making it easier to manage the classification of scripts. I have very little knowledge of programming, what should I do?)

Image Attachments:
1.png  2.png 


Show messages:  1-12  13-31