Why not a single tap method to send the phone's clipboard contents to my desktop? Why not also put it directly into the clipboard on my computer? While I'm at it, if it's a link, why not have a Firefox bookmark already configured to go there?
This is all done in Linux with KDE, but should work with other desktops and probably other Unix systems. It's pretty simple but requires sending email on the iPhone's command line and receiving email on the computer's command line. I used mailx and getmail respectively, so I will assume anyone who can set those up can read these scripts and customize them for their system. But as a warning, the way it is written, it downloads all email, looks for one email with a keyword, then deletes all email. I set up a seperate email address just for this purpose, but keep that in mind if you use command line email.
The iPhone script requires a jailbroken phone, Pasteboardstacker and nail (a.k.a. Heirloom mailx). Pasteboardstacker is an clipboard app that keeps a list of the things you've copied. You double tap the status bar and the list pops up, allowing you to select any of the items to be pasted. It is used here because the phone's clipboard is hard to descramble and Pasteboardstacker's contents are easy. Nail/mailx is a command line email sender. One tip, put your config info in /var/mobile/.mailrc. Nowhere else seems to work, neither does using nail.rc.
The first line extracts the last thing you copied from Pasteboardstacker's plist, the second line emails it to you, prepended by the string "SendiLinkHome". Pretty simple.
You can now use my earlier post as a guide to getting that to run from a SpringBoard icon to send your clipboard contents home with one tap.
#! /bin/sh
file=~/Library/Preferences/com.hitoriblog.pasteboardstacker.plist
text=$(cat $file | sed -e '0,/<string>/d' -e '/<\/string>/,$d')
echo "SendiLinkHome $text" | mail "user@address.com"
On the computer side, you need a way to get email such as getmail and optionally, xsel. Xsel is a command line tool that you can use to put things in the clipboard. If you run this command "echo sometext | xsel -p" then use your mouse to paste, it will paste "sometext".
This script does this: if there is new mail, it looks for "SendiLinkHome" and, if found, it takes the text you sent from your phone and does the following things:
1) it sends the contents to the clipboard using xsel
2) if the text is a link to a webpage, it creates a webpage named "iLink.html" which will redirect to that link. Why? Because you can create a file names "iLink.html", open it in your browser and bookmark it. Now when this script runs, that link will redirect to the link you sent from your phone.
3) if the text is not a link, it still puts it into iLink.html with no html formatting. Now when you click the bookmark, it will just display the text. This may be useful if you want to use the text online.
#! /bin/sh
if
getmail -r /path/to/getmailrc | grep Retrieved
then
cd ~/Mail/new
link=$(cat *localhost | grep -A 1000 SendiLinkHome | sed 's/SendiLinkHome //g')
rm *localhost
# send the contents to the clipboard
echo "$link" | xsel -p
# create an html file which is pre-bookmarked in Firefox
if
echo "$link" | grep http > /dev/null
then
echo -n '<html>
<head>
<title>Reverse Prowling</title>
<meta http-equiv="REFRESH" content="0;url=' > /path/to/iLink.html
echo "$link" >> /path/to/iLink.html
echo '></HEAD>
<BODY>
Redirecting...
</BODY>
</HTML>' >> /path/to/iLink.html
# if it's not a link, put the text in
# iLink.html anyway so it can still be
# opened by firefox. Optionally, put it in
# a text file on the desktop or wherever it may be useful.
else
echo "$link" > /path/to/iLink.html
fi
fi