Clipboard from Phone to PC and Clipboard from PC to Phone

Here’s another one that just tickles me.

This works so great for strings I am loving it. Basically, the shortcut asks if I want to transfer in or out from the phone and either appends my phone’s clipboard to a file in Dropbox or reads from a different file to pull into the clipboard.

Meanwhile, on the PC, I have an AutoHotkey script running that looks for the transfer in file, and if it exists read the contents, transfer it to the clipboard, and delete the file and display a notification on the screen.

There’s also a hotkey I can trigger to write the contents of my PC’s clipboard to a text file, then on the phone, I have the shortcut read that file and save it to the phone’s clipboard.

So stink’n simple. I love it. Hope someone else can get some use out of it!

https://www.icloud.com/shortcuts/8a54c161c00f4b12ab8f7d2667038bfa

Here’s a version of the AHK script (this is the basics, mine is a little different with better notifications, but I rewrote it for you as basic as I can with comments)

DropClip.ahk

; Setup a timer to execute every second (1000 miliseconds)
SetTimer, ClipboardTransfer, 1000
return

; Triggered when you push Ctrl+Alt+c
^!c::
{
	; write the clipboard contents to your dropbox clipboard txt file -- ex. c:\users\<YOU>\Dropbox\clipboard_out.txt
	FileAppend, %Clipboard%, c:\users\<YOU>\Dropbox\clipboard_out.txt
	
	; optionally display a message
	MsgBox, 4160, Clipboard Transfer, The Clipboard contents have been written to the transfer file.
	return
}


; The subroutine set by the SetTimer command at the top
ClipboardTransfer:
{
	; set a quick variable to the path to your dropbox clipboard txt file -- ex. c:\users\<YOU>\Dropbox\clipboard_in.txt
	file := "c:\users\<YOU>\Dropbox\clipboard_in.txt"
	IfExist, %file%
	{
		; read the contents of the clipboard_in.txt file and put it into a variable called "clip"
		FileRead, clip, %file%
		
		; write the contents to the Clipboard
		Clipboard := clip
		
		; delete the clipboard_in.txt file
		FileDelete, %file%
		
		; optionally display a message
		MsgBox, 4160, Clipboard Transfer, The Clipboard has been updated!
	}
return

}

I have something very similar. I don’t use a constantly polling Autohotkey script. Instead I use a keyboard combination for Autohotkey to read the file into the clipboard and paste it (or conversely copy to the clipboard and into the file) only when I want to use it. Slightly slower as the content isn’t automatically in the clipboard all the time, but I get good control across multiple devices (i.e. I can grab the content for whatever PC I want it on, but not all of them), lower overall overhead and, like yours for the upload, not everything on my clipboard gets pushed automatically to Dropbox.

It is a very useful tool for those of us working cross platform. :sunglasses:

Yes very much so. The sample script I posted is for those just coming into the AHK neighborhood. My daily script does a ton more not mentioned here, which is where the dropclip script is embedded with custom GUI notifications and whatnot.

It’s nice to see a fellow ahk’er on here. :wink:

Are we the only Windows users on here? :laughing:

1 Like

AHK isn’t something that people have needed a lot of support with on this forum so far, so I haven’t particularly had a need to post about it.

My ‘daily script’ also does fair bit I guess. It’s broken into several dozen small libraries that vary in breadth of scope and size, and they all get loaded up when the primary script loads in at login.

My listing looks something like this … though I’ve had to obfuscate a number of entry names for confidentiality (i.e. work) reasons.

1 Like

Yep. We would get along great. We have a very similar setup. I too have quite a hefty modulated setup that gets called on demand and on startup.

I also created a simple winforms dropdown list (triggered by ^!1p) at the top of my screen to run modulated scripts on demand. I did this because I forgot all the hotkeys I had assigned and couldn’t remember the infrequent ones.

By far though, my favorite thing to do with AHK is my multi-keyboard setup. It’s so handy, it’s stupid.

We should definitely chat more and share some AHK stuffs :wink: