How to configure AppleScript to run when this file changes?

I know that applescripts can be configured to run as folder actions, but is there a way to get them to run as file actions? Yes, I know that I can get around this by simply creating a new folder, placing a script in it and working as an action with the folder, but I want to know if this can be done.

+3
source share
2 answers

I crossed this question into the Apple Applescript discussion forum , and several users there provided some solutions that use only system resources, without third-party applications. Follow the link to see the answers.

Basically you need to use launchdto view the file and run

+2
source

There is no easy built-in way to do this. However, there are many ways to configure Applescript to run. However, in general, you will need to do non-Applescript coding.

Check the information in this prompt and OSXHints:

http://hints.macworld.com/article.php?story=20060817044149264

They have a Python script demonstrating the use of fsevents.so to monitor file changes. Then you just modified Python to call your Applescript (or just use the application to write scripts from Python).

Alternatively, you can simply check the program for a specific interval and then run if the file changes. This hint describes that in Perl:

http://hints.macworld.com/article.php?story=20031001073403810

+1

All Articles