Crazy suggestion: accept links in search boxes

No—I was spending ages trying to ensure my previous post made some sort of sense! I have done now… I’m getting some rather “challenging” results. It may be because I’m unsure where I should be selecting the group (presumably not in the sidebar)—but even so, I get quite a lot of blank results and then one massive list of individual groups. As quite a few of those are identical (e.g., there’s a Photos group under many of the individual year groups) I guess if @rufus123 has a similar situation it may be better to have group “paths”. However, as I say, it’s not my problem and I don’t want to distract from @rufus123 's quest.

Stephen

The selection should be made in the item list. That’s a general rule for scripting a selection.
The Navigate sidebar is for… navigating :wink:

Here’s a version for multiple selected groups…

set od to AppleScript's text item delimiters
tell application id "DNtp"
	set groupList to {}
	repeat with theRecord in (selected records)
		set recLoc to {location, name} of theRecord
		set recLoc to recLoc as string
		set subGroupNames to (name of ((parents of current database) whose (location contains recLoc)))
		if my splitlist(subGroupNames) ≠ "" then
			copy (subGroupNames as string) to end of groupList
		else
			display alert (name of theRecord as string) & " has no subgroups."
		end if
		set AppleScript's text item delimiters to od
	end repeat
	set the clipboard to (groupList as string)
end tell

on splitlist(theList)
	set AppleScript's text item delimiters to linefeed
	return theList as string
end splitlist

PS: I’m interating over concepts here, and hopefully showing that iteration with subsequent scripts.

  • The first was a simple return of results.
  • The second utilizing the set the clipboard command and some small error trapping, including prompting for a singular selection.
  • The third handling multiple selections and utilizing a handler to swap text delimiters.

There’s not enough info provided to code for a specific situation and you know I prefer to teach a man to fish whenever possible.
:slight_smile:

Yes—I have to remember that!

That does things, with a helpful error message too.

I’m still a little at sea about exactly what @rufus123 wants so really should leave it to him to explain more if necessary.

You do! I’ve learned an awful lot from you that way: more than once I’ve been sweating over your examples wresting them into what I need. But it’s really an excellent way to learn.

Stephen

Though I didn’t comment the ones in this thread, do you feel I post (fairly) simple to understand code?

Yes, I think so—particularly when you include a little basic error trapping (which helps people understand what they might be doing wrong: that’s very helpful). But bear in mind that’s from someone who has some basic knowledge of AppleScript.

Stephen

Thanks for the input :slight_smile:

1 Like

@Stephen_C @BLUEFROG @pete31 @Blanc
So here is the final product.

How to search, go to , copy to, move to in DevonThink using Typinator

use Bluefrog’s last script to create a listing of groups and subgroups

  • do NOT create a special typinator set for the moment

  • use Bluefrog’s last script to create a listing of groups and subgroups

  • insert listing into txt file with textedit or bbedit

  • get rid of bits of garbage like extra characters, spaces and tabs are the beginning of each line

  • sort (optional)

  • insert a tab at the beginning of each line which I do using a regex search and replace

  • save the txt file, give it a name like "DevonThink Groups SubGroups "and remember in which folder it is

open Typinator

  • do NOT create a special typinator set

  • click large gear above “Action” → Sets→ Import → a new set with the file name will appear in your Typinator set listing

  • right click on set → set info…→ setup as per my annotated image below. Most important are steps 2, 3 and 4 UNcheck abbreviations, check expansions and insert a keyword. I use dev. The keyword has to be short and unique (other Typinator sets should not have the same keyword). Remember the keyword for the DevonThink set.

Configure Typinator Quick Search shortcut

click large gear above “Action” → Preferences → Activation → choose a Quick Search Shortcut (I use ⌃⌥ ⌘Q). Can assign that shortcut to a BTT trackpad gesture if you want. Accelerates the workflow…

Everything is now in place

in or from outside DevonThink, open the DevonThink search popup, for goto, move to copy to and all actions which trigger the DevonThink search popup from outside DevonThink (file drag and drop, mail plugin and a gazillion others)

When the search popup is displayed and your cursor is inside the search field → type the typinator quick search shortcut → important: type the Typinator DevonThink set keyword (I use dev) followed by a single space → type any word or partial word from any of your groups or subgroups. Typinator search is excellent → click on the group subgroup you are looking for → it will automatically be inserted into the DevonThink search popup search field→ press enter to goto, move etc

1 Like

:flushed: In my quest for ever more knowledge, I recently learned how to fry eggs in a stainless steel frying pan. I had assumed I was now blessed with ubiquitous noesis.

Thank you for sharing your knowledge.

1 Like

:sweat_smile:

Thanks for the very full and careful explanation—which, at least, has introduced me to even more features of the ever excellent Typinator.

However, my strictly personal view is that just because this can be done is it really something that should be done? I entirely accept the workflow is useful to you and admire you for persisting until you were able to do what you wished. It’s just that I don’t think it works for me any better than the existing facilities in DT. Well done, however!

Stephen

2 Likes

That’s much more direct than telling of frying eggs in a stainless steel pan, foregoing years of non-stick technological advances :wink: Sometimes “because I can” is a good answer - it has to do with dopamine, I think :slight_smile:

I love that users have so very different uses and needs and that DEVONthink somehow caters for them all :slight_smile: Now, would you like an egg?

3 Likes

That really is an egg-cellent idea! (Sorry!)

Stephen

2 Likes

@cgrunenberg @Stephen_C @Blanc @pete31 @BLUEFROG

I think that there is a big misunderstanding as to the purpose of my Typinator workflow above. The misunderstanding is totally my fault for not going into enough detail in my explanation. I did not want to add to an already long text.

It is basically designed to address what one could consider a bug in DevonThink. If the term bug is too strong or it is not a bug, I apologize to @cgrunenberg

In 2020 I migrated from Evernote to DevonThink and followed the DevonThink procedure to do so.
I had 11,000 + Evernote notes. In the migration process (DevonThink → File → Import → Notes from Evernote). My evernote notebooks (=groups=folders) were imported as groups and each one of those groups filled up with the Evernote notes belonging to that notebook/group.

So far so good.

The problem is that for some mysterious reason, DevonThink automatically converted thousands of Evernote notes into subgroups. One example: if I had dragged and dropped a research study PDF into Evernote (= 1 note in Evernote), the result after the DevonThink migration is not a single item, but instead a subgroup with the same title as the Evernote PDF note, but containing 2 files. One is the pdf (sometimes with a bizarre name) and the other is an html file containing the URL link which opens the PDF file. (note: there are no indexed files in Evernote. All files are imported). There are many many variants of the kind of item titles and content you can find in those subgroups. I tried multiple times deleting the imported Evernote groups and notes in DevonThink and re-importing, but the results were the same.

In itself, it’s OK. A minor migration glitch that I can live with. The problem however is that following a migration from Evernote, the DevonThink search popup (in all forms) becomes useless because all these thousands of supplementary subgroups are included in search results. For example, if I type “DevonThink” in the search popover, instead of seeing the less than 5 actual groups/subgroups with DevonThink in their name, I get about 150 results (98% subgroups created during the Evernote import), and I end up having to scroll up and down to find the correct group. It is very tedious and time consuming if you consider the many times a day I use the DevonThink search popup. By generating a list of groups and subgroups (thanks to @BLUEFROG 's script), I can clean up all the garbage subgroups and, using Typinator end up with what the DevonThink search popup should look / feel like.

If I did not have this problem I would not have created the Typinator based workflow, and if I did, I would be crazy wasting time on this project.

I still have the Evernote file (ver 7.1.4, before their big change of platform). If necessary, I could delete all the Evernote notes in DevonThink (kept in a separate database) and start over again if @cgrunenberg or anyone else has a solution.

thank you

1 Like

Brilliant, thanks for the explanation!

1 Like

Ah - I do see the problem! I’m sorry that we effectively pushed you to write another long explanation though. I can see how - if you’re not able easily to tackle the superfluous groups created on the Evernote import - it might in those circumstances be desirable to create an alternative, easier way of navigating the DT group structure.

Thank goodness I never used Evernote! I’m glad you’ve finally managed to achieve a working solution to the problem and sorry I took so long to understand what you were trying to achieve…and why.

Stephen

1 Like

I’m the one who is sorry for having misled you into thinking that it was a frivolous exercise. In my initial message, I alluded to the fact that I had too many search results, which was incomprehensible for anyone without powers of divination/mind reading. In my younger age, my hobby was reading ancient Egyptian hieroglyphs. It must have left a mark on me, namely to write in a cryptic manner. Have a nice weekend !

2 Likes

:heart:

(And now I’ve got egg on my face looking like a real geek for using stainless steel. But really, I do need the dopamine. Thank you people for providing more of it :relieved:)

2 Likes