I've discovered one of the problems that prevents some scripts (such as Case.vbs and BatchArtFinder.vbs) from working correctly off of my right-click menu and have a workaround. The problem shows up with other scripts that I try to run off my right click menu when they use "Script.ScriptPath". In these cases, because my script called theirs, Script.ScriptPath in their script returns the path to my script not theirs. I haven't found any way to modify my script so that when they call Script.ScriptPath it finds their script correctly, so have a workaround that involves you editing the other files. I'm not happy with this solution, but it seems to work. Please do this carefully and make sure to back up the other scripts if you're not sure of your editing skills. I've been testing on my system, and so far everything seems ok.
Here's how to do it:
1) Save the original script from the first message in this thread.
2) Make the modifications I described earlier in this thread. (Once I hear from a few of you that this works, I'll update the original post.)
3) Re-start MM and try out the new right-click menu.
4) For any script you try to run of off my right-click menu that gives you an error "Error happened during script execution: Uknown name" you will have to edit the other script to replace Script.ScriptPath with the path to that other script. Instructions for this follow.
If any of the MM script masters have any suggestions as to how I can modify my code to avoid users having to change the other scripts, I'd appreciate suggestions.
Edits to other scripts - USE AT YOUR OWN RISK
1) Open each script that errors under my right-click and add the code below after Option Explicit but before the first Sub or Function. Replace the scriptname portion (e.g. Auto\XXXX.vbs" in the code below) with the filename for the script. If the script is in Scripts rather than Auto folder, leave out the 'Auto\' portion. Two scripts I needed to update are Case.vbs and /Auto/BatchArtFinder.vbs. You may have others that need editing.
For example, for BatchArtFinder.vbs:
Code: Select all
sPath = sdb.ApplicationPath & "Scripts\Auto\BatchArtFinder.vbs"
For example, for Case.vbs:
Code: Select all
sPath = sdb.ApplicationPath & "Scripts\Case.vbs"
2) Next search and replace all instances of Script.ScriptPath with sPath
3) Save the file - be sure it names it with '.vbs' rather than '.vbs.txt' if you use NotePad.
4) Restart MM and try out the new code. The scripts you edited should work from my right-click menus as well as the original Tools/Scripts menu.
5) Repeat as needed for other scripts.
If you run into problems, please provide as much info about which script you were trying to use and the error message you received.