I need to create a simple app to restore preference files of InDesign CS3 (Leopard) in case they become corrupt. I will use an osascript for removing and replacing the prefs files with the backed up ones, but I need before a script to check if InDesign is running and if it has some open docs to ask for saving them, and then proceed to the prefs replacement.
tell application "System Events"
if exists process "Adobe InDesign CS3" then
tell application "Adobe InDesign CS3"
set thecount to count of every document
if thecount is 0 then
display dialog "Indesign is running, But no documents are open"
else
if thecount is greater than 0 then
display dialog "Indesign is running, at least 1 document is open"
end if
end if
end tell
else
display dialog "Indesign isn't running"
end if
end tell