Create script with applescript.
Hopefully this video help you, and sorry for my poor english.
Philippe.