Change Folder Image

Good morning:
I'm trying to create a hazel rule/action that will monitor a folder and then change the folder image for any subfolder created within the main folder. The folder structure is as follows: Top Folder/Year/Month/Day.
The rule fires but the apple script fails. The apple script works when ran through the Script Editor on my Mac. I think the issue is setting the destination path in the script. Below is the script that I am using. The inputAttibutes is Path Name. I have also tried using the "theFile" keyword but neither work.
framework "Foundation"
framework "AppKit"
scripting additions
set sourcePath to "/Users/UserName/Dropbox/CLLC/Icons/yosemiteicns/yose06a.icns"
set destPath to item 1 of inputAttibutes
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)
Any advice would be appreciated. Thanks for reading my post.
I'm trying to create a hazel rule/action that will monitor a folder and then change the folder image for any subfolder created within the main folder. The folder structure is as follows: Top Folder/Year/Month/Day.
The rule fires but the apple script fails. The apple script works when ran through the Script Editor on my Mac. I think the issue is setting the destination path in the script. Below is the script that I am using. The inputAttibutes is Path Name. I have also tried using the "theFile" keyword but neither work.
framework "Foundation"
framework "AppKit"
scripting additions
set sourcePath to "/Users/UserName/Dropbox/CLLC/Icons/yosemiteicns/yose06a.icns"
set destPath to item 1 of inputAttibutes
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)
Any advice would be appreciated. Thanks for reading my post.