MoI discussion forum
MoI discussion forum

Full Version: A quick (and dirty) Script Palette script

Show messages:  1-9  10-29  30-44

From: Frenchy Pilou (PILOU)
14 Feb 2014   [#30] In reply to [#29]
aaaaaaaaaaaaaaaaaaaaaaaaaaaaah!!!!!!!!!!!!!!

All is fine now! Bravo!
From: Hans
14 Feb 2014   [#31]
Hi dino!

You use this sign "!" to pick the commands for your palette. In your script I have seen some of this sign.
Can i change this signs for example in to "?" or other?
Then copy and rename your script "Script Palette 2" to make different category of caommands.

I am not a programmer. May be this is a way.

Thanks for your work!!

Hopefully, Hans
From: dinos
14 Feb 2014   [#32] In reply to [#31]
Hi Hans!

I havent tried it, but yes it should work as you describe.

Just change the ! at line 22 in the second copy of the script to something else:
code:
title = line.match(/\/\*\!(.+)\*\//);

Its escaped so you should be fine with most symbols.

I wrote this script primarily for me, and released it in case someone else needed a relatively simple way to keep their scripts in a palette. The Shortcut Keys panel inside Options is hardcoded and cannot be altered so i used the ! sign to emulate a check box next to each command. In my mind the ! sign is actually a check box saying "include in the palette" ;-)

I could replace the ! with !1, !2 etc for multiple categories, but there a few issues that i'll have to think about such as naming the categories, passing parameters to the script etc.
If i can find some free time i might give it a shot.
In the meantime what you are describing is the best way to do it.


Dinos
From: Frenchy Pilou (PILOU)
14 Feb 2014   [#33]
Cool trick!

Excellent!


From: Frenchy Pilou (PILOU)
15 Feb 2014   [#34]
Nothing but as you can see above the button is not centered ! ;)
So does exist some code for resolve this very very very little disturb ? :)
From: Michael Gibson
15 Feb 2014   [#35] In reply to [#34]
Hi Pilou,

> Nothing but as you can see above the button is not centered ! ;)

That's normal that buttons on dialogs in MoI are not centered, that's because it looks weird on larger dialogs. See for example the Close button on Options dialog. This dialog is just using the same thing.

- Michael
From: Frenchy Pilou (PILOU)
15 Feb 2014   [#36] In reply to [#35]
Thx for the info!
From: Hans
16 Feb 2014   [#37]
dinos,

thank you for your adwise.

Pilou,

thank you for making the test.

Hans
From: Frenchy Pilou (PILOU)
16 Feb 2014   [#38]
The only default that I see is that you must create a different Shortcut for each item even you don't need it if you want just use the text palette!

use the same shortcut for different commands don't work! :(
an empty Left column don't work :(

Or does exist a little trick for avoid that ?

Curiouslly something like
Alt + 1 + 2 Cone /*?cona*/
Alt + 1 + 3 Rectangle /*? rectangla*/
Alt + 1 + 4 Lines /*?Ligna*/
...etc
Close Options Shortcut, Exit Moi

works only at the first re-launch of Moi! Cool... :)
...but not at the second re-launch! :(
And disapears from the Shortcut list!
(words following are just letters not real French words except "Tuber" = Sweep and "Fermer" = Close ! )


From: Hans
16 Feb 2014   [#39]
Hi Frenchy!

I had the same result.
But there are some more of "!". Replace all with "?" and the ":)" comes back.

Hans
From: Frenchy Pilou (PILOU)
16 Feb 2014   [#40] In reply to [#39]
Yes but the number of possible ShorCuts are dramatically decreasing if you want keep some ones for real typing ShortCuts !
From: Mindset (IGNITER)
25 Apr 2015   [#41]
>> works only at the first re-launch of Moi! Cool... :)
>> ...but not at the second re-launch! :(
>> And disappears from the Shortcut list!

Found another little trick:
Create copies for each category. For example one for spirals, '../ui/ScriptSpirals.htm'
Change Line 22 to utilize a different character, unique for each category, as the '?' had been suggested: title = line.match(/\/\*\?(.+)\*\//);

[Shortcut Keys]
Alt+1=script: /*!Spirals...*/ moi.ui.createDialog( 'moi://ui/ScriptSpirals.htm' );
Alt+2=_ArchimedeanSpirals_ /*?ArchimedeanSpirals*/
Alt+3=Logarithmic2D /*?Logarithmic 2D*/
Alt+4=EulerSpiralSlider /*?Euler Spiral*/
Alt+5=EulerSpiral3 /*?Euler Spiral v3*/
Alt+6=FrenetClothoid3D_RK2_v1 /*?Frenet Clothoid 3D*/Alt+DownArrow=Nudge Down Small
A=Join /*!Join*/
Alt+S=IncrementalSave /*!Incremental Save*/
Ctrl+R=ReBuild /*!ReBuild*/
Ctrl+Shift+S=ScaleArray /*!ScaleArray*/
G=SpurGearProfile /*!Spur Gear*/
z=script:moi.ui.createDialog( 'moi://ui/ScriptPalette.htm' );




This way, items from the first list can 'createDialog' for other sub-categories:



And since each category file parses the ini file separately, the process remains repeatable!!
Even though, there are still yet a finite number of key-codes available for listing.

Image Attachments:
List2.jpg  List_1.jpg 


From: Rogurt
28 Apr 2015   [#42]
Hello all,

I try to use that fine script with Moi 2.0 (Win7 64bit) but it just wont work. Giving me an error message (see attachment).
I made sure the ScriptPalette.htm is in ui folder NOT in Commands folder.

Can anyone help?

Regards
Rogurt


Image Attachments:
Screen 00018.jpg 


From: dinos
28 Apr 2015   [#43] In reply to [#42]
Hi Rogurt,

unfortunately i don't think this script will work with Moi 2.0
I've never used Moi2.0 as i'm on a Mac, but there was a big change from Moi2.0, which was using Internet Explorer, to Moi 3.0 which is using webkit.


Dinos
From: Michael Gibson
28 Apr 2015   [#44] In reply to [#42]
Hi Rogurt, that script is using some new functions that were added in for v3, so it requires v3 to run and won't work on v2.

- Michael

Show messages:  1-9  10-29  30-44