Wednesday, July 20, 2011

Workflow Automation with AppleScript

Before delving into the intricate details of designing, developing, and deploying AppleScript workflow solutions, take a step back and consider the various ways the solution might be used in the future. Such reflection will give you a much richer grasp of the benefits of AppleScript and what it can help you achieve.
workflow is an ordered sequence of individual steps that are performed together to achieve an overall task. Although the term can refer to any task, in this chapter, only tasks performed on a computer are relevant.
Before you can automate a workflow, you need to abstract the workflow steps from the other unrelated tasks with which they intersect. You must also delimit your focus to avoid being caught up in the folly of automating everything.
For example, suppose you were presented with the challenge of automating a catalog production workflow. At first it might sound easy. After all, there are only three or four steps. Material is created, placed into a page layout document, proofed, and then converted into a portable document format (PDF) file for print. However, each of these steps can be considered an entire workflow on its own. The text and images that eventually find their way into a page layout program might go through dozens of steps, from concept to completion, before getting to the page layout step. Further, some of the steps that occur during concept and completion might be defined as separate, smaller workflows. If you reduced the entire process down into the smallest individual steps, there might be thousands or millions of them.
When defining a workflow for eventual automation, it is important to focus on a reasonable portion of the "big picture" process. But you also need to choose processes that lend themselves to automation. Appropriate processes must have a lot of repetitive activity and not a great amount of creativity. Writing a script that places and styles text according to static business rules is a much more sensible choice for automation than trying to make a script perform the creative writing process necessary to generate the text in the first place.
Another factor to consider when searching for a workflow to automate is who performs the work manually. If your script will perform a handful of functions that you or your co-workers currently do manually, there isn't much to consider. However, some workflows might involve tasks performed by dozens of people. Those people might work for the same company or be diverse members of different companies, offices, departments, or disciplines. In such a case, you must consider the human factor as part of your definition of the workflow to ensure that you don't try to automate a workflow with a single script that must somehow pause and wait for people to perform a few steps. Instead, there should be multiple scripts, one for each discrete portion of the work. In essence, you want to automate tasks "between" people and not "through" them.
It can be a challenge to untangle a process from all the other processes and the people involved while simultaneously considering all the variables. Successful developers need to be able to alternate their focus from the isolated details of a process and the full context in which it exists. This skill is crucial for developers defining a workflow for automation.

No comments: