tell application "Adobe InDesign CS3"
set nDocuments to (count documents)
set myCount to 0
repeat while myCount < nDocuments
tell active document
if saved then
save
close
else
set myResult to my getTimeStamp()
save to ((path to desktop folder as text) ¬
& "SavedDoc_" & myResult & ".indd") as text
close
delay 1 --Ensures unique time stamp
end if
end tell
set myCount to myCount + 1
end repeat
set nBooks to (count book)
set myCount to 0
repeat while myCount < nBooks
tell active book
save
close
end tell
set myCount to myCount + 1
end repeat
quit
end tell
on getTimeStamp()
set timeStamp to the current date
set nMonth to month of timeStamp as number
if (nMonth < 10) then
set nMonth to "0" & (nMonth as text)
end if
set nYear to year of timeStamp
set nDay to the day of timeStamp
if (nDay < 10) then
set nDay to "0" & nDay
end if
set nHour to hours of timeStamp
if (nHour < 10) then
set nHour to "0" & nHour
end if
set nMinute to the minutes of timeStamp
if nMinute < 10 then
set nMinute to "0" & nMinute
end if
set nSecond to the seconds of timeStamp
if nSecond < 10 then
set nSecond to "0" & nSecond
end if
return {nYear, nMonth, nDay, nHour, nMinute, nSecond}
end getTimeStamp
North America
Europe, Middle East and Africa
Asia Pacific