acantor Posted December 18, 2023 Report Share Posted December 18, 2023 A few years ago, Insight added "Set Value from List" to the "Variable Set String" instruction: Variable Set String %Item%: from List So far, I've found one practical use of this: to quickly invoke the commands I use most often in Word and PowerPoint. For me, this is a better option than the alternatives: click-click-click through endless menus and ribbons; press unwieldy sequences of keys to navigate through menus and ribbons; or memorize hotkeys. (And not every action I perform is assigned a hotkey.) I made two versions of the same macro, one for Word, the other for PowerPoint. Each script makes it easy to choose one of about 20 commands by pressing as few as two keystrokes. (Another alternative would be to use Macro Express to create hotkeys for each action. But with 20 * 2 = 40 commands, that's a lot to memorize.) Is anyone else using Set Value from List? And if so, how are you using it? Quote Link to comment Share on other sites More sharing options...
Samrae Posted December 19, 2023 Report Share Posted December 19, 2023 I use it to display a list of companies. When I select one the macro opens the correct website and gets ready to type login credentials. Quote Link to comment Share on other sites More sharing options...
acantor Posted December 20, 2023 Author Report Share Posted December 20, 2023 4 hours ago, Samrae said: I use it to display a list of companies. When I select one the macro opens the correct website and gets ready to type login credentials. Good idea! When the list appears, do you use the mouse or the keyboard to select a company name? Or a combo? Quote Link to comment Share on other sites More sharing options...
Samrae Posted December 20, 2023 Report Share Posted December 20, 2023 I type the first letter and then either click the down arrow icon to expand the list or press the down arrow key repeatedly. Quote Link to comment Share on other sites More sharing options...
acantor Posted December 22, 2023 Author Report Share Posted December 22, 2023 There's another way to navigate directly to the desired list item: The list supports incremental searches. These searches always start from the leftmost character on each line of the list. For example, if this is the list: Almond Apple Apricot Avocado You can reach "avocado" by typing its first two letters: "av". This is less work than pressing "a", then Down three times. Similarly, you can reach "apricot" by typing "apr". This works because the third letter is what distinguishes "apricot" from "apple". A good naming convention makes choosing a list item efficient and intuitive. A list like the following will never require more than two key presses to choose any item, even if the list contains hundreds or thousands of items: aa ab ac ad ... az ba bb ... zy zz I have a Macro Express script to automate tasks in Word. The start of the list looks something like this: a AutoCorrect b Bullets c Crop cc Center-center align cl Center-left align co Columns cu Customize ... Therefore, commands are activated by pressing sequences of either only three or four keys: 1. The hotkey to start the macro 2. The first one (or two) letters of the list item I want. 3. Enter. Incremental searches rock! Quote Link to comment Share on other sites More sharing options...
Samrae Posted December 22, 2023 Report Share Posted December 22, 2023 Thank you acantor! Until now I did not know that incremental searches work in that list. Upon further experimentation it turns out that if you type quickly enough it works. But, if you type too slowly it may not. For example, if I type "ve" it brings up "Venmo" but if I type "v" ... "e" it brings up Enphase. Now that I know I'll try to get these old fingers to type quicker. 😉 Quote Link to comment Share on other sites More sharing options...
acantor Posted December 22, 2023 Author Report Share Posted December 22, 2023 A good naming convention goes a long way toward reducing the need to type quickly, or to type multiple characters. I try to use unique, single characters at the start of each list item: 1 Single-spaced 2 Double-spaced a Auto-correct b Bullets c Crop ... k Columns (Notice I used K for columns to avoid a conflict with C for crop.) My macro locates the location of the first space in the string, copies the string to a variable, and then uses the value to decide what to do... Variable Set String %x%: from List Variable Set Integer %SpacePosition% to the position of " " in %x% Variable Modify Integer: %SpacePosition% = %SpacePosition% - 1 Variable Modify String: Copy part of text in %x% starting at 1 and %SpacePosition% characters long to %y% Switch( %y% ) Case: a // AutoCorrect // [Do something] End Case Case: b // Bullets // [Do something] End Case Case: c // Crop // [Do something] End Case etc. 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.