Crash when renaming group via AppleScript

I have found a crash that I believe to be reproducible (it is on my machine anyway).

It occurs when:

  1. Attempting to rename a group via AppleScript
  2. A child of that group is currently selected
  3. That child is a YAML file
set newName to "test"

tell application id "DNtp"

	set s to selection
	set r to item 1 of s
	
	set g to first parent of r
	set name of g to newName

end tell

In other words, applying this code to this selection will crash.

DEVONthink shows the beachball of doom, after two minutes “DEVONthink got an error: AppleEvent timed out” is returned to the script runner, but DEVONthink does not recover.

Note that if the markdown file is selected, the script runs without a problem.

I don’t know if this is related, but it could be: I have tried making YAML files editable within DEVONthink using the AdditionalPlainTextExtensions hidden preference. According to this, they should be editable:

* defaults read com.devontechnologies.think AdditionalPlainTextExtensions
.taskpaper.yaml.yml.json

However, YAML files are still read-only for me. I tried rebuilding the database and it made no difference. Same with re-importing the files.

4.0.1 on 15.5

Please choose Help > Report Bug while pressing the Option modifier key to start a support ticket, thanks.

P.S: The first parent is not necessarily a group, the property location group is recommended instead.

You might want to check what the first parent of your record is – if it’s the root of the database, you can’t rename it.
And perhaps use selected records instead of selection (that’s just a general suggestion, not related to this script directly).

Will do.

Good point, thanks. The script that I discovered this problem in originally was getting the group from its path, but I simplified things in order to check that the problem was reproducible.

It’s not the root in this case, but thanks for the suggestion.

Thanks for this also.

You need to specify the type as -string before you add the extension(s).