Title
Press Keys not working for Force Quit Applications
What do you expect to happen when you run the script/macro?
I'm just trying to setup a macro to force quit pro tools. It's failing at step 3 of just the "press keys" action of Cmd+Opt+Esc. The first 2 steps are simply Activating the Pro Tools app and then waiting for the Pro Tools App to become active.
Originally I just put all 7 steps together, but the error notification started showing when the Force Quit Applications window wasn't popping up saying, "UI element didn't show after 2000ms". So I reduced the actions down to just the first 3, and yeah it looks like the press keys option for Cmd+Opt+Esc just isn't working.
Are you seeing an error?
UI element not showing after 2000ms
Shows in the top right
What happens when you run this script?
I did on the first page :)
How were you running this script?
I clicked the "Run Script" or "Run Macro" button in SoundFlow
How important is this issue to you?
3
Details
{ "inputExpected": "I'm just trying to setup a macro to force quit pro tools. It's failing at step 3 of just the \"press keys\" action of Cmd+Opt+Esc. The first 2 steps are simply Activating the Pro Tools app and then waiting for the Pro Tools App to become active. \n\nOriginally I just put all 7 steps together, but the error notification started showing when the Force Quit Applications window wasn't popping up saying, \"UI element didn't show after 2000ms\". So I reduced the actions down to just the first 3, and yeah it looks like the press keys option for Cmd+Opt+Esc just isn't working. ", "inputIsError": true, "inputError": "UI element not showing after 2000ms\n\nShows in the top right", "inputWhatHappens": "I did on the first page :) ", "inputHowRun": { "key": "-MpfwYA4I6GGlXgvp5j1", "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow" }, "inputImportance": 3, "inputTitle": "Press Keys not working for Force Quit Applications" }
Source
//Macro converted to script
sf.ui.proTools.appActivate();
sf.ui.proTools.appWaitForActive();
sf.keyboard.press({
keys: "cmd+alt+escape",
repetitions: 1,
fast: true,
});
/* sf.ui.app("com.apple.loginwindow").windows.whoseTitle.is("Force Quit Applications").first.getElement("AXTitleUIElement").elementWaitFor(); */
/* sf.keyboard.press({
keys: "return",
fast: false,
}); */
/* sf.ui.app("com.apple.loginwindow").windows.whoseTitle.is("Force Quit Applications").first.scrollAreas.first.tables.first.children.whoseRole.is("AXRow").allItems[5].children.whoseRole.is("AXCell").first.getElement("AXTitleUIElement").elementWaitFor(); */
/* sf.keyboard.press({
keys: "return, escape",
}); */
Links
User UID: jiWtPcb5qUaxV7vfV9wspMnsi982
Feedback Key: sffeedback:jiWtPcb5qUaxV7vfV9wspMnsi982:-NJKWvLuRVoe3E8r_UcY
- Chris Shaw @Chris_Shaw2022-12-15 18:36:26.547Z2022-12-15 19:02:31.486Z
You should always use UI / Menu actions whenever possible instead of keypresses.
Try this - it will force quit the frontmost / focused application:
sf.ui.frontmostApp.menuClick({ menuPath: ["Apple", "Force Quit…"], }); // define Force Quit window const forceQuitWin = sf.ui.app("com.apple.loginwindow").windows .whoseTitle.is("Force Quit Applications").first // wait for Force Quit window forceQuitWin.elementWaitFor(); forceQuitWin.buttons.whoseTitle.is("Force Quit").first.elementClick();
- JJon Horton @Jon_Horton
Thanks so much for your help! It looks like some of my UI element stuff isn't working to complete this macro. It's stopping at the prompt "Do you want to force "Pro Tools" to quit?" It won't click the default force quit option. Doing a "Press Keys" with "return" doesn't work here either.
https://capture.dropbox.com/mwZgtvgSutSbZEVH
//Calling command "Force Quit Pro Tools until final prompt" from package "Jon's Macros"
sf.soundflow.runCommand({
commandId: 'package:clbq3pgwm0000hu108qezjcgs',
props: {}
});sf.ui.app("com.apple.loginwindow").windows.whoseTitle.is("Force Quit Applications").first.sheets.first.getElement("AXDefaultButton").elementClick();
sf.ui.app("com.apple.loginwindow").windows.whoseTitle.is("Force Quit Applications").first.getElement("AXTitleUIElement").elementWaitFor();
sf.ui.app("com.apple.loginwindow").windows.whoseTitle.is("Force Quit Applications").first.getElement("AXCloseButton").elementClick();
- JJon Horton @Jon_Horton
This looks better. Sorry.
//Calling command "Force Quit Pro Tools until final prompt" from package "Jon's Macros" sf.soundflow.runCommand({ commandId: 'package:clbq3pgwm0000hu108qezjcgs', props: {} }); sf.ui.app("com.apple.loginwindow").windows.whoseTitle.is("Force Quit Applications").first.sheets.first.getElement("AXDefaultButton").elementClick(); sf.ui.app("com.apple.loginwindow").windows.whoseTitle.is("Force Quit Applications").first.getElement("AXTitleUIElement").elementWaitFor(); sf.ui.app("com.apple.loginwindow").windows.whoseTitle.is("Force Quit Applications").first.getElement("AXCloseButton").elementClick();
Chris Shaw @Chris_Shaw2022-12-16 15:54:01.776Z
try this:
sf.ui.frontmostApp sf.ui.frontmostApp.menuClick({ menuPath: ["Apple", "Force Quit…"], }); // Define force Quit window const forceQuitWin = sf.ui.app("com.apple.loginwindow").windows .whoseTitle.is("Force Quit Applications").first // Wait for force quit window forceQuitWin.elementWaitFor(); //Click Force Quit forceQuitWin.buttons.whoseTitle.is("Force Quit").first.elementClick(); // Wait for sheet forceQuitWin.sheets.first.elementWaitFor(); // Click Force Quit on sheet forceQuitWin.sheets.first.buttons.whoseTitle.is("Force Quit").first.elementClick();
- JJon Horton @Jon_Horton
Worked wonderfully!