It is possible to attach a script to a folder by script
but, is it possible to activate 'folder action script' by script ?
without using GUI scripting
I meant to throw in one or two examples in response to this, Serge -
but was distracted (and then promptly forgot).
Specified folder action:
----------------
tell application "System Events" to set enabled of ¬
folder action "some folder" to true
----------------
Contiguous folder actions:
----------------
tell application "System Events" to set enabled of ¬
folder actions 1 thru 3 to true
----------------
Non-contiguous folder actions:
----------------
tell application "System Events" to set enabled of ¬
folder actions whose name is "some folder" or ¬
name is "some other folder" to true
----------------
Every folder action:
----------------
tell application "System Events" to set enabled of ¬
folder actions to true
----------------
================
Specified script attached to specified folder:
----------------
tell application "System Events" to set enabled of script ¬
"some script.scpt" of folder action "some folder" to true
----------------
Contiguous scripts attached to specified folder:
----------------
tell application "System Events" to set enabled of scripts ¬
"some script.scpt" thru "some other script.scpt" of ¬
folder action "some folder" to true
----------------
Non-contiguous scripts attached to specified folder:
----------------
tell application "System Events" to set enabled of ¬
scripts of folder action "some folder" whose ¬
name is "some script.scpt" or name is ¬
"some other script.scpt" to true
----------------
Every script attached to specified folder:
----------------
tell application "System Events" to set enabled of scripts ¬
of folder action "some folder" to true
----------------
================
Every script attached to every folder:
----------------
tell application "System Events" to set enabled of ¬
scripts of folder actions to true
----------------
Referencing by name or index is generally interchangeable - apart
from when filtering (using a 'whose'/'where' clause).