Couple of suggestions. Look at the
path to command in the Standard Addtions scripting addition dictionary. This returns either an alias or string of several default folders.
Code:
set cache_path to (path to library folder of user domain as string) & "Mozilla:Profiles:" & realname & ":" & user & ":Cache:"
set support_path to (path to application support of user domain as string) & "Firefox:Profiles:" & default
There is a delay command in applescript that will pause excution for a specified time. Or you can set up a repeat loop that will call an quit handler until the app preocess is no longer running.
Code:
set appToCheck to "Mail"
set isRunning to true
repeat while isRunnning
tell application "Finder"
set processList to name of processes
if appToCheck is in processList then
QuitApplication(appToCheck)
else
set isRunning to false
end if
end tell
end repeat
on QuitApplication(appToCheck)
tell application appToCheck to quit
end QuitApplication
You may want to use System Events rather than the Finder to check if a file exists. Ot use a try block and set an alias to the file in question, if it fails then the file does not exist.
Craig