Ratings for files.

I want to set ratings 1 to 5 for files (they are books, articles etc) just like iTunes does for songs.
I guess, I will have to put them in “Spotlight Comments” of each file.
I want to do this to the current selection in Finder (still better if it could be the open document in Skim instead of Finder)
Is it possible ?

Hi, something like this might work:

tell application "Finder"
	set items_ to selection
	repeat with item_ in items_
		set comment of item_ to "¢¢¢¢¢"
	end repeat
end tell

As for incorporating it in skim, for example, you cool look at making the script into a service (I know there’s an app for doing this) or perhaps a keyboard shortcut via Butler.

Cheers,

Kev.

Hi again, sorry, but you’d need to save 5 or 6 scripts (for zero through to 5 ratings), and make sure the finder window shows the comments column. There’s also this:

http://macupdate.com/info.php/id/28823/huddy

Cheers,

kev.

thanks for the help, kquinn…i will see what i can do.

hey!!! you are the developer!!! right? (kevin kquinn)
and you made huddy today!!!
great…
thanks
is there someway i could use huddy to rate files with keyboard?
(i will use QS triggers instead of Butler.)

Hi, yes, I developed huddy (but not today). I just added the file rating today (after seeing your post, in fact). It would be simple enough to add keyboard shortcuts to the file rating, but making these shortcuts configurable by the user would take more time (and time is particularly short at the moment). Not making them user settings might mean they’d clash with other keyboard short cuts.

I’m sure there’s someone around here who could knock something better up in no time. I can make the project files available if you like.

All the best,

kev.

i think i can use your applescript and QS triggers. that will do for me.
but

could tell me which app does it?

Hi,

I found this the other day (it’s the one I was thinking of):

http://wafflesoftware.net/thisservice/

I didn’t like the way it puts new services at the bottom (kinda defeats the purpose of making things accessible).

Cheers,

kev.

the service does appear in “services” menu but it does nothing.
i guess, it requires modifying the applescript
any other ideas on how to make it work in skim?

Hi Lance,

I have written a custom script for you which will insert a rating in the comment of the frontmost Skim PDF document. Please note that currently the script simply overwrites existing comments.


property mytitle : "Skim-O-Rate"

on run
	try
		tell application "Skim"
			set alldocs to every document
			if alldocs is {} then
				error "There are no open documents in Skim."
				return
			end if
			set curdoc to document 1
			set curdocpath to path of curdoc
			set curdocname to name of curdoc
		end tell
		set docrating to my askforrating(curdocname)
		if docrating is missing value then
			return
		end if
		set curdocfile to (POSIX file curdocpath) as Unicode text
		tell application "Finder"
			set comment of (curdocfile as alias) to ("Rating: " & docrating)
		end tell
	on error errmsg number errNum
		tell me
			activate
			display dialog "Sorry, an error occured:" & return & return & errmsg & return & "(" & errNum & ")" buttons {"OK"} default button 1 with icon stop giving up after 30 with title mytitle
		end tell
	end try
end run

on askforrating(docname)
	try
		tell me
			activate
			display dialog "Please enter a rating for the frontmost Skim PDF:" & return & "(" & docname & ")" default answer "" buttons {"Cancel", "OK"} default button 2 with title mytitle
		end tell
		set dlgresult to result
		return text returned of dlgresult
	on error
		return missing value
	end try
end askforrating

amazing!!! thanks Martin…that was more than what i wanted.
i wish there was an applescript that could teach me to write a script like you!!!

And I wish there was a script that could teach me to play cricket like you :wink: