MoI discussion forum
MoI discussion forum

Full Version: Modified version of Max's Scripts menu

Show messages:  1-19  20-31

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-19  20-31