Copy remote clipboard


#1

Copy the clipboard from a remote device.

Action Directory link: https://actions.getdrafts.com/a/1I5

This action is handy for copying text from a remote device if you don’t have access to something like Universal Clipboard. When modifying short scripts, I find this action faster than saving to and import from the cloud.

Setup

Enter the address of the remote device in the first script step of the action.

You’ll need a simple helper script on the remote device to receive an HTTP request and return the clipboard.

If you have Python, install pyperclip and try the following script.

#!/usr/bin/env python

PORT_NUMBER = 8080

import pyperclip
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer

class S(BaseHTTPRequestHandler):
	def do_GET(self):
		self.send_response(200)
		self.send_header('Content-type','text/plain')
		self.end_headers()
		self.wfile.write(pyperclip.paste())

HTTPServer(('', PORT_NUMBER), S).serve_forever()