Example of using JavaScript to return data to the Hazel Rule

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

How can I return data to the Hazel Rule using an JavaScript in the "Passes JavaScript"?

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!
halloleo
 
Posts: 66
Joined: Thu Apr 27, 2017 10:10 pm

Check the manual. There are details and examples there.
Mr_Noodle
Site Admin
 
Posts: 12000
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for chiming in, but I could not find a JavaScript example: Under "Using AppleScript or JavaScript " -> "Returning a record" I find only a AppleScript example. (Maybe I have "tomatoes on my eyes" though...)
halloleo
 
Posts: 66
Joined: Thu Apr 27, 2017 10:10 pm

I believe the syntax is actually the same in this case.
Mr_Noodle
Site Admin
 
Posts: 12000
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support