For example, you could set up an Automator workflow so that any PDF you add to a given folder automatically opens in Preview:
- Create a new workflow in Automator, and select Folder Action as the type of workflow.
- At the top of the window, specify the folder you would like this workflow to act on when new items are added.
- Add the Filter Finder Items action to the workflow, and then set it for All criteria to be true, with Kind Is PDF as the only rule.
- Add the Open Finder Items action next, and set the application to be Preview.
Once you save this workflow, and now when you add new PDF files to the specified folder, they will open in Preview. Using this approach, you can similarly specify other file types and applications, or have automator move items, delete them, or perform any other supported action on the items added to the folder.
While you might only think of the built-in Calendar apps as a way to organize your schedule, you can also use it to launch documents and applications at specific times. To do so:
- Create a new event.
- Set an alarm for this event.
- Choose Custom in the Alert menu.
- Select Open File as the type of alert.
- Choose the application, document, or Automator or AppleScript application you want to open.
- Set a day and time for the alert to trigger, and save it.
After doing this, when the alert triggers, the specified file will open or run. The convenience of using Calendar is you can quickly move events around and duplicate them. Also, if you add them to a special Automated Tasks calendar, you can uncheck the calendar to hide these events from view.
You can get a fair amount done by using the Login Items, Folder Actions, and Calendar as launching platforms. But sometimes you might need finer control over how programs are run, especially if they are background tasks that need to execute at specific time intervals or under specific conditions.
In these cases, you might benefit from creating scripts called Launch Agents that configure the system launcher to run tasks at specified times and under a number of optional conditions. Launch Agents can be quite complicated to configure; however, simple ones can be relatively easy to set up. The only hard part is knowing the syntax for the script.
At its most basic, a Launch Agent script is a standard property list (plist) XML file that has two main key-value requirements: first is a label so it can be listed and identified in the system launcher, and second is a program argument that points to an executable file on your Mac. Beyond this, you will need to indicate when to open the program.
Sign up for CIO Asia eNewsletters.