Find dictionary from variable

rd2k3

New member
If I need to get a key for a new variable from a dictionary of 300 entries, for example, there is no way to find the key. I have to look 1 by 1, scrooling.

Its possible add find funcion?
 

rd2k3

New member
workaround: you write the entrys in a file and use the search function there.
I understand and appreciate the idea, but it doesn't solve it. It's not just about finding a word. It turns out that when generating a variable, I am forced to go through 300 entries looking one by one. And even if you know approximately where the text is, it's still a lot of work, since several names are very similar in the dictionary.

remembering that a dictionary is made up of key and value. A file does not
 

Attachments

  • Screenshot_20240213-211828.png
    Screenshot_20240213-211828.png
    263.5 KB · Views: 15

Vix

Member
I understand and appreciate the idea, but it doesn't solve it. It's not just about finding a word. It turns out that when generating a variable, I am forced to go through 300 entries looking one by one. And even if you know approximately where the text is, it's still a lot of work, since several names are very similar in the dictionary.

remembering that a dictionary is made up of key and value. A file does not
do you mean to sort or to filter dictionary/array?
 

hsurB

Well-known member
I guess you could run iterate dictionary/array action to show iterator's value and/or iterator's key when iterator's key = key you are looking for. Still not the best but at least macro will find it for you 🙆‍♂️
 

rd2k3

New member
I guess you could run iterate dictionary/array action to show iterator's value and/or iterator's key when iterator's key = key you are looking for. Still not the best but at least macro will find it for you 🙆‍♂️
I'll take a look at this, thanks
 

mapriex

Active member
I understand and appreciate the idea, but it doesn't solve it. It's not just about finding a word. It turns out that when generating a variable, I am forced to go through 300 entries looking one by one. And even if you know approximately where the text is, it's still a lot of work, since several names are very similar in the dictionary.

remembering that a dictionary is made up of key and value. A file does not
ok, the problem is that you aren't able to work with the dictonary and not only to find a value. the idea is that you use a dict., find a key, change the value and use the value to execute.
so you want to reverse the screen reader to "screen writer" and execute the screen writed section with the new value.
 

rd2k3

New member
Honestly, I was very confused by what you described mapriex. Anyway, I think we're getting away from the main topic (I created more than 100 macros, but I hadn't really worked directly with dictionaries, except sending all entries to a string and finding if the word X exists in there)

Everyone here tries to help with alternative solutions and that's great, but it's not the kind of situation that I can't resolve (don't get me wrong, I'm very grateful). I can simply run the radioboxes 1 by 1 and look for what I want... or even do it in the suggested ways

The main issue is that depending on what I add to the variable, I may or may not have a search box (as in the 2 images)

Simply, I suggest adding a search box when I pull a dictionary for a variable

I don't think it's something that complex (I hope 😆)
 

Attachments

  • Screenshot_20240214-091515.png
    Screenshot_20240214-091515.png
    172.1 KB · Views: 11
  • Screenshot_20240214-091537.png
    Screenshot_20240214-091537.png
    237.5 KB · Views: 11
Last edited:

hsurB

Well-known member
In case you didn't manage to create macro I suggested I created it for you.
It asks you what key are you looking for and then it finds its value, shows it in pop up message or you can find it in local variables at the bottom if you need to copy it.
Note that what you wrote in prompt has to matches the key. You could change compare value action so it was contains instead = for exemple but if you have multiple keys that contain the word it will only show the last one. That would require remaking the macro so it was creating another array with results. There might be macros like that in templates/somewhere here on forum.

Remember to configure iterate action to change it for your array/dictionary

Edit. When setting up actions instead looking for a key on the list you can just use define manually and write the key there in correct format
 

Attachments

  • Search_in_array-dictionary (1).macro
    5.3 KB · Views: 6
  • Screenshot_20240215_042456_MacroDroid.png
    Screenshot_20240215_042456_MacroDroid.png
    208.5 KB · Views: 18
Last edited:

rd2k3

New member
In case you didn't manage to create macro I suggested I created it for you.
It asks you what key are you looking for and then it finds its value, shows it in pop up message or you can find it in local variables at the bottom if you need to copy it.
Note that what you wrote in prompt has to matches the key. You could change compare value action so it was contains instead = for exemple but if you have multiple keys that contain the word it will only show the last one. That would require remaking the macro so it was creating another array with results. There might be macros like that in templates/somewhere here on forum.

Remember to configure iterate action to change it for your array/dictionary

Edit. When setting up actions instead looking for a key on the list you can just use define manually and write the key there in correct format

I understood what you explained. But my question still remains: why use 9 lines of programming when I can only use 2, simply add a find button?

I read the screen, generate 228 entries and manually choose a variable that has the find button inside it.

I think it would be an extremely interesting and useful role

But don't worry, the macro in question was created and working 100% before I even posted the first topic. The suggestion was for future reference

Thank you to everyone who collaborated. This shows a strong and united community. I love macrodroid and all its members
 

Attachments

  • Screenshot_20240215-143604.png
    Screenshot_20240215-143604.png
    166.5 KB · Views: 9

hsurB

Well-known member
I understood what you explained. But my question still remains: why use 9 lines of programming when I can only use 2, simply add a find button?

I read the screen, generate 228 entries and manually choose a variable that has the find button inside it.

I think it would be an extremely interesting and useful role

But don't worry, the macro in question was created and working 100% before I even posted the first topic. The suggestion was for future reference

Thank you to everyone who collaborated. This shows a strong and united community. I love macrodroid and all its members

It should be added, no doubt.
Sorry
Just wanted to make sure you have workaround for now 😅
 
Top