Fix issue #1519 and adds feature #1520

This bug was caused by have the same name for the menu item for multiple scripts. Add script number to menu items so that we can run multiple copies of same script

This also adds a scriptEnding callback.

count.js shows an example of how to use the scriptEnding call back.

Closes issues #1519 #1520