MACRO: Abbreviation-Based Web Searches

Sadly, I usually use in the context of a text editor, and it fails badly with VS Code.

-rob.

Ah, Microsoft and Electron! :frowning: Didn’t know Mac developers were allowed to have that installed.

Maybe you need a Patreon page to raise money for BBEdit. :wink:

Hehe. I'm not our developer, Peter is. I do the all-but-code, basically. I love BBEdit for many tasks (it updates my macOS release dates blog entry), but it's serious overkill for simple tasks, and because it's so feature-rich, the menus are long and complex.

-rob.

1 Like

I'm totally jumping in blind here - I didn't read any of the previous comments. The only reason I'm even here is this is one of those threads that won't die, so I decided to see what everyone was talking about. And you're talking about one of my favorite subjects! Text and Code Editors!

I was a Windows developer for most of my life (I'm retired now), which means I know how much there is to dislike about Microsoft and Windows.

But one thing Microsoft knows how to do is make IDEs. Working in Visual Studio was a joy, and I'm thrilled to have VS Code on my Mac. I have nothing bad to say about it, and that's saying something. Wait.. ah, you know what I mean. :laughing:

I recently had to install VS Code in a couple of Parallels virtual machines (running various macOSes). Using their Sync Settings feature, it took next to no time at all. I LOVE VS Code.

Maybe you need a Patreon page to raise money for BBEdit. :wink:

I love BBEdit too, and it's my go-to for when I'm not developing something in VS Code. There's no reason not to have both.

Sorry about the rant - it's just that I've spent the last month and a half coding a complex Custom HTML Prompt using VS Code, so it's near and dear to my heart.

I have both too, I was just having a little fun with @griffman.

Regarding MS software, I've used Excel (heavily) throughout my engineering career. And in general it's not as easy to poke fun at them because they're actually putting out some great stuff, e.g., VSC, Power BI. Fortunately there's Word and it's as bad as ever. :wink:

@griffman, you might be sick of this topic by now, but for the record—the selection technique used in Augment or Filter Text and Log It works fine in VSC. I wonder what's different for you.

Getting Selected Text.kmactions (9.3 KB)

Macro Actions-image

Sorry, didn't mean your method, I meant my method of just checking for the Copy menu's active status. I prefer not to copy stuff to the clipboard unless needed—on my Mac, that launches the decrufting macro (which bails quickly if it's not a URL, but it still launches). I like the Copy menu method because it's totally passive.

-rob.

1 Like

Thanks for the clarification. I hadn't thought of that. That The system clipboard changes comes at a price.

But, you've go me thinking—maybe I should put a warning in my macros that temporally use the System Clipboard (and, if used, restore in with Delete Clipboard 0.)

No kidding. I finally switched to LibreOffice, and I couldn't be happier.

1 Like

Thanks Rob, I understand. I'll try to come up with my own macro for multi searches.

While not nearly as fancy as Rob's impressive macro, it's not too hard to put together something that can do multi searches:

[Example] Copy Selected Text and Search Multiple Sites.kmmacros (2.3 KB)

2 Likes

While it may seem I've been quiet lately with Web Search via Shortcut, that's not the case at all. It's just that I was frustrated by how hard it was to keep my own copy of the macro customized, given how often I was updating it, and having to always have a clean copy ready for distribution.

So I set out to rebuild it from the ground up, with a few objectives:

  • Speed. While the old macro wasn't all that slow, there was just a bit of a delay between invoking it and seeing the input dialog.
  • Shortcut Management. It's a real pain having to open the Keyboard Maestro editor and directly update variables to make changes to your shortcuts. And it's a real pain when an update comes out, and you have to copy-paste all your work between the old and new macros. I wanted to get rid of all that.
  • Ease of use. This is tied into easier updating of your shortcuts, of course, but I wanted an easy way for users to be able to add shortcuts without having to go dig up their own.

So instead of trying to make 2.5 do all of those things, I threw away pretty much all of it except for the actual input processor, and started working on 3.0. It is not quite ready, but it's close, and I'm looking for some testers — if you'd like to test it, just reply here and I'll give you the URL. Do not delete your existing 2.5 macro, just disable it (or assign it to another shortcut).

It addresses all of the above; here's a teaser for the speed side—this is how long it takes for the dialog to appear after you hit the hot key:


The new input dialog appears basically instantly, over 5x faster than the old. And as for management of shortcuts, that's now 100% within the macro, not in the editor at all:

The current version is nearly fully functional, but it needs a lot of polish, as well as some how-to instructions, etc. But I'd like others to use it, to help find things that I know I've missed. So reply here or message me, and I'll send you a link and some basic instructions.

Many thanks to @Lantro for his invaluable assistance in getting to this point—this macro is just a bit more complicated than the 2.x series (28 macros vs 10 macros). Without his help, I'm not sure I would've gotten here :).

-rob.

Whoa, this is amazing! I have in fact gotten ahead of the dialog a couple of times, typing my search term before it was ready for me, so the speed increase is great news.

I hadn't been going to bother you with it, but so long as you're massively revising anyway: if I search for a "quoted phrase," the macro works if I include the search site shortcut, but chokes on the quotation mark (I presume; a "search regular expression" action throws an error) if I omit it to use my default. (Google. I know, I know, don't @ me.) If that's easily fixable, great; if not, it's not that hard to include the shortcut.

I'm happy to test the new version, but tbh I wouldn't really be putting it through its paces; I really like the macro but I don't run it that often, and usually on the same site. LMK if I can be of help; otherwise I'll just happily anticipate.

That should be a simple fix ... yep, simple, and now fixed. So it'll work in 3.x, and I may push a final 2.6 update to fix that (and which addresses a couple other things).

Thanks for the heads up!

-rob.

And 2.6 is out now, with the default search quote fix, and a couple other things—one minor, one pretty major.

The minor one is that the search dialog now appears on the display with the mouse, instead of the display with the frontmost window. I found, at least on my multi-display setup, that my eyes are more often where the mouse is than where the frontmost window is. Maybe in 3.0 this can be a pref.

The major change is that the number of active default shortcuts is down from over 40 to just 18—I figure nobody uses 40+ shortcuts. But I didn't delete them; open user-Shortcuts, and you'll find those (along with a bunch more), mostly ready to go. Just copy, replace the ?? with a shortcut of your choice, and paste into your additions box.

This was partially to better match 3.0, which has that same smaller set, but also because it was just silly to include 40+ enabled by default.

As mentioned above, 3.0 is imminent, so this is the last 2.x release.

-rob.

And 2.7 is out now, due to me stupidly—but accidentally—changing the keyboard shortcut in 2.6.

-rob.

It's finally done…well, done enough to release to see what wasn't actually done. 3.0 is out now, and should show up as an update if you check from 2.7's updater. I've also put the new version in the first post in this thread.

As stated above, the dialog shows up nearly instantly now, and there's an in-macro Shortcut Manager for handling all shortcut-related tasks. There's also an online help page to get you started, and help those who need to migrate custom shortcuts to the new version.

This is, by far, the most complex macro I've ever written—the Shortcut Manager side is much larger and more complicated than the macro itself, but the end result is something that should be easily updated in the future; there won't be anything to do to migrate customized shortcuts when a new release comes out.

If you do try it, please let me know what issues you run into—even though @Lantro (thansk for all the help!) and I did a lot of testing, I'm sure there's stuff we missed. How much testing? Well, here's my macro usage counter report covering some of the version 3 builds...

That's a lot of web searching without actually ever searching the web! :slight_smile:

-rob.

1 Like

@griffman, just downloaded v3.0 and am checking it out.

First impressions: WOW, very polished design and high quality documentation! Great work on the implementation of user-modifications.

If I do encounter any issues I'll certainly let you know. Thanks so much for sharing your hard work.

Thanks for the comments! I'm pretty happy with how the Shortcut Manager turned out, working within the constraints of Prompt With List (i.e. can't capture the Escape key cancel).

-rob.

Hi Rob,

I have just loaded and installed the macros. Thanks first for all of your work!

As I am from Germany, I'd like to adapt some searches and direct them to German pages. But so far I haven't managed to do that yet...

I am proceeding as follows: I call up the Manager and select "Modify a shortcut's settings" there.

Then I select the shortcut, e.g. Wikipedia:

There I change the URL to "https://de.wikipedia..."

As soon as I click "OK" I get the following error message:

A change does not take place, I can only create a new shortcut.

Michael.