Command Organization

Next
 From:  RobertH
7110.1 
Hi Michael,

I'm doing a lot of tweaking to functions, scripts and commands etc. that I'm creating. This is making it harder to track down individual files, along with "polluting" MoI's directory structure, which can be a problem when MoI gets updated.

What is a good way to handle this?

Is it possible to create a single file which would contain all my javascript commands (as separate functions), but could still be accessed by the shortcut keys, HTM files, etc throughout MoI?

Thanks!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
7110.2 In reply to 7110.1 
Hi Robert,

> What is a good way to handle this?

Well, it's hard to avoid putting things in MoI's directory structure since that's the way that things are set up to run custom commands - commands are currently expected to be in that one commands folder...

When a new version comes out, it's a matter of copying only your new files over to the new installation, the easiest way to do that is to just copy everything and say "no" when it asks you if you want to overwrite files or not. Then only files that do not exist in the new installation will get copied over.

In the future I want to make some changes to how plug-ins work to make it possible to have plug-ins installed in a central location outside of MoI's own directory structure and that will make it easier to keep things separate, but that is not how things are currently set up.


> Is it possible to create a single file which would contain all my javascript commands (as separate functions),
> but could still be accessed by the shortcut keys, HTM files, etc throughout MoI?

Hmmm, it's not really feasible to do that with all files particularly with .htm files, the UI for just one command is expected to be in a single .htm file that then gets loaded.

If your commands don't have any UI like if they just execute immediately rather than having options and controls, then I guess it could be possible to combine them all in one big file and call that with one command with different parameters. You can have parameters after a command by setting up a shortcut with a space after the command name followed by the parameter, like having a shortcut that says: MyCommand MyParameter - then the script in MyCommand.js can retrieve the parameter by calling moi.command.getCommandLineParams();

I'd generally recommend leaving separate commands as separate files though since that's how things are primarily set up in MoI itself right now. If you have some script code that is used by several commands that can be put into just one file and then use #include in the main script to bring in the library file.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  RobertH
7110.3 
Thanks a lot for the explanation Michael...
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All