Example of using JavaScript to return data to the Hazel Rule

How can I return data to the Hazel Rule using an JavaScript in the "Passes JavaScript"?
At the moment I use AppleScript:
(where shellCmd contains a shell command I want to execute).
I want to moves this to Javascript. Have can I do it?
Thanks for pointers!
At the moment I use AppleScript:
- Code: Select all
set shellOut to do shell script shellCmd
if shellOut is not equal to "" then
set theRes to {hazelPassesScript:true, hazelOutputAttributes:{shellOut}}
else
set theRes to {hazelPassesScript:false}
end if
(where shellCmd contains a shell command I want to execute).
I want to moves this to Javascript. Have can I do it?
Thanks for pointers!