Perform two keystrokes successively in AppleScript

applescript

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?

Best Answer

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