@BLUEFROG @Stephen_C
thank you for your comments. Please give me some time to create a complete functional example combining typinator and DevonThink, and limiting myself to a few test DevonThink groups and subgroups.
I will post the complete functional model here.
At your leisure and convenience
I created a typinator set for DevonThink
abbreviation = group (=folder) name
expansion = group (=folder) link
I created 2 test groups in DevonThink called bluefrog and stephen and items in the typinator DevonThink
type global typinator shortcut ā type the DevonThink typinator keyword to search only the DevonThink set ā type search string ā when I press on enter, the expansion (link) corresponding to that group (folder) is typed.
I would like to use that Link in DevonThink search popover for move to, go to, copy to, etc
Aaaah - now I understand what youāre doing: thanks for the detailed explanation!
I havenāt tried using Typinator in effect to expand group names in DT. However, why not simply use abbreviations for the relevant group names rather than trying to use the DT links?
For example, just set xbs
to expand to Bank Statements
and then type Control + Cmd + G
to open the go to popover, type xbs
and hit return. I did try that and it works perfectly.
Edit: I have tried that and I think it would fit with your workflow. In other words, simply create a Typinator abbreviation for each relevant DT folder you want. You can then use the Typinator search to find what you need and enter it in DT, where it automatically expands.
Stephen
This script adds a recordās Reference URL
to its aliases
.
-- Add Reference URL to aliases
tell application id "DNtp"
try
set theRecords to selected records
if theRecords = {} then error "Please select some records."
repeat with thisRecord in theRecords
set thisRecord_ReferenceURL to reference URL of thisRecord
set thisRecord_Aliases to aliases of thisRecord
if thisRecord_Aliases does not contain thisRecord_ReferenceURL then
set thisRecord_Aliases_list to my tid(thisRecord_Aliases, {", ", "; ", ",", ";"})
set end of thisRecord_Aliases_list to thisRecord_ReferenceURL
set thisRecord_Aliases_string to my tid(thisRecord_Aliases_list, ", ")
set aliases of thisRecord to thisRecord_Aliases_string
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
return
end try
end tell
on tid(theInput, theDelimiter)
set d to AppleScript's text item delimiters
set AppleScript's text item delimiters to theDelimiter
if class of theInput = text then
set theOutput to text items of theInput
else if class of theInput = list then
set theOutput to theInput as text
end if
set AppleScript's text item delimiters to d
return theOutput
end tid
Stephen
Thank you very much @pete31 !!
Sorry: I canāt see the script output. It is not in the clipboard and I was not asked to create a file.
Look at a recordās aliases
.
The script adds selected recordsā reference url
s to the recordsā aliases
.
- Select some records
- Run script
Paste a recordās reference url
in a popover to reveal exactly this record.
I have to read about aliases in DevonThink. I am in above my head. thank you very much
An alias is simply another way of labelling a record (including a group) in DevonThink. What @pete31 has cleverly done is to produce a script which well, as he said, adds the reference url
to the aliases for the relevant records. That, in turn, allows you to address, and find, those records (including groups) by those reference URLsāwhich is, I think, just what you wanted to do.
Run the script on some selected records then try your workflowātrying to go to them, for example, using the reference URLs youāve presumably added to Typinator.
So far as Iām concerned (and itās my strictly personal view, of course) it all seems a rather long-winded way of getting around in DT. Having read about aliases this morning Iāve just added some shorthand abbreviations, in DT, to my most popular groups and can now go to, or move something to, those groups very quickly using those abbreviations.
Stephen
Hereās a screenshot from the generic inspector for one of my DT groups which may help:
Youāll see I have a group called Temp
. The alias Iāve set enables me simply to type tp
to go to, or to move something to, thatt group. Maybe that helps to make things a little clearer.
Stephen
thank you.
Now I understand. Thanks very much @pete31
I developed and approach with Evernote using Typinator which worked very well and which I want to apply to DevonThink and which I think you would find interesting.
Based on suggestions by the Typinator developer Gue.
Based on your note, you do not understand my intention. Entirely my fault for not explaining correctly. The best way for me to explain my thought is if I could find a way a generating a simple clean line by line listing of all groups and subgroups which I would subsequently import into typinator. In that list, I want no documents, no tags, no links (for the moment), no strange characters, no tabs, no quotes, etc. If this was possible, I could test on my mac and post the solution here.
I tried all kinds of scripts in the forum and none give me a clean simple list. Itās very frustrating.
Oh, heās a first class guy and really helpful.
Yes, I was worried that might be the case: sorry!
Letās just reduce it to a simple example. Imagine that you want to move to one of your DT groups. Presumably you would start by pressing Control + Cmd + m
in DT. Are you then maybe suggesting that there could be some way of using Typinator quick search to find the group to which you wish to move and having Typinator complete the name, or alias, of the group in the Control + Cmd + m
popover in DT (presumably based on having a complete list of groups, or their aliases, in Typinator)?
No need to apologise for not being clear. Itās not easy if English isnāt your first language (and, as you will have seen from many of my postsāitās not easy even if English is your first language! )
Stephen
Not knowing what input format would be required for Typinator, here is a simple snippet of code that returns the names of the subgroups of a selected group in a databaseā¦
tell application id "DNtp"
repeat with theRecord in (selected records)
set recLoc to {location, name} of theRecord
return name of ((parents of current database) whose (location contains (recLoc as string)))
end repeat
end tell
How do I send the results to the clipboard or a file ? thank you
What kind of file?
And hereās a version utilizing the clipboardā¦
set od to AppleScript's text item delimiters
tell application id "DNtp"
repeat with theRecord in (selected records)
set recLoc to {location, name} of theRecord
set recLoc to recLoc as string
set AppleScript's text item delimiters to linefeed
set subGroupNames to (name of ((parents of current database) whose (location contains recLoc)))
set the clipboard to (subGroupNames as string)
end repeat
set AppleScript's text item delimiters to od
end tell
Iām sure I shouldnāt muddy the watersāand shall keep out of this after this postābut running your script returns rather a lot of blank results for me, for selected records.
I was in fact wondering if what in fact @rufus123 needed was given by amending your line return nameā¦
to return item 1 of recloc
(which then provides me something like "/Diary entries/2020-2029/2021/"
).
Sorry for interfering!
Stephen
No interference at all.
Hereās a version that only accepts one selected group and prompts if the group is emptyā¦
set od to AppleScript's text item delimiters
tell application id "DNtp"
if (count (selected records)) = 1 then
set theRecord to (item 1 of (selected records))
set recLoc to {location, name} of theRecord
set recLoc to recLoc as string
set AppleScript's text item delimiters to linefeed
set subGroupNames to (name of ((parents of current database) whose (location contains recLoc)))
if subGroupNames ā {} then
set the clipboard to (subGroupNames as string)
else
display alert "This group has no subgroups."
end if
else
display alert "Select one group to process."
end if
set AppleScript's text item delimiters to od
end tell