Hoping someone can help me figure this out. I'm trying to build a Quick Action in Automator that copies three text values, stores them as variables, then pastes them when directed. Right now I built it where it runs AppleScript to copy the first value from a spreadsheet to the clipboard, gets the contents of the clipboard, sets the value of the variable, then repeats that another two times. That part seems to work, but the next step has not. I tried to run an AppleScript where the variable is passed in, the input is set as the value of a new variable, then System Events keystrokes the variable. I either get the error that the variable isn't define or that the keystroke can't continue.
Keystroke means it will send a "C" to the program and not actually press the C key. Try using
key code 8 using command down.
Also, you may want to add a line with
activate after the "tell Excel" command to ensure the program is the frontmost application.
delay 0.5 between commands, so the program has enough time to process the information before firing the next step.
You can get a list of full key codes here:
Other possible issues: make sure the get value of variable is ignoring the preceding action, otherwise sometimes Automator will pass more than one variable ahead. You could also use
item 1 of input as string, because sometimes it will get the wrong kind of data.