1

I use Folder Actions Setup to attach this script to a folder. I either remark out the AppleScript portion or the JXA function to run one or the other and change Script Editor to match the language.

Here is the AppleScript version:

on adding folder items to this_folder after receiving added_items
    say "called"
end adding folder items to

Here is the JXA version:

function addingFolderItemsTo(this_folder, {afterReceiving:these_items})
{
    var app = Application.currentApplication()
    app.includeStandardAdditions = true
    app.say("called");
}

I obtained the JXA approach from Can you write folder actions with javascript (jxa)?

This script is successfully called every time I drop a file into the folder or remove a file from the folder. The AppleScript version says "Called" whenever I add a file to the folder. This is all good but the JXA function is never called by OSX. I've added try catch statements and many "say" commands. The script is called by OSX and there are no errors reported but there is no action inside the function.

Is the JXA for this no longer implemented in OSX 10.12 or am I missing something?

Community
  • 1
  • 1
Buoy
  • 795
  • 1
  • 8
  • 13

0 Answers0