I assume the function is called CountMeds. So you would need to call the function as:
So in your example what would be "myScript" and what would the "ObjectName" be? Ctrl-J has no effect!
As always your rapid response and expert guidance is deeply appreciated!
In the Hierarchy view click on the object, hit F2 and it will allow you to rename it. Change it to myScriptObject. Now you shoudl be able to call it by myScriptObject.CountMeds();
If that dies not work copy all of the code to the clipboard. In the hierarchy view choose the root node. Right mouse click and choose the insert script object. Now rename it as above and paste you code into this object.
Lastly, put an app.alert("This is a test") as the 1st line in the script object. Execute your button and see if the message pops up. This will tell us if the object is even being called.
1. F2 button does not work!
2. I copied all the code and when I clicked on the Root node to insert script object it invariably pastes it under the same variable where it pasted CountMeds before. I can rename the newly pasted script Object but still can't rename the variable! 😞
I have put lots of app.alerts in the script to track its progress! Actually that is how I figured out that the function (script object) wasn't executing!
Once I get the function call to execute properly I think I will be on my way!
Sorry this is turning out to be such a pain but then if it had been simple I wouldn't have bothered you!