Jump to content

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!

Link to comment

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.

 

Link to comment
  • 2 years later...
On 1/9/2019 at 11:34 PM, deanishe said:

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

@deanishe, I want to avoid copy/pasting gpg passwords as I fear that those passwords can be sniffed from clipboard. I was thinking about using custom workfow with  bitwarden cli + this apple script. Can you be so kind to advice if such solution might be a bad idea? Like everything that goes using apple scripts is logged in some place and can be easily read? Or maybe you can point me in some direction with the ways to protect my clipboard? 

Edited by zigmundfreud
Link to comment
41 minutes ago, zigmundfreud said:

Or maybe you can point me in some direction with the ways to protect my clipboard? 

One way to do so is to go to Alfred preferences > Features > Clipboard History and then go to Advanced and add, to Ignore Apps, any app that you don't want to use the clipboard in Alfred. However, I appreciate that may not be what you want.

 

Stephen

Link to comment
4 hours ago, zigmundfreud said:

I fear that those passwords can be sniffed from clipboard

 

If you have malicious software running on your system that can sniff your clipboard, it can almost certainly steal or subvert other things, too, and your goose is already cooked. Putting passwords on the pasteboard is perfectly common. The important thing is to mark the data as transient (which Alfred's Copy to Clipboard can do), so clipboard history managers like Alfred don't remember it.

 

If you're planning to immediately paste the password, it might be a good idea to clear the clipboard after a few seconds.

Edited by deanishe
Link to comment

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
×
×
  • Create New...