MOI3 Errors when selecting Shortcuts

Next
 From:  redraw (MAYSKY)
9891.1 
I have run into an odd situation with the shortcuts.
When I select the a script from the ShortCuts list I get a (SyntaxError: Parse error) (as per image).
However, when I use a shortcut-key-combo for the same script, the script runs no problems.
What is going on? And how to fix?
Please.
Image Attachments:
Size: 23.5 KB, Downloaded: 25 times, Dimensions: 650x367px
  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
9891.2 In reply to 9891.1 
Looks like you might be missing a "script:" prefix on the shortcut key.

Back some time ago it was required that inline script code needed a "script:" prefix at the start of it to indicate that what followed was some script code instead of the name of a command to run.

At some point later on that became optional and it would run the text contents of the shortcut key as script code if it did not match to the name of a command in the commands folder. But the shortcut key menu is still relying on having the script: prefix there.

So change that shortcut key to have script: at the start of it and that should probably fix it.

But don't add "script:" to every single shortcut key, the ones that have the name of a command in them like "Open" and "Save" should not have 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
Next
 From:  redraw (MAYSKY)
9891.3 In reply to 9891.2 
Thank you
  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:  redraw (MAYSKY)
9891.4 In reply to 9891.2 
Just had a look at the OPTIONS and it appears that the script indeed has the prefix of "script:"...
Below is the script I copied form within the OPTIONS - Shortcut keys tab. it reads as follows


script: /*! Highlight naked edges */ var gd = moi.geometryDatabase; gd.deselectAll(); var breps = gd.getObjects().getBreps(); for ( var i = 0; i < breps.length; ++i ) breps.item(i).getNakedEdges().setProperty( 'selected', true );


But still throws the said error.

Have tried deleting and re applying the Shortcut, but no luck either.
  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
9891.5 In reply to 9891.4 
Hi Maysky, looks like it's a bug in the CustomUI Shortcuts menu code.

The bug is that it emits a button that has an attribute like command='script_code_here' which will cause an error if the script code also happens to have any single-quote ' ' characters in it which happens to be the case for the highlight naked edges script. When the HTML parser sees the ' character in the script code, it takes it to be the end of the command=' ' attribute.

To solve it, replace your file Shortcuts.menu.htm with the version I have attached here. This version replaces any single-quote ' characters in the script with a special HTML entity code which will tell the HTML parser to put a ' character into the attribute value rather than ending the command=' ' attribute there.

- Michael
Attachments:

  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:  redraw (MAYSKY)
9891.6 In reply to 9891.5 
Sweet!
Thank you Vmuch :)
  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