How to press a key twice in combination with the Command key.

tell application “DeepL”
activate
end tell

tell application “System Events”
tell process “DeepL”
key down 55 --Command
repeat 2 times
key code 8 --“c”
end repeat
key up 55
end tell

end tell

–The target to be achieved is to press Command-c-c
–The above code does not work.

–I appreciate any help.

This should work for you.

tell application "DeepL" to activate

tell application "System Events" to  tell process "DeepL"
	keystroke "cc" using {command down}
end tell

(*
Thank you very much for replying, wch1zpink.

I’m not quite sure what happened with the first few attempts to play the hotkey in this application.

The first attempt was precisely to write the solution you suggest and it didn’t work.

Then I interpreted that I had to hold down the Command key (that’s why I wrote that strange code) and it didn’t work either.

Trying it later, the solution is simpler: just pressing twice repeatedly the Command-c combination.

Thanks again for trying to help me.

Regards. :slight_smile:
*)

tell application “System Events” to tell process “DeepL”
keystroke “c” using {command down}
keystroke “c” using {command down}
end tell