apple script service does not work correctly
Imported from the Apple Support Forums via the Wayback Machine 🔗
I want to make a service in snow leopard that when activated toggles another application. if the other application is running then calling this service should quit it. if the other application is not running, calling this service should start it. let's say the other application is safari. It does not seem to matter which application it is. the service I'm making consist of the following single action
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
on run {input, parameters}
tell application "System Events"
set x to (exists process "Safari")
if x then
tell application "Safari" to quit
else
tell application "Safari" to launch
end if
end tell
end run
</pre>
it works fine when run from automator but it does not work correctly when called as a service. if safari is running then calling the service quits it. but if safari is not running then calling the service launches safari for a brief moment and then safari quits. why?
14 replies
Sign in or join Beachball Help to reply.
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0