Are you on the latest OS? In earlier versions this was 'iTunes', so you might try targeting that. If the script doesn't compile then it doesn't recognize the app 'Music'. This will need to expand to cover all the apps in question, with each one requiring specific commands based on what you want it to do. we don't care about this app's docs, so ungracefully quit simplified - this would need to be expanded for new docs that need naming, etc.Įlse if name of thisApp is "Another App" then If name of thisApp is "Some App That Won't Quit" then Once you have the list you'll need to craft specific code for each application in question, telling it what to do. waiting for user input) will still be running. At the end, any apps that are at fault (e.g. Here it will run the same way, but (I think - untested!) it won't wait for the application to respond, which should allow the script to continue with the other apps. You can add some finesse to your script by using something like: Trial and error will pretty quickly identify the application - they'll still be running after the app quits. Also 'set volume 0' is also deprecated in favor of 'set volume output muted true', which preserves the previous volume level (if you set it to 0 you have no automatic way to know what it was previously for when you want to restore sound). Not hard to do if you have a short list of apps, but a PITA if you have many.Īs an aside, the 'set volume' command is a standard command that does not need to be targeted to the Finder. Your only real solution is to look at the apps that are breaking the script and add custom code for each one, telling it to save state (or not) before quitting. Now, over the years, Apple have tried to nudge developers into gracefully quitting by silently saving state and restoring that state when it resumes (maybe saying the documents in a temporary location so you can decide later on what to do), but not all apps do that. That will tie into the 30 second timeout, and if the app doesn't finish (maybe because you weren't even aware that it was asking you what to do with the open documents), then the script will fail. For example, if an application has open documents, it might pause and wait for you to decide what to do with that - save? discard? something else? If any single command takes longer than that to execute then AppleScript assumes an error has occurred and it bails.Īny app should respond to the 'quit' command, but one issue is how apps react. What you're trying to do is actually harder than you might think.įirst, think of the fact that AppleScript has a built-in timer for each command (default is 30 seconds). As I said, this script lots of times runs flawlessly,esp #2 I have given the script all the permissions it asks for. Have been unable to run this CONSISTENTLY on a 2019imac running the latest catalinaĪny suggestions on hoe to eject all volumes and quit all apps?įYi I have been able to run ex 2 on a mb pro running catalina successfully. The eject disks runs but the quit apps often, not always fails with: Tell application "System Events" to set quitapps to name of every application process whose visible is true and name is not "Finder" Set allApps to displayed name of ( every process whose background only is false) as list Tell application "Finder" to eject (every disk whose ejectable is true) Tell application "Finder" to set volume 0 I have tried various apple/automator scripts for weeks.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |