Is there anyway to have a script press a button?
The rest of the post is a long explanation of why I want to have a script press a button, so if you don't care why feel free to skip it. If you like digging into problems read on.
It's easy enough to have a script to go to the button using the object name, but I would like to activate a button within a script, since then the script that the button runs will run with all of the parameters saved in the button.
I am using buttons to perform searches (which are defined by the parameters passed to the script the button runs) in order to use one list view to show several diffirent lists, kind of like a filtered portal. The script is called ButtonSearch, and its parameters are the object name of the button, the field to be searched on, and then the terms to be searched for.
This works fine. There is a row of buttons, if you click on it shows just the records for that category, and you can tell which category you are looking at with conditional formatting on the button (that is why the object name of the button is put in as a parameter, since I couldn't find a way to get the button name from within the script itself).
Now I want to create a layered "navigation" with tabs for categories and the search buttons for subcategories. However, if you switch from tab to tab by just clicking on the tab, you have to then click on one of the subcategory buttons before it will change the search and give you the correct records.
So, I decided to switch between the tabs with buttons, because then I can use GotoObject to return to the last button pushed in each tab by saving it into a global variable. The global variable is dynamically created, and has the same name as the tab. The value put into the variable is the name of the button (subcategory) within the tab that was active when the tab was navigated away from. So first, the script (I just called it TabNavigation) saves where you were, and then it uses GotoObject. The parameter is the variable that is the same name as the tab being navigated to, which contains the name of the last button in that tab that was active.
The only thing is, just going to the button isn't enough. The search script has to be rerun to have the right records showing.
All of the subcategory buttons use the same script, and the search is defined by the parameters, so just calling the ButtonSearch script from the TabNavigation script won't work.
One thing I am considereing is just saving the search parameters used by ButtonSearch along with the name of the button, but it would be much, much simpler if there was just a script step that let me push a button.
The table I am looking at hold information on organizations, and contains all kinds of them. The three main categories are Facilities, Service Providers, and Meeting Organizers, and within each of those there are at least 6 subcategories. I know there are probably better ways to set up a navigation system (for example using virtual lists), and that the data should probably be more normalized. I plan on taking the time to redesign the database, but for now this would give me the results I need without having to create a lot of layouts or extra tables and logic.