MACRO: Abbreviation-Based Web Searches

This is how I did it already :stuck_out_tongue_winking_eye:

Version 3.1 is out now; check for updates within the Shortcut Manager, or download via the link in the first post above.

This fixes the "can't modify without changing the shortcut" bug, and makes a couple other minor changes.

-rob.

1 Like

So, now I had the opportunity to install the update and: it works like a charm. Thanks a lot, Rob!

Thanks!

-rob.

3.2 is out now (linked above, and check for updates in the macro). I found a couple glitches in the remove and modify routines; those have hopefully been squashed.

-rob.

1 Like

And ... 3.3 is out, sorry!

The fix I made in 3.2 had unintended consequences and broke stuff elsewhere (specifically when modifying and/or removing built-in shortcuts). This release both fixes the bug and repairs any damage that 3.2 might have done to your ws_deletes.txt file. Please let me know if you have issues with this version!

As a related note, this is (hopefully!) the final release in the 3.x series. As I was writing the 3.0 version, with the in-macro shortcut manager, the amount of regular expression manipulation I had to do to make some things work was just so complicated. Even as I was writing it, I was worried about maintainability. And both of the recent bugs were directly related to the regular expressions not doing exactly what I thought they would be doing.

As just one example, this is just part of the code needed to display a list of disabled built-in shortcuts:

And the 3.x macro is littered with probably 100+ sections like this, all needed to split and deal with the various shortcut types (built in, optional list, or user added). Version 4 migrates the entire back-end of the macro into a sqlite3 database—sqlite3 is built into macOS, and it's really fast and supports SQL queries. So I'm able to replace the gibberish above with something like this:

select shortcut, descrip, url from TheShortcuts where
(source='DEFAULT' and status='INACTIVE');

This is so much easier and more maintainable ... yet again, it's how I should have written it in the first place. No more text file manipulation, either; records get read from and written to the database itself.

To keep the speed up, the database is only accessed when necessary—once to set a global variable with the active shortcut list, and then when you make any changes to your shortcuts. Just using the macro, though, the database is never touched, so this version is just as fast as the prior—and actually faster when changing things, because there's so much less text manipulation to do.

The macro itself is done; I'm writing the converter that will migrate the 3.x files into the database, so you won't have any work to do when you upgrade.

-rob.

5 Likes

Following up a long time in the future with an announcement that contains both bad news and good news.

First, the bad news: This macro has reached its end-of-life at version 3.3. I found it nearly impossible to maintain and update, given the complexity of manipulating the text strings in the files I was using to track shortcuts. If you're using it, it should continue to work fine, but there won't be any more updates.

Now, the good news: I have rewritten the engine behind the macro, switching from text files to a sqlite3 database. This let me remove hundreds of commands, many of which contained scary regex. And although the new macro looks identical to the old, the UI is really the only part that hasn't changed. Given how much is new, I chose to branch to a new macro, so ... if you want to try the new macro (both should coexist just fine), check it out here:

Quick Web Search 1.0

There is one additional bit of bad news: I wasn't able to write a functional importer to move your customized shortcuts from the old macro to the new macro. I tried, I really did—that's what was holding up the release. But every time I thought I had it working well, I found another issue. In the end, it just wasn't feasible (for my skill level), so I had to leave it out.

So you'll have to customize your shortcuts one more time in the new macro, but those changes are then stored in the database, and should be good through all future updates (famous last words, I know).

Anyway, thanks for the feedback on this version, and if you try the new one, please let me know how it works for you.

-rob.

3 Likes