I have some text in a file copied to the clipboard via command line and I then wish to paste this content to a website.

cat file | pbcopy 

/usr/bin/open -a "/Applications/Google Chrome.app" 'http://google.com/'

(1) How do I paste to say google (if it's even possible)?

(2) Is it possible to open a different website, tab x amount of times and then paste?

up vote 1 down vote accepted

For sending keystrokes to a graphical application from a command-line program you can use xdotool (you may need to install it first). See the answer by Gilles to the question "How to send keystrokes (F5) from terminal to a process?" on Unix & Linux.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.