Help! Exporting Rollover states from layered Illustrator doc

I need help to make my first script!

I am using Illustrator CS to make some rollover buttons for a promotional PDF which I want to be able to export as PDFs using a script so that I can quickly try different looks and then update the links in Indesign, the buttons have three states - UP, ROLL and DOWN.

I have organised the ai file into layers - the bottom layer, called “button”, contains three sub layers - UP, ROLL and DOWN, each contains a place-holder lozenge shape modified for the relevant state.
The text for each button (i.e. “about me”, “clients”, “portfolio”) are in layers above the “button” layer - each layer, like “button”, contains 3 sub-layers (UP, ROLL & DOWN if you hadn’t guessed).

What I want to do is make a script that will go through these layers, turning the relevant ones on and off, so that I end up with three folders (UP, ROLL and DOWN) with the corresponding button states exported with a specified pre-set. Can anyone help?

Below is a breakdown of the actions that need to take place as I see it - at this point I havn’t got my head around arranging the syntax though…

  1. Specify 3 folders - UP, ROLL & DOWN - for different button states
    (these folders must stay in same place as they are going to be referenced by Indesign)

  2. Activate Illustrator CS where layered document is already open - turn off all layers visibility.

  3. Turn on “Button layer”/ sublayer “UP” (“Button layer” contains the lozenge shape representing button area)

  4. Turn on “Buttontext_1” / sublayer “UP”

  5. Export as PDF using specified pre-set, to “UP” folder created in step 1.
    (name file automatically using layer title (i.e. “clients”) and sub-layer title, i.e. “UP”)

  6. Turn “Buttontext_1” / sublayer “UP” OFF

  7. Turn “Buttontext_2” / sublayer “UP” ON

  8. Export as PDF using specified pre-set, to “UP” folder created in step 1.

  9. Turn “Buttontext_2” / sublayer “UP” OFF

  10. Turn “Buttontext_3” / sublayer “UP” ON

  11. Export as PDF using specified pre-set, to "UP" folder created in step 1.
    

This gets repeated for each button “UP” state, then the other states need doing…

1b) Turn OFF “Button layer” / sublayer “UP” visibility

2b) Turn ON “Button layer” / sublayer “ROLL” visibility

3b) Turn ON “Buttontext_1” / Sublayer “ROLL”

4b) Export as PDF using specified pre-set, to “ROLL” folder created in step 1.
5b) Turn “Buttontext_1” / sublayer “ROLL” OFF

6b) Turn “Buttontext_2” / sublayer “ROLL” ON

7b) Export as PDF using specified pre-set, to “ROLL” folder created in step 1.

ETC - repeated for the 3rd state, “DOWN”

Hope some of you guy’s can help and put me on the road to Applescript-dom