I've got this applescript to restart an application that I use frequently (for instance after installing fonts). Is there a smart and smooth way to extend it to also re-open all documents it had open? Or would that be too much app-specific code?
set appName to (path to frontmost application as text)
tell application appName to quit
repeat
tell application "System Events"
if appName is not in (name of application processes) then exit repeat
end tell
do shell script "sleep 0.5"
end repeat
tell application appName to launch