Basically I am looking for a JavaScript equivalent to this little AppleScript:
property shortDelay : 0.1
property medDelay : 0.3
tell application "System Events"
try -- Important to use a try block because down keys can get stuck
key down {option}
delay shortDelay
keystroke return
delay medDelay
key up {option}
end try
end tell
The following does not work:
sf.keyboard.modifiers({
isOption: true
});
sf.wait({ intervalMs: 20 });
sf.keyboard.press({
keys: 'return'
});
sf.wait({ intervalMs: 50 });
sf.keyboard.modifiers();
- Christian Scheuer @chrscheuer2018-07-03 11:51:33.402Z
Not tested, but you might be able to do:
sf.keyboard.press({
keys: 'alt+return'
});- ?@anon6770933309
I tried
sf.keyboard.press({
keys: 'option+return'
});which didn't work. I'll give yours a try.
- In reply tochrscheuer⬆:?@anon6770933309
Nope, doesn't work.
I need it for this dialog.If you press "Remove" (= return) while holding down the option key it will clear the undo queue.
Christian Scheuer @chrscheuer2018-07-03 12:02:53.312Z
Oh, that's a nice feature!
Hm not with SF right now, but if you can find the "Remove" button... eg. something... dialog.getFirstWithTitle("Remove").mouseClickElement({ isOption: true });
That might be a workaround for now- ?@anon6770933309
Thx for the hint, will give it a try. 😉
- In reply tochrscheuer⬆:?@anon6770933309
OK, I have
sf.ui.proTools.focusedWindow.getFirstWithTitle("Remove").mouseClickElement({ isOption: true });
but this works only half way through, it doesn't press the option key it seems, little video attached.
demo.mov (648.4 kB)
- ?In reply toanon6770933309⬆:@anon6770933309
Got it:
// Click "Remove" button and clear undo queue sf.keyboard.modifiers({ isOption: true }); sf.ui.proTools.focusedWindow.getFirstWithTitle("Remove").elementClick();
😀