A Problem Hook Is Having With HoudahSpot

I think I see the problem Hook is having with HoudahSpot. The huge problem that Hook scripting is creating for me is that, I am using HoudahSpot to open a collection of many files in a saved search. I am not using HoudahSpot in this way to look for one specific item.

From the following script that Hook is using, HoudahSpot is looking to make a selection. It is at the very least assuming that the user must have made a selection as shown in the statement, “ set mySelection to selection, if mySelection is not {} then”. This assumes that there is any way to have a HoudahSpot search not have at least one item selected. To my knowledge, there is always a selected item in a found set depending on the default search parameters in the found set of files.

When I trigger a HoudahSpot search on all supporting evidence for example, I want to be able to look through all the documents I have in various places with the tag “evidence”. I want a focused collection of files to look through and not a specific, single, file. Of course HoudahSpot can also find specific files but for this type of a saved search, it is about finding a set or a group of files, not a single file. This is one very nice feature in HoudahSpot. I can take the time to remember how to find important files, put them under a single search, and then be able to trigger that search on demand.

But this is not what HoudahSpot linked searches do as default behavior using a Hook Link. Hook links with HoudahSpot opened the search and selects the first selected content of a single file and not the open HoudahSpot document that is currently running the search.

Looking at the script, I think I see why now. I just don’t know what to do about it.

tell application id "com.houdah.HoudahSpot4"
                set mySelection to selection
                if mySelection is not {} then
                    set myPath to name of first item of mySelection
                    set p to name of first document
                end if
                end tell

I don’t know if there are other ways to do a saved search in Houdah Spot. What I do is use File > Save As … in HS v5, which saves a file with the .hssearch extension in the same place in Finder where Spotlight saves its searches. That place is ~/Library/Saved Searches. I can Hook to my .hssearch file and when I click the link in Hook for that file, Houdah Spot v5 opens and loads the search results with all the documents previously found.


Yes there are other ways, although it doesn’t change what I am saying. And as to that, I may not have clearly stated my point. A Hook link can trigger a HoudahSpot file and a HoudahSpot file launches what it was saved to do, be it a saved search or a template file.

My comment was intended to say that, once the HoudahSpot search comes up, you are no longer linked back to the original (linked) document. That was my meaning when I wrote of it not being a permanent link. What I was saying, and probably saying badly, was that, if you try and set a Hook link in your found HoudahSpot search results, you are only going to get a single found item to link back to the next time and not the whole HoudahSpot search.

As to other ways to do this in HoudahSpot, go to HoudahSpot “Templates” menu, bottom of menu, select "manage templates. Click bottom of window on “Open templates in Finder”. Single click that is, select without opening, any HoudahSpot template file in that folder, use Hook to copy that link, and paste that Hook link into a Hooked document. Works for me.

With HoudahSpot I can save a search in different places as I like as they are just files and do not have to be in a special folder. By saving searches as templates, this is the HoudahSpot naming convention that means the file is a saved search that is going to be placed in your side panel.

1 Like

Hi @levelbest. You can deselect a HoudahSpot search resource by ⌘clicking it. You should in principle be able to link to and from search templates. Scripts version 66 should have had a touchup for that (we’re at version 68 now). This was verified on a dev machine here; but my verification doesn’t match. I’ll look at the dev script and update here asap.

Thanks. Good to know.

Actually, the script looks fine for working with HoudahSpot 5. you can link to saved HoudahSpot 5 searches. The issue I encountered with HoudahSpot 5 is that one can’t link to its built-in searches because they don’t have a visible address. (Perhaps they are part of the HoudahSpot binary.) Hook can link to saved searches. This IMO is fine and more or less as one would technically expect, given how HoudahSpot is implemented.

I think this is consistent with your previous comment
So, to link to HoudahSpot 5 searches, just make sure that the search is in fact saved to disk.

We’ll report back on HoudahSpot 4 later.

Yes, it does all that. I think I badly misspoke if I gave the impression that it didn’t. Yes, Hook can hook a HoudahSpot file, either saved or template. HoudahSpot comes with several built in templates. Templates is the term HoudahSpot uses for its saved search files.You can also add templates (saved searches) to your hearts content. A HoudahSpot template is the same as the built in search that you are referencing as far as I know so, I don’t understand what you are saying here?

My point was probably a lost cause from the moment that I uttered it. Sigh, I try to keep on good terms with my brain, but sometimes it just goes it’s own way. :wink:

I was thinking in terms of the activated search and how an activated search, once launched in HoudahSpot, does not have a Hook link so there was a break in the Hook to a HoudahSpot search to … get back to your Hook grouping (other than the usual way on a Mac).

I was focusing perhaps too literally on the Hook concept and thinking that once you opened a HoudahSpot search, why couldn’t you just continue with all the other Hook linked items after that? Of course you can’t once you are in a HoudahSpot search but you can once you return to one of your other linked documents in the Hooked set.

And BTW, I am using HoudahSpot v5. But this was the default behavior in HS v4 as well.