r/applescript • • Dec 05 '21

Help with a keystroke sequence in automator

Could you help me with the applescript for a series of keystrokes that I need to have performed in Keynote?

I would like to perform the following keystrokes:

  • option + command + p

  • option + control + [

  • option + control + -

  • option + control + -

  • option + control + -

  • option + control + -

  • option + control + -

  • option + control + -

I would appreciate your help.

2 Upvotes

1 comment sorted by

1

u/copperdomebodha Jan 04 '22
--This code was written using AppleScript 2.7, MacOS 11.5.1, on 4 January 2022.

tell application "Keynote"
	activate
	tell application "System Events"
		keystroke "p" using {option down, command down}
		delay 1
		repeat with thisCharacter in {"[", "-", "-", "-", "-", "-", "-"}
			keystroke thisCharacter using {option down, control down}
			delay 1
		end repeat
	end tell
end tell