Changed menus to call func instead of subroutines #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It was a bit tough because the code uses subroutines and not functions. Here's what I did to get it to work:
-Negated the IF statement where the menu gets created so it adds the menu item when it knows the query
-Added a handler that binds the query to a new function called OpenPluginHelper
-Subtract 1 from the Array[] so it uses the title in the menu text
-Replace menuitemcount with handler variable in menu add
-Commented out the ELSE section since we don't need the queryname# variables anymore
-Declared queryname as a global variable. You have to do this before it's used in the OpenPluginHelper function as variables in functions are local by default and the openplugin subroutine needs it to run. Note that subroutines, don't have this "limitation" even if called from within a function, like we are doing.
-Added the OpenPluginHelper function. This sets the queryname (global) variable and calls the openplugin subroutine.
-Commented out the #include menuindex.ahk line :-D