MoI discussion forum
MoI discussion forum

Full Version: Modified version of Max's Scripts menu

Show messages:  1-20  21-31

From: Larry Fahnoe (FAHNOE)
4 Jun 2021   [#1]
I use MoI without many modifications to its user interface, but one area that has been a bit cumbersome is remembering the names of scripts that I don’t use very often. Max Smirnov’s CustomUI has a couple of Scripts menus that I thought were interesting, so I spent some time to better understand his code. I didn’t care for the hardcoded command names so I tried to come up with a simple way for the script to generate the command names that do not otherwise have a button or menu item… Well that turned out to be more effort than it was worth, so I kept one of the hard coded lists. When Michael adds to his list of Additional Commands (that don’t have a UI element, like Make2D for example) this script would need to be updated. My interest was to use the script with the stock MoI, so I trimmed out a few other bits that were not necessary (though it should continue to work with CustomUI).

Copy the Extras.htm and .js files to your personal startup folder (AppData/startup).

Tested with MoI V4 and V5 beta on a Mac.

4/21/2022, minor update for V5 compatibility.

8/20/2022, Add the V5 ViewProject command.

--Larry

Attachments:
Extras-003.zip


From: pressure (PEER)
18 Aug 2022   [#2] In reply to [#1]
Nice script Larry!
From: Larry Fahnoe (FAHNOE)
19 Aug 2022   [#3] In reply to [#2]
Thanks Peer, glad it is useful!

--Larry
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 


Show messages:  1-20  21-31