Select the “magic wand” tool
Use it to select a specific region
Click on the “Make work path from selection” button in the paths palette
Give the work path a name
Repeat the above until you’ve got all of your areas defined as named paths
Run the script