extract comment from Finder info panel

I’m trying to use a small Applescript call from within LiveCode to get the contents of the “comments” field (the one that is part of the “get info” pane for a file). I’m fairly fluent in LiveCode but Applescript always makes me stumble. I call the AS snippet from a LiveCode handler:

function getFinderComment
put “Macintosh HD” & fld “path” & fld “name” into fullPath – this now looks like
– Macintosh HD/Users/pmbrig/Pictures/scanned photos/Becca/2020-06-03-15-34-015.jpg
put fld “AStext” into tScript – tScript now contains:
{
set aFile to “”
tell application “Finder”
get comment of aFile
end tell
}
replace “” with fullPath in tScript
replace “/” with “:” in tScript
– tScript now looks like:
{
set aFile to “MacintoshHD:Users:pmbrig:Pictures:scannedphotos:Becca:2020-06-03-15-34-015.jpg”
tell application “Finder”
get comment of aFile
end tell
}
do tScript as Applescript – should run the Applescript snippet
put the result into tComment – should contain comment of aFile as found by AS
return tComment – returns the function output in LiveCode
end getFinderComment

But I keep getting “execution error” from AS.

So the Applescript snippet that doesn’t work is:
set aFile to “MacintoshHD:Users:pmbrig:Pictures:scannedphotos:Becca:2020-06-03-15-34-015.jpg”
tell application “Finder”
get comment of aFile
end tell

Don’t know enough AS to tell what the problem is. Am I anywhere close to being on the right track?

Model: MacBook Pro
Browser: Firefox 96.0
Operating System: macOS 10.14

Hi. It looks like the issue may relate to lacking a file specifier.

set aFile to "MacintoshHD:Users:pmbrig:Pictures:scannedphotos:Becca:2020-06-03-15-34-015.jpg"
   tell application "Finder"
      get comment of file aFile --the file corresponding to aFile's text
   end tell

ll

That did it! Thanks loads! :slight_smile: