I am in the process of typesetting a large document (~1000 pages) by an author/publisher with very specific requirements. One such requirement is the use of running headers. However, the way he wants running headers implimented is different from the how running headers are done in InDesign CS6. As things stand in CS6, running variables may display the first or last occurance of a style on the page. My publisher wants a variation on this: If paragraph style "Section Title" is the first style on the page , then use the first instance of the "Section Title" style as the running header. However, if ANY other style is the first style on the page, then use the last occurance of the "Section Title" style from the previous page. See the below graphic for more clarification.
Every page will have between 0 and 2 new sections, so doing this by hand is not an option, especially as content is added. I've done quite a bit of research, and it doesn't seem like I'm able to do what I want "out of the box" with indesign....I can't seem to get it to pull styles from the previous page or perform the simple logic to decide which section should go in the header. Does anyone have any ideas? Am I going to have to do a crash course in InDesign scripting? If so, does anyone know of a depositories of scripts that may point me in the right direction?