JS external script error
All  1  2-8

Previous
Next
 From:  Michael Gibson
5871.2 In reply to 5871.1 
Hi Dan, how are you setting up the custom scripts, like which directories are you copying them into and what are you putting into the shortcut keys?

In order for these to get run properly, you need to copy them into the commands folder and then in the command part of the shortcut key you should have just the plain command name there, so for example with CustomDistance put in just plain: CustomDistance in the commands part, not anything like script:CustomDistance or c:\scripts\CustomDistance.js or things like that, since those other ways will cause it to be launched in a different way, as an "inline script" rather than as a "command".

From the error there it kind of looks like the actual problem is that the #include directives in the script are not getting parsed out and injected into the script text, like GetPoint for example is supposed to come from #include "GetPoint.js" in the main script and it's supposed to open up that GetPoint.js file and insert it into that spot in the main script.

Regular commands work in the same way so it's kind of odd that it's only happening for just custom ones, I think it must be something in how those custom ones are getting triggered.

I guess it could be possible that a virus checker is preventing some files from being read, but if that was the case I would kind of think that regular commands like just drawing a line would be messed up with the same "GetPoint" error as well.

- 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
Next
 From:  dan (DANLANIGAN)
5871.3 In reply to 5871.2 
Michael,

I had the custom scripts in a scripts folder within the MOI install folder. I thought I had read somewhere that MOI could resolve this path. But it seems that it can't. The reason why I don't want to keep the custom scripts in with the rest of the commands is to make upgrading straightforward. Is there anything that I can do to keep my custom scripts separate (other than something like prefixing custom script names with an identifier). Thanks for your quick response.

Dan
  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:  danperk (SBEECH)
5871.4 
Hi Dan,

There is a very easy way to migrate your custom scripts from beta to beta.

Once you install a new beta, just uninstall the previous beta and it will remove
all files except the ones you have added. Then you just copy them into the new
beta folder. This works on PC, not sure if the Mac uninstall works the same.
  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:  dan (DANLANIGAN)
5871.5 In reply to 5871.4 
OK thanks, I will try this on the next beta - too late for the last one.
  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
5871.6 In reply to 5871.3 
Hi Dan, no they can't go into a separate folder like that, they currently have to go into the commands folder. The way it's currently set up, they will only be processed as a "command" if they are in there. A "command" script is a little different than an "inline script", it does various setup stuff like loading the command's UI file, setting up undo records, clearing some kinds of selection states, various assorted stuff like that. Some of those things that are not happening when it's run as inline script is what's causing the particular problem.

Well I guess you could keep them in a separate folder if you want just for bookkeeping, like maintain your own folder which MoI wouldn't even know about and just copy from your own folder into the new MoI's commands folder when you upgrade.

Or it also should work fine to just copy the entire previous commands folder into a new release's one and just say No to overwriting any files too.

Eventually I want to totally revamp how custom plug-in scripts are installed, I would like to make them go into a central location under %AppData% like moi.ini so they would automatically persist between upgrades and also have some central repository of them where you could browse through some categories of them and push a button or something to install one instead of doing manual copying. There is a fair amount of work involved in setting up that whole system so I'm not exactly sure when it will happen though, right now I have put a higher priority on things like bug fixes and modeling improvements.

- 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
Next
 From:  Michael Gibson
5871.7 In reply to 5871.3 
> I thought I had read somewhere that MOI could resolve this path.

Well it will find things in that directory but it will treat it as an "inline script" (usually meant for things that just do a kind of single action rather than having their own UI and multiple stages and such), not as a full command.

Most inline scripts just have script code pasted directly into the command field of the shortcut key, but if it's particularly large in size it is possible to put it in a separate file and that's what a scripts folder can be used for. But this is rare, as far as I can remember only one single script (FullScreen.js) has been distributed this way.

Most things should go into the commands folder instead, and the shortcut key should list just the command name, no file extension or script: prefix on it.

- 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:  dan (DANLANIGAN)
5871.8 In reply to 5871.6 
Thanks for the detailed response. Between what you and others have explained I will be able to come up with a method of maintaining custom scripts across upgrades. I think that you are right in assigning this (script install system) a low priority, there are so many more important things than this. Thanks again.

Dan
  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

 

 
 
Show messages: All  1  2-8