OK. I have read the script more carefully and found other problem.
The argument for getNameOfLayers() must be POSIX path of file but a reference to Finder object:
set nLayersName to my getNameOfLayers(tFile)
should have been:
set nLayersName to my getNameOfLayers((tFile as alias)'s POSIX path)
The whole script would look something like this:
property type_list : {"TIFF", "JPEG", "PNGf", "PICT"}
property extension_list : {"tif", "tiff", "jpg", "jpeg", "png", "pict", "psd"}
set nLayersName to {}
set matchList to {}
set matchLayer to "Shadows"
tell application "Finder"
set HotDestination to ((path to pictures folder) as text) & "HotDestination"
set HotFolder2do to ((path to pictures folder) as text) & "HotFolder2do"
set HotFolderDone to ((path to pictures folder) as text) & "HotFolderDone"
repeat with tFile in (get document files of folder HotDestination whose name extension is in extension_list and (name does not start with "50" or name does not start with "MJC"))
set nLayersName to my getNameOfLayers((tFile as alias)'s POSIX path) -- # added "my" and changed to pass POSIX path
set matchList to my isMatchLayer(nLayersName, matchLayer) -- # added "my"
if item 1 of matchList then
move tFile to folder HotFolderDone
else
move tFile to folder HotFolder2do
end if
end repeat
end tell
on getNameOfLayers(f)
set matchCmdStr to " | awk '!/kMDItemLayerNames|\\)/ { sub(/[ ]+/, \"\"); print }' "
set mdlsCmd to "mdls -name kMDItemLayerNames "
return do shell script (mdlsCmd & f's quoted form & matchCmdStr)
end getNameOfLayers
on isMatchLayer(psdLayers, matchItem)
set matched to false --as boolean
set matchCount to 0 --as integer
repeat with layer in paragraphs of psdLayers
if matchItem is in layer then
set matchCount to matchCount + 1
set matched to true
end if
end repeat
return {matched, matchCount}
end isMatchLayer
* I have not tested shell script using mdls because I have completely killed spotlight in my environment.
Good luck,
H