Make a watch folder with applescript


I have made a script. Now I want to make a folder on my desktop. When I put a document in this folder, I want that first Indesign opens the document and then the script starts to run. How do I have to do that?


By Simply using Action folder script.

property pathToYourScript : ((path to desktop folder) & "script.scpt" as string)

on adding folder items to thisFolder after receiving theseItems
set scriptToRun to load script file pathToYourScript

repeat with thisFile in theseItems
tell app "indesign"
open file thisFile 
end tell
run scriptToRun
tell app "indesign" to close document thisFile with saving
end repeat
end adding folder items

p.s. this is just a sketch and not real code but this is how you can do this