Rate from the keyboard

I’m trying to keep a food log in DEVONthink. The important part of my logging process is to rate the food I ate. I’m trying to do this quickly from the keyboard, but I can’t find any keyboard shortcuts to rate items from 1-5.

I tried to assign keyboard shortcuts to the Data->Rating menu options, but it doesn’t seem to work.

How can I achieve this?

Well, it seems like hacking but I wrote five simple scripts that sets the corresponding rating, and assigned keyboard shortcuts to these in the Script menu.

    -- Import helper library
    tell application "Finder" to set pathToAdditions to ((path to application id "DNtp" as string) & "Contents:Resources:Template Script Additions.scpt") as alias
    set helperLibrary to load script pathToAdditions


    -- Get the selection
    tell application id "DNtp" to set thisSelection to the selection

    -- Error handling
    if thisSelection is {} then error localized string "Please select a document or group, then try again."
    if (length of thisSelection) > 1 then error localized string "Please select only one document or group, then try again."

    tell application id "DNtp"
    	set thisItem to first item of thisSelection
    	set rating of thisItem to 3
    end tell

I tried to use a literal star there, like Data->Rating->★
(there are “black star” (UTF-8 E29885) and “black small star” (UTF-8 E2AD91) in the character palette)
That didn’t work, probably because there are always five stars, albeit some of them are disabled.

You can define a shortcut with Better Touch Tool, though, because it permits to select menu entries by number. So in your case, you’d define Data;Rating;(2) as an action for your keyboard shortcut and get a 1 star rating.

I don’t think it’s feasible to install Better Touch Tool just for this. :slight_smile:

Maybe @BLUEFROG knows something that can be done without scripting and 3rd-party tools.

It’s certainly “feasible” :wink: But if it’s worthwile, is up to you. Since I have it anyway, I used it.
I also tried with Keyboard Maestro, but it wouldn’t show me the entries below “Rating”, presumably because they’re not character strings?

It’s certainly “feasible” :wink:

Well, used the wrong word… :slight_smile: