Simple search function for phrases #727
Replies: 8 comments 13 replies
-
This was discussed recently somewhere here or on Gitter. It's a good idea. For now, since all all phrases and scripts are stored with plain text JSON metadata sidecar files, you can write a little bash code (or in any other language you prefer) to examine these files and produce whatever reports you like. If you'd like help doing this, come over to Gitter to discuss it further. You'd have to also look at the window filters for any triggers that are used multiple times. |
Beta Was this translation helpful? Give feedback.
-
Caspx contributed a script to the wiki that you can find on the https://github.com/autokey/autokey/wiki/Advanced-Scripts#searchPhrasesScripts page that opens a dialog that will search the titles of your phrases and scripts and returns a clickable list of matches so you can open the one you want from there. My copy of AutoKey has that script set to "Show in notification icon menu" so I don't have to hunt for it when I need it. I've got so many phrases and scripts that I'd be lost (or at least overworked) without it. It doesn't search abbreviations, but it probably wouldn't be much work to make it do that, too. It also doesn't do fuzzy searches. I have no idea how much work it would be to get it to do that, but am guessing that might be a bit of a wrestle. Either way, it's glorious as is and could also be a great start for what you're looking to do. |
Beta Was this translation helpful? Give feedback.
-
I seem to remember that that script used to open the selected script in the AutoKey editor, but I must be mistaken. If you run that script and use the radio-list to choose a phrase or script from the results, its contents will be printed to the currently-active window and it won't be opened in the AutoKey editor. Is there a way that that script can be modified to open the specified phrase or script in the AutoKey editor instead of printing its contents? I'm not seeing an API call for that. |
Beta Was this translation helpful? Give feedback.
-
Ah, I didn't realize there wasn't already such a thing. At any rate, what the script currently does is return a radio list of all matching phrases and/or scripts so you can select one to have its contents printed to the currently-active window. You can't copy the script's name from the radio list, but just have to remember it and go open the script in AutoKey if that's what you were wanting. My collection of phrases and scripts is so huge that I've used the script on and off for years now as a way to find out if I have a certain script in my collection and go to it, but that happens infrequently enough that I don't seem to remember that it doesn't take you to the chosen phrase/script. I suppose it wouldn't be a bad idea to convert the script so that it puts its output into a dialog rather than printing it to the currently-active window, because if someone were to do what I did and run the script while AutoKey is open and a script is focused, it will print right into that script. Here's my modification to just the try block in that script that offers four choices the user can pick from for how to display the result. The contents of the selection can be printed to the currently-active window or displayed in a dialog or the name of the selection can be printed to the currently-active window or displayed in a dialog. In this example, I've chose to display the name of the selection in a dialog: try:
with open(path) as f:
phrase = f.read()
"""Enable the following line to print the contents of the selection to the currently-active window:"""
# keyboard.send_keys(phrase)
"""Enable the following line to print the name of the selection to the currently-active window:"""
# keyboard.send_keys(choice)
"""Enable the following line to display the contents of the selection in a dialog:"""
# dialog.info_dialog(title='EXAMPLE', message=phrase)
"""Enable the following line to display the name of the selection in a dialog:"""
dialog.info_dialog(title='EXAMPLE', message=choice) |
Beta Was this translation helpful? Give feedback.
-
I suppose the following are probably not as elegant as you would like, but they might help you nonetheless. If you want something on your desktop, Recoll is fast and powerful. For a cloud solution perhaps you might upload your files to Google Drive, and then use Google Drive's search functionality.
|
Beta Was this translation helpful? Give feedback.
-
@Yekutiel recoll is a life saver. I don't use it very often, but it saves the day when I need it. I'm fond of the Linux CLI and bash, so if I needed anything like this request, I would code it in bash and maybe use fzf for fuzzy searching. Once you use it for a while, grep can really help. The options to print lines before and after each match are nice if you need context. |
Beta Was this translation helpful? Give feedback.
-
While there is some truth to your assessment of developers, we're not all like that. I had some very good (quite unexpected) luck with a KDE developer not so long ago and I have had several other good experiences. But there are plenty out there that match your description. There is rather limited overlap between coding ability and interpersonal skills. I prefer to do as much as possible on my local machines because I don't want anything unnecessary on the web for it to be mined or used for phishing... I like holding on to the illusion of privacy. I just looked at one of my scripts which uses fzf. The command itself is pretty simple although I do a bit of sed on its output to get it the way I want to use it. I use fzf to search my activity log which is a simple text based journal and I use it in a script bound to Ctrl+f to search my terminal command history. |
Beta Was this translation helpful? Give feedback.
-
On average, a couple of dozen times per week I use the terminal to run all sorts of simple commands; but generally I try to use AutoKey instead. fzf looks like it is the bees knees. However, I simply didn't want to go down that rabbit hole because I'm neither a developer, sys admin (er, uh, I mean DevOps engineer), nor do I want to become one. If someone made a nice GUI for fzf that I could wrap my head around, I'd be glad to use it. I tried a bunch of applications that were wrappers for fzf. Their convoluted "logic" was absurd. Recoll actually worked very, very well for me. But I don't need it. Google Drive does what I need. In some ways (but not all ways) searching through my AutoKey scripts (Python scripts) on Google Drive actually works better than Recoll. I think that's because Google Drive uses some fuzzy logic that Recoll doesn't. But the Recoll dev did put some spiffy UI/UX features into Recoll which Google Drive is sorely missing. I think Americans obsession with privacy are inane. Unless you are a terrorist, criminal, etc what good is all of this alleged privacy? And, of course, if some powerful official in the government wants to get you, he will. But does the chief of police, or some general in the US Army want to do you harm? I doubt it. That being said, all things being equal, I would prefer not to use clouds much at all because why depend on some company "out there", which might change their policies, go bankrupt, etc, when you can control stuff yourself? Nonetheless, generally, I'd rather use some clouds than deal with the headaches and hassles of not using clouds. I use Google Workspace (primarily Gmail, Google Docs, and Google Sheets) throughout my workdays. For $0 for the last 15 years or so, I have not had to deal with any of headaches and hassles like I used to in the "bad old days." I would gladly pay $10/month or even $25/month for Google Workspace, but Google keeps giving me what I need for free. I am not complaining! I hated dealing with Windows, Mac, MS-DOS, and even, yeah, CP/M. Now I use Linux. I hate dealing with Linux too... but, I hate it less than any other operating system I've ever dealt with. Linux Mint 21.2 Cinnamon is far from delightful. I really do not like it. However, it's much less hassle operating system than I've ever dealt with. A decade ago I was hoping I'd be able to simply use a Chromebook, but, alas, I want/need a bunch of features Chromebooks don't offer. Also, the security ordinary versions of Linux offers is very, very reassuring. (Yes, I know Chromebooks run on Linux, yet throngs of nerds outside of Google aren't able to review it as they can with ordinary versions of Linux). See, although privacy per se doesn't worry me; hackers do worry me. They definitely worry me because they can steal my money and my identity. Sure I could run Thunderbird, LibreOffice Writer, and LibreOffice Calc, but then I would have way, way, way more headaches and hassles. Been there, done that... for many, many years. It's kind of the whole "Cattle not Pets" argument. The History of Pets vs Cattle and How to Use the Analogy Properly. Playing with computers isn't a hobby for me; it's a hassle.
That's a polite way of phrasing it. I unapologetically attack arrogant (and concomitantly ignorant) engineers with a ferocity that actually surprises myself. The fact that AutoKey lacks a simple, built-in method for searching is an excellent example of why I generally despise engineers. How difficult would it be to have such a feature? Sure, searching millions of records quickly is difficult. But I would guess the average user of AutoKey has no more than a few hundred scripts. Therefore, an ordinary, old, simple, slow search application would suffice for most users' needs. For example, I tried to get the developer of Recoll to work with the developer of CopyQ (a very powerful clipboard, with a bad GUI which the dev refused to improve, despite my helpful suggestions) so that CopyQ would be able to use Recoll's search functionality. Neither dev was interested in working with the other. They enjoy being the Lord of the Manor. They are generally arrogant jerks who despise end users. I've worked with precisely two excellent engineers in my life who, believe it or not, actually happened to be very nice, very humble guys. The rest of the engineers I have worked with have been bad and/or arrogant. When dealing with engineers my policy is simple: they are guilty until proven innocent. |
Beta Was this translation helpful? Give feedback.
-
Hi guys,
Really love autokey, use it everyday. Saves my day all the time.
Because of this, I now have quite a lot of phrases that I use and don't always remember exactly how I named them etc.
Would be great then to have a simple search function to search for phrases. The search would return results if the key I'm searching for is part of either the phrase "name" or "abbreviation".
The search would be better if it was a "fuzzy" search but if not would still be useful.
Just a thought!
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions