Apple Script Command Sendkeys?
From the AppleScript System Events dictionary:

key code integer or list of integer : The key code(s) to be sent. May be a list.
    [using command down/‌control down/‌option down/‌shift down or list of command down/‌control down/‌option down/‌shift down] : modifiers with which the key codes are to be entered
keystroke text : The keystrokes to be sent.
    [using as above]

Some examples illustrating their use:
tell application &quot;System Events&quot;       
    key code 124 using {shift down, command down} --&gt; Right arrow
    key code 8 using command down --&gt; ⌘-C
    key code {4, 14, 37, 37, 31, 47} --&gt; H, e, l, l, o, .

    keystroke &quot;v&quot; using command down --&gt; ⌘-V
    keystroke &quot;Hello.&quot; --&gt; H, e, l, l, o, .
end tell

(Note: I stylised ⌘-C and ⌘-V with their uppercase representations, but these indicate Cmd+C or V, respectively, without use of the Shift key.)
keystroke can also accept the AppleScript constants tab, space return, and quote.
The target is always the application window that has focus, so it’s important to set the focus to the desired application before issuing these commands (e.g. tell application &quot;Finder&quot; to activate).
Here’s a great reference for the keycodes as well as a detailed overview of these commands including more examples.