exists record at

I have a script for Skim which takes the selected text and saves it in a record inside a group named after the file in my Inbox. This was bound to a key. It worked fine for 2-3 months.

It now seems broken as follows: when it creates the group, it first checks if the group already exists,

if not (exists record at groupName) then
		set noteGroup to create record with {name:groupName, type:group} in inbox
		set noteGroup to get record at groupName
	end if

This no longer works (I’ll admit to fiddling with this code for a couple of hours to try and make it work, so I hope the above is indeed the state in which it worked).

Playing around, it seems that I can’t make exists record at return true, no matter what I do (eg get the location of a record in a script and then ask if it exists etc).

Has anybody else noticed it doing strange things recently? Has it been broken in the most recent beta? Or am I off my rocker?

“exists record at” expects the location of the group as a POSIX path (e.g. “/Group A/Group B”), not the name of the group.

But an easier solution is to use the command “create location” which creates the location only if necessary. Therefore a line like…

set noteGroup to create location "/My Note Group" in inbox

…could replace your complete snippet.

Thanks. That, though, is what is in groupName (despite the name of the variable).

OK I didn’t know that, thanks!

exists record at simply does not work now for me, though (yes, the argument is a POSIX path). Now I could (and probably am) simply doing something stupid, but before I waste a couple more days working out what, is it certain that it still works? Because all my scripts that used it don’t work any more. (but that could be that they were buggy and relied on the default saving location being the inbox or something, who knows).

Don’t waste your time, problem fixed.

Thanks for the help!