Macro: Quick Web Search—search the web via shortcuts

This macro allows you to search any number of web sites—there are 100ish included, with 18 active by default—in either your default browser or a number of others. Just press the hot keys (Control-Option-W by default), and you'll see the input box (shown below with the not usually visible help screen behind and below it):

You can easily change the active list, add new sites, and modify shortcuts, descriptions, and even URLs for the existing sites. All of that is done through the Shortcut Manager interface:

───────────────────────────────────────
__ Quick Web Search 1.5 Macros.kmmacros (1.4 MB)

Full instructions for use
───────────────────────────────────────

Version 1.5 (Dec 4 2023): Although this is only a .1 update, it was relatively major. I reviewed every bundled shortcut, fixing a number of URLs, and sadly removing one (Mac OS X Hints no longer exists :frowning: ). I also updated all the database related code to reflect what I've learned over the years, and did a lot of cleanup work, including removing two complete macros.

Older Releases

Version 1.4 released (Oct 9 2023): There was a big issue for anyone trying to install this macro from scratch: They couldn't. I have no idea what happened, but it looks like I had accidentally dragged some steps out of order when I released 1.3!

I also fixed two errors that broke the "return to prior menu" feature in a couple of the shortcut manager dialogs, and fixed an issue that prevented proper resetting of modified bundled (default or optional) shortcuts.

If you already have this macro installed, you can check for updates to get the new version.

Version 1.3 released (May 6 2023): Whoops, I left a "cancel macro" command in place, so the macro didn't work. I also found and fixed a major issue with a bit of code that lets me add new default (off, but available to use) search sites. As a result of fixing that, three new sites can be activated—Kirk McElhearn's (occasional Macworld writer) blog, MacObserver, and electric car site Teslarati. The in-app updater should work for this version.

Version 1.2 released (May 5 2023): I found and fixed an issue that would prevent adding or modifying shortcuts if your description included any single quotes. Whoops. Also converted a few variables from local to permanent for easier referencing, though I delete them at the end of each run. Please download 1.2 from the link at the end of this post and install it.

NOTICE: You will not be able to update to this version using the in-macro updater in v1.0, as I found a mistake in the code that caused the verification step to halt the macro. (I left in a reference to the old name of this macro, instead of using the new name.) This one time only, you'll have to update manually.

Version 1.1: This version wasn't ever released, I don't think. It did add three new shortcuts (see the read me or release notes for details).

Note: While this macro has a 1.x version number, it's not really a 1.x release. Instead, it's a major rewrite of my original text-string-based web search via shortcuts. As such, it's more like a 4.x version, and quite established and stable.

The UI in this new macro is nearly identical to the original macro, but behind the scenes, everything has changed: The shortcuts are now stored in a sqlite3 database, which greatly eases the maintenance and upgrading of the macro on my end, and let me remove a ton of ugly regex and file manipulation commands from the macro. (The old version stored everything in text files.)

For users, it should mean easier upgrades, easier customization, and perhaps slightly quicker performance.

I've been working on this off and on since the last release of the old macro, and what was holding me up was trying to write an importer that worked for existing users, to convert their text file structure into the new database. But try as I might, I never got it working well enough to ship, so I removed it. If you're a user of the old macro, you'll have to set up your shortcuts again in the new version—but that will be a one-time task, as those changes will remain through future updates.

The macro is attached (disabled, as usual), and it includes my macro update checker, so if/when I release updates to the macro, you'll be notified that there's a new version available.

If you use this and have issues, please let me know.

————————————

-rob.

10 Likes

Ooh, I look forward to exploring this -- thanks, Rob!

Thanks so much for this macro. I've used the old version since you posted and it is one I use many times throughout the day.

This is fantastic. Loved the earlier plugin, and upgraded as soon as I could!

I just released version 1.2, which contains some important bug fixes, as well as the new shortcuts that were added in 1.1 which I (whoops) never released. One of the important fixes is in the code that checks for and verifies updates, so you can't update from 1.0 to 1.2 using the in-macro updater. Instead, just download the full 1.2 version as linked at the end of the first post in this topic.

-rob.

1 Like

And version 1.2 has a boo-boo—I left a debugging "Cancel this macro" action in the "sub - main 03 - First run of this version" macro. Just delete that action, and things will work as expected. I'll release an update later today, after I figure out another issue I just noticed.

-rob.

Version 1.3 is out now, and the in-macro updater should see it if you installed 1.2. I fixed the cancel issue, and found and fix a problem that meant I couldn't ever add new sites to the existing list of optional sites to search. So now Teslarati, Kirkville, and Mac Observer are on the list of optional sites.

1 Like

Version 1.4 is out now, with a fix to a bad bug that prevented new installations, and a couple of less-important bug fixes. If you have the macro installed already, check for updates to download within the macro, or download here.

-rob.

2 Likes

When I click on Check for update, it brings me back to the same window

Do you see a notification item? It should show one:

-rob.

I'm not sure what you're asking.

Clicking on "Check for Update" takes me back to the same window shown in the original post.

Yes, it should - but it should show a notification at the top right of your display, as in my screenshot.

-rob.

But it doesn't on either of my computers.

Do you have notifications enabled for KM and KM Engine? What happens if you run the update macro within the macro?

image

-rob.

image

I didn't have notifications enabled.

But apparently I'm looking at a different macro. OK, I see that Web Search is no longer supported. I guess I'm not pushing it too hard and it's still working. Why should I change now? I see one new option which browser. That might be worthwhile since I'm looking at Arc. Now I see I already have that option—hadn't noticed it. Haven't decided how well I like Arc. I guess when they ask for money, I'll reevaluate. Safari is still my default browser. I'm getting to the point where I'd need a significant advantage to leave the walled garden.

Thank you for creating this. And sorry to run you in circles.

Web Search not supported? You mean the older version, like 1.x or 2.x? Yea, I migrated everything to mysqlite databases because the old one was impossible to maintain.

But if it's working for you, great. Arc won't work in the old one for sure, and not in the new one yet because each browser has to be coded in, and it hasn't been coded in yet. Just the ones shown in the help screen work.

-rob.

Thanks for this. It's been some time since I tried to update, so my questions may not make sense. The 4.0f update says no update available, which doesn't surprise me. But when I disabled that macro group and enabled 3.3, it told me no update was available as well. Is there an easy way for me to keep the custom searches I added to 4.0f if I install 1.4? Thanks again.

Laine, I sent a private message about this, as 4.0 was the beta numbering. I'm pretty sure your data is fine, but there are more details in the message about how I can be sure.

-rob.

1 Like

Version 1.5 is out now, with a ton of changes—almost none of which you'll see as a user, but all of which make the macro a bit quicker, and easier for me to manage.

Quick Web Search was the first sqlite3 database-connected macro I wrote, and it shows in a lot of the code I was using to manipulate the database. I have now replaced all of that code with my current methods. I also found spots where I wasn't using the database when I should be (i.e. still doing text field searches), so I changed those out.

I also went through every included shortcut and made sure they were correct; there are a few fixes in this release for things I found.

Update via the in-macro check for updates, or download the macro in the first post in this topic.

Full version 1.5 release notes
  • Improved the look of the layout window and help window combo—it now (sort of) looks unified.
  • Removed a number of now-unnecessary AppleScripts for working with windows positioning.
  • Updated a few URLs that were wrong in the bundled shortcuts.
  • Deleted Mac OS X Hints search (sigh) as the site has been removed from the net.
  • Fixed a bug related to resetting built-in shortcuts.
  • Changed how the list is generated in the "List Shortcuts" option in the shortcut manager.
  • Replaced database access subroutines with a more generalized version.
  • Revised some naming and layout to match how I write my other macros.
  • Removed one macro after doing some optimization. Removed another after discovering it wasn't called by anything at all!
  • Replaced a number of "temporary globals" with instance variables.
  • Updated the layout of the macros to match my updated style.

-rob.

1 Like

Thanks.

Are these the only steps I need to follow to upgrade so as not to lose any customizations?

  1. Install new 1.5 version of the Quick Web Search macro group.
  2. Disable existing version of Quick Web Search (for me, 1.4) macro group.
  3. Enable 1.5 version of the Quick Web Search macro group.

Thanks again.