I have created a script with AppleScript and have exported it as an application. How can I force the application to stay open constantly so the user cannot force-quit it: ie how can I open the application again on force-quit?
Thanks
You could save a plist like this as ~/Library/LaunchAgents/test.plist
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>test</string>
<key>Program</key>
<string>/Applications/Untitled.app/Contents/MacOS/applet</string>
<key>RunOnLoad</key>
<true/>
</dict>
</plist>
It can be loaded with launchctl load ~/Library/LaunchAgents/test.plist
or by logging out and back in.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.