mrpaperplate Posted October 17, 2008 Report Share Posted October 17, 2008 I didn't know where to put this so I thought I would just post it here. Basically I wrote this script to search for certain text strings in a drop down list. I use it on the software where I work because some of the drop down lists we work with contain many entries, (1000+) and the software provides no way to search for the items other than scrolling by hand. With the way I have this set up now the script will run through 1000 entries in about 17 seconds. I couldn't figure out a way to make it stop arrowing down at the end of the list since the last item on the list is never known. If anyone has any ideas, I'm open to suggestion. To use this in your own environment, you'll have to re-"get controls" and change the title of the window to be activated. Enjoy. FindTextInDropDown.mex Quote Link to comment Share on other sites More sharing options...
stevecasper Posted October 28, 2008 Report Share Posted October 28, 2008 I'm not very familiar with scripts (I just started toying with them about 2 days ago), so this may not help you at all. However, with Macro Express, I have macros that do something similar to what you described, and when it gets to the end of a list after tabbing through, I am able to get it to stop by using a comparison. Example, %T1% collects "DATA001", then it collects "DATA002", etc. Well if there are 5 pieces of data, let's say, it will eventually collect DATA005, then the next run will collect DATA005 again, which is what we want to avoid, so to prevent that I do the following. Variable Set String %T1% "" Variable Set String %T2% "" Repeat Until %T1% <> %T1% // ->Change this Remark to whatever command you will use to collect Data001 etc. and then set that data to %T1% <- If Variable %T1% = variable %T2% Break End If Variable Set String %T2% "%T1%" // -> Add any additional code here (such as <TAB> or <ARROWD> or whatever) <- Repeat End Of course, this doesn't have to be Repeats, it could be Text File Process, etc. Again, I don't know very much about scripts at all, so I'm not sure if this helps, but if it does, I'm glad to have been of service! Quote Link to comment Share on other sites More sharing options...
mrpaperplate Posted January 6, 2009 Author Report Share Posted January 6, 2009 I forgot that I posted this question. I ended up doing some trial and error and going over a few other macros and the attached is what I came up with. Anyone who wants to use this will have to change the window title activation, or remove it altogether. Basically the way the script works is by prompting the user for the text s/he wishes to find in the drop-down list. It then saves the drop-down control to C3. Then during the process it compares the text from the prompt to the current text. If there is no match it arrows down and tries again. There is also an option to start from the beginning of the list (by hitting the home key) or just keep searching from the location. At my work we use a POS Front End called Future POS (Point of Sale.) Some of the menus we create contain 1000's of buttons and so searching through a single drop-down can become monotonous. The way I have the search setup now is based on the list item only "containing" part of the text and not an exact match. Have fun with this and let me know if you can think of a faster way of doing this. It's pretty fast as it is, but I'm sure there is always a better/faster way. Enjoy! FindTextInADropDownList.mex Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.