Searching Keys in Dictionary

I have about 300 portals (basically web forums) that we use for customer support.
Each portal has a title like
CustomerName Support 01012022
The portion after the CustomerName can vary.
Also, same customername can have multiple portals, but not identical titles.
I want to be able to open the main portal url for a customer based on highlighted text or typed info if nothing highlighted.
I considered using Dictionary key/value pair to assign the URL to each portal title.
But I am not clear how to search the dictionary keys for partial title and list all the matches to choose one.
Example: Let's say Apple has 4 portals
Apple Support 01012020
Apple iPad Support 06012020
Apple iOS Support 10102021
Apple Mac 02022021

If I have the word Apple selected and run a macro to go to portal page,
I would want a popup to show all 4 options for me to choose from.

Is this something that can be easily done with Dictionary or should I use a text file and
run an applescript or python script to parse the info?

Mainly I am asking if Dictionary can be used in this way.
If not, I can work on other methods to get the job done.

Regards,
Brett

maybe a List prompt

or this one that uses a Dictionary:

I think mrpasini has a Text Expander with options, might be worth checking his/her posts

Hey Brett,

Don't use a dictionary. They are opaque and hard to manage.

Use a plain text file, or JSON, or as @hello suggests a Prompt With List action.

The latter would certainly be the most flexible to search.

-Chris

1 Like

Also, outside KM, aText is a nice app to display a list to choose items from:

https://trankynam.com/atext/

Just a clarification that the “dictionary-generated” list prompt macro mentioned above actually uses a plain text file, not a true dictionary within KM.

2 Likes

Many Thanks. I will work on the Prompt with List option using the examples provided.
If I run into any issues, I will post here.

Regards,
Brett

2 Likes

Thanks for the direction.
I was able to achieve my initial goal using the "FAVORITE DIRECTORIES" Macro.
I just had to change from file to URL.
Except the URL also has a : so the regex wasn't working.
I just remove the https:// from the URL in the text file and add it when opening in browser.
Could have tweaked regex, but this was quicker for me and temporary.

I think I will try to implement the JSON method (never used JSON so learning curve) since I have other pieces of data I would also like to quickly access related to the same portals.
Will start new topic if I have JSON questions.

Thanks for the support.

Regards,
Brett

1 Like