Solved: Need Help with new macro

I am trying to do a new macro but really don’t know where or how to start.

I have a list of about 200 companies and their stock symbol. I would like to create a table/array/list? and be able to search by name and have it return the symbol.

Apple Inc,APPL;
Alphabet Inc,GOOGL;

macOS Monterey Version 12.1 Keyboard Maestro version 10.02

If you want to write your own macro, you need to translate your step-by-step workflow into KM actions.
You may need this to start:

Here is what I come up with after a lot of searching. The first action is just for testing and I have only loaded 4 business. Any suggestions or improvements? Also any ideal what will happen to response when I add 200 business?

Sorry, I misunderstood you for my poor English.
You may need this TextExpansion macro instead of Choose File From Folder macro:


1 Like

Format your list like this, with two underscores between the stock symbol and company name:


Once you have the list, you can use a single Prompt with List action to display and search the company names (you can keep the list in a KM variable, text file, or the Prompt action itself; it doesn't matter) and selecting one will return the company's stock symbol.

Example Macro.kmmacros (1.4 KB)



In the background, I try to solve these, in my own way. Sometimes I won't post as to not embarrass myself. :slight_smile: Here is my attempt to use regex. I'm sure there is a better way to match the pattern without the extra step but I was able to get results with this macro. I'll keep on my regex path though.

Symbol Search.kmmacros (6.9 KB)

Edited to add: I could have used this: (?<=,).*(?=;)