Thank you for your suggestion. I created the following stand along apple script. Modified the hazel action to use the external script. When it runs I get the error below the code block.
- Code: Select all
use framework "Foundation"
use framework "AppKit"
use scripting additions
on hazelProcessFile(theFile, inputAttributes)
sourcePath to "/Users/DouglasWall/Dropbox/CLLC/Icons/yosemiteicns/yose06a.icns"
set destPath to theFile
set imageData to (current application's NSImage's alloc()'s initWithContentsOfFile:sourcePath)
(current application's NSWorkspace's sharedWorkspace()'s setIcon:imageData forFile:destPath options:2)
end hazelProcessFile
Error Log entry:
2023-04-17 16:06:05.575 hazelworker[7730] 2016: Rule Change Icon matched.
2023-04-17 16:06:05.576 hazelworker[7730] [Error] AppleScript failed: Error executing AppleScript on file /Users/douglaswall/Dropbox/CLLC/Citizens/2016.
2023-04-17 16:06:05.576 hazelworker[7730] OSAScript error: {
NSLocalizedDescription = "*** -[BAGenericObjectNoDeleteOSAID sourcePath]: unrecognized selector sent to object <BAGenericObjectNoDeleteOSAID @0x60000132ee00: OSAID(13) ComponentInstance(0x810001)>";
NSLocalizedFailureReason = "*** -[BAGenericObjectNoDeleteOSAID sourcePath]: unrecognized selector sent to object <BAGenericObjectNoDeleteOSAID @0x60000132ee00: OSAID(13) ComponentInstance(0x810001)>";
OSAScriptErrorAppAddressKey = "<NSAppleEventDescriptor: [0x0,2 \"hazelworker\"]>";
OSAScriptErrorAppNameKey = hazelworker;
OSAScriptErrorBriefMessageKey = "*** -[BAGenericObjectNoDeleteOSAID sourcePath]: unrecognized selector sent to object <BAGenericObjectNoDeleteOSAID @0x60000132ee00: OSAID(13) ComponentInstance(0x810001)>";
OSAScriptErrorMessageKey = "*** -[BAGenericObjectNoDeleteOSAID sourcePath]: unrecognized selector sent to object <BAGenericObjectNoDeleteOSAID @0x60000132ee00: OSAID(13) ComponentInstance(0x810001)>";
OSAScriptErrorNumberKey = "-10000";
OSAScriptErrorRangeKey = "NSRange: {0, 0}";
Any other suggestions? Did I do correctly what you had originally suggested?