I want to perform two keystrokes in AppleScript, successively. The script should perform Command+Shift+J and after that Command+W in the application Google Chrome.

Can this be done with AppleScript?

2 Answers 2


Try using a script like this:

activate application "Google Chrome"
tell application "System Events"

    keystroke "j" using {shift down, command down}
    delay 1
    keystroke "w" using command down
    delay 1

end tell
  • Why repeat, even without n times? I had to kill applications because of the infinite repeat. :( Commented Dec 28, 2016 at 20:41
  • Removed repeat. Commented Dec 28, 2016 at 20:46

Yes, you need to script the System Events application.

There is a good start here

There is a good detailed answer here with lots of required details.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .