简体   繁体   中英

Quit a Mac application from a JavaScript for Automation (JXA) script

The AppleScript way to quit a Mac application is:

tell application "iTunes"
  quit
end tell

How do you quit an app with JavaScript for Automation (JXA) ?

Quitting an application with JavaScript for Automation is done like this:

var itunes = Application('iTunes');
itunes.quit();

(Note that the Application call looks inside the /Applications directory. Any app there can be called by name.)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM