Jump to content
jhinden

Simulate Typing (or Pasting text without copying to clipboard)

Recommended Posts

I have a script where I'd like to enter some text after opening up a search window. How can I have it enter a specific line of text without copy/pasting? 

Worfklow is like this:
Open chrome

Type command f

Enter a specific line of text (Joe Smith).

 

How can I do this? Should I setup a snippet and then have that snippet triggered somehow at a specific moment in the script? Thanks!

Share this post


Link to post

Snippets actually use the clipboard. Alfred just restores the old clipboard content after the snippet has been expanded.

 

What is your objection to using the clipboard?

Share this post


Link to post

I see. Well, if you use copy/paste it clears what's in the copy/paste buffer which was actually the point of the workflow (sorry I didn't specify clearly before). 


I'm trying to automate several things for different apps based on the same workflow where I'm constantly emailing or sending links to my business partner in gmail, hangouts, slack, etc. 

 

To send something in Slack, it would be like this:

  1. Copy something from the web. 
  2. Launch slack desktop.
  3. Command - K
  4. Automatically type the name of the person I wish to find
  5. Enter
  6. Command - V to paste the thing I wanted to send them

I believe Keyboard Maestro has this ability to enter text without copy paste, so maybe I can make a shortcut to trigger an action using keyboard maestro for the 'typing' but it's a shame to have to use two apps. 


Thanks in advance.

 

Share this post


Link to post

So you just don't want the data to stay on the clipboard?

 

You can simulate typing text with AppleScript: tell application "System Events" to keystroke "your text goes here"

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×