MoI discussion forum
MoI discussion forum

Full Version: Modified version of Max's Scripts menu

Show messages:  1-3  4-23  24-31

From: Frenchy Pilou (PILOU)
19 Aug 2022   [#4]
In what folder this above must go ?
And some other must be disable ?
From: Larry Fahnoe (FAHNOE)
19 Aug 2022   [#5] In reply to [#4]
Hi Pilou,

Extras.htm and Extras.js go into the personal startup folder (AppData/startup). They do not conflict with anything else (can be used alongside of Max's CustomUI) so nothing needs to be disabled.

--Larry
From: Frenchy Pilou (PILOU)
19 Aug 2022   [#6] In reply to [#5]
Thx for the infos!
From: Frenchy Pilou (PILOU)
19 Aug 2022   [#7]
Sorry...i have yet this script line text box...(on the left)
what adds your own extra ? (on the right)
Don't ask me how i have installed that...i don't remember ! :)


From: Larry Fahnoe (FAHNOE)
19 Aug 2022   [#8] In reply to [#7]
Hi Pilou,

> Sorry...i have yet this script line text box...(on the left)
> what adds your own extra ? (on the right)

If you already use Max's CustomUI with its Scripts menu, then Extras does not add anything of value.

I used Max's Scripts menu as the basis for a simplified scripts menu for use without CustomUI. Since the MoI UI already provides access to most all of the builtin commands, I only wanted to show those commands which are not shown by the UI (the "Additional Commands" above the separator line), and of course the custom scripts (below the line).

--Larry
From: Frenchy Pilou (PILOU)
19 Aug 2022   [#9] In reply to [#8]
No problem... :)
In any case your functions works fine!
From: 大道刀 (SUIYAN)
19 Jun   [#10] In reply to [#1]
Hello, Larry

我在使用您的脚本菜单,非常好用,Extras.htm 生成命令列表能够非常简明的增加或减少脚本在菜单中的数量。这是我需要的,但对于我来说和Max 的 Scripts.htm相比有一个问题,请看图片(I am using your script menu, which is very user-friendly. Extras.htm generates a command list that can succinctly increase or decrease the number of scripts in the menu. This is what I need, but there is an issue for me compared to Max's Scripts.htm, please see the picture)









如同图片展示的,我需要在菜单中显示中文名称,这一点在Scripts中可以重命名相对应的脚本文件来实现,请问在Extras我该如何实现它?
(As shown in the picture, I need to display the Chinese name in the menu. This can be achieved by renaming the corresponding script file in Scripts. How can I implement it in Extras?)

Thank you

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


From: Michael Gibson
19 Jun   [#11] In reply to [#10]
Hi SUIYAN, for renaming the "Rebuild" command you indicate above you would also need to update Extras.htm, line number 21:

    var additional = [ 'ArrayGem', 'BoundingBox', 'BoundingBoxCenter',
        'ExplodeMove', 'Flip', 'IncrementalSave', 'Make2D',
        'Merge', 'Rebuild', 'RemoveDuplicates',
        'ShrinkTrimmedSrf', 'ViewProject' ];


You would probably need to edit 'Rebuild' there to match up with your new Chinese file name, and save Extras.htm as a UTF-8 encoded file with byte order mark.

- Michael
From: 大道刀 (SUIYAN)
19 Jun   [#12] In reply to [#11]
Michael, Thank you very much

简洁且明确(Concise and clear)


Image Attachments:
Renaming successful.png 


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 


Show messages:  1-3  4-23  24-31