Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
tell application "Finder"
set outFile to open for access file "Mac HDD:directory_running_heads.txt" with write permission
set tmpFile to file "Mac HDD:directory_running_heads.txt"
end tell
tell application "InDesign CS"
set theDoc to the active document
set thePages to every page of theDoc
set headText to ""
set theHeaderID to the id of paragraph style "NAME COPY" of theDoc
set thePageNo to 0
repeat with thePage in thePages
set thePageNo to thePageNo + 1
if thePageNo / 2 is thePageNo mod 2 then
set styleTag to "<running-head-left>"
else
set styleTag to "<running-head-right>"
end if
set theParagraphs to the object reference of every paragraph of every text frame of thePage
set tmpStartItem to "ZZZZZZZZ"
set tmpEndItem to "AAAAAAAA"
repeat with theParagraph in theParagraphs
if the id of the applied paragraph style of theParagraph is theHeaderID then
if theParagraph < tmpStartItem then
set tmpStartItem to theParagraph
log "New Start Item: " & tmpStartItem
end if
if theParagraph > tmpEndItem then
set tmpEndItem to theParagraph
log "New End Item: " & tmpEndItem
end if
end if
end repeat
set tmpLength to the number of characters of tmpStartItem
set dissectMe to characters 1 thru tmpLength of tmpStartItem
log dissectMe
set tmpStartItem to ""
set tmpBreak to false
set charNo to 0
repeat until tmpBreak is true
set charNo to charNo + 1
if item charNo of dissectMe is "," then
set tmpBreak to true
else
set tmpStartItem to tmpStartItem & item charNo of dissectMe
end if
end repeat
set tmpLength to the number of characters of tmpEndItem
set dissectMe to characters 1 thru tmpLength of tmpEndItem
set tmpEndItem to ""
set tmpBreak to false
set charNo to 0
repeat until tmpBreak is true
set charNo to charNo + 1
if item charNo of dissectMe is "," then
set tmpBreak to true
else
set tmpEndItem to tmpEndItem & item charNo of dissectMe
end if
end repeat
set headText to styleTag & tmpStartItem & " - " & tmpEndItem & "
"
log "Current item: " & styleTag & tmpStartItem & " - " & tmpEndItem
tell application "Finder" to write headText to outFile
end repeat
end tell
tell application "Finder"
close access outFile
end tell
tell application "TextEdit"
open tmpFile
display dialog "This is a temporary file, and may be saved to another location for your convenience.
Use the \"Save As...\" function, or move it in the Finder..." buttons {"OK"} default button "OK"
end tell