Hi
I have a script that moves email from Mail to Omnoficus. If both apps are running it works.
But if one or both are not running, even though the tell application script will start the app, they crash, and my script does not end, and does not work.
So I thought I would add in the activate command to start the apps if they are not running.
I can only find online functions to tell if an app is running, and not NOT running. I tried modifying it but the whole thing still crashed the same even if I did not use it (so perhaps its not being called).
This is what I have so far and wondered if anyone knows:
The delay was just because I thought I should wait a bit for the app to finish starting just in case.
Thanks
I have a script that moves email from Mail to Omnoficus. If both apps are running it works.
But if one or both are not running, even though the tell application script will start the app, they crash, and my script does not end, and does not work.
So I thought I would add in the activate command to start the apps if they are not running.
I can only find online functions to tell if an app is running, and not NOT running. I tried modifying it but the whole thing still crashed the same even if I did not use it (so perhaps its not being called).
This is what I have so far and wondered if anyone knows:
Code:
if appIsNotRunning("OmniFocus") then
tell application "OmniFocus"
activate
delay 10
end tell
end if
on appIsNotRunning(appName)
tell application "System Events" to (name of processes) does not contain appName
end appIsNotRunning
The delay was just because I thought I should wait a bit for the app to finish starting just in case.
Thanks