Hi all,
I’ve another annoying AppleScript question/problem.
I’ve written a script which iterates groups and extracts file metadata into a DT sheet. It’s iterating and extracting the data just fine, but when it goes to save the data to the sheet’s cells, it throws the error “AppleEvent handler failed”. Whats odder is that, when I step thought the script, the data is in fact written to the sheet so I don’t know what its complaining about.
So far I’ve tried, disabling SIP on my Mac (as I recently had to do a fresh install) and repaired disk permissions. If I wrap the offending line in a try brace it works perfectly, so I’ve no idea why this line both appears to work, and throw an error.
These lines are fine, they just explain how the further vars are set (letters are just for legibility):
set doc_tsv to create record with {type:sheet, columns:{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"}, name:"files"} in a_group
set doc_tsv_cells to cells of doc_tsv
And after I iterate my files, add the metadata to the doc_tsv_cells as a nested dict:
copy {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o} to end of doc_tsv_cells
And finally after iterating al my files, I try to save the data to the sheet using:
set cells of doc_tsv to doc_tsv_cells
And that is where it fails. But it works, as data is written back, but it throws a fatal error, and wraping it in a try brace lets it fail but continue. I’m probably missing the most obvious thing.
Does anyone have any idea why this maybe occuring? I had written this script a while ago and it worked perfectly fine then, and other scripts I have that write to DT sheets are still working. I’m stumped.
Thanks for getting this far!