sendtodropbox

Latest

  • Weekend Geek Project: Create your own image hosting system

    by 
    TJ Luoma
    TJ Luoma
    06.14.2014

    For the past several years I have been trying to come up with a good way to post images to the web from my iPhone. Now that I have a Mac as my web server via MacMiniColo, it is incredibly easy. Now, I'll be completely honest, setting this up did take some time and effort. It is not as simple as clicking a button, but if you can follow some instructions, you can do it too, assuming that you have access to all of the pieces. The Goal This shouldn't be a difficult problem to solve: I have an image on my iPhone. I want to post it to the web and get an URL that I can use. I have tried all of the various image sharing services out there. They all have the same problems: either they are chock full of ads and don't want to give you just a plain URL to use, or they go out of business. Or, sometimes, both. The latest one to go under is mlkshk, which is a shame not only because they provided a great service, but when I checked the various "Terms of Service" at different image hosting companies, they had the best one. But even if there was a great service out there with a great app, I'm still not sure that it would be better than the "holy grail" solution that I have wanted: Take a picture on my iPhone using the regular camera app (or any other). Edit it (or not) using the regular photos app (or any other app). Email the picture, which gives me a chance to reduce the size (or not). Receive an URL to the direct image via push notification. Since I couldn't find the service that I wanted, I've tried rolling my own a few times, but none of them worked as fast or as easily as I wanted, until I figured out the last missing piece. The Pieces of the Puzzle I won't hold you in suspense: the last missing piece was a real Mac server. I recently signed up for MacMiniColo and I couldn't be happier with the decision unless I could get in a time machine to go back and make it sooner. Once I had a Mac server, the rest of the pieces were easy: SendToDropbox - gives you a private email address that you can use to email files and have them added to your Dropbox. Although paid accounts are available, you can start using it for free. A shell script (naturally) which will move the file from the SendToDropbox folder to the appropriate web folder, and do some other housekeeping. Pushover (or Prowl) - to send push notifications from your Mac to your iPhone. SendToDropbox Once you have created a SendToDropbox account and linked it to your Dropbox, you'll need to go to https://sendtodropbox.com/account and create a special email address just for this purpose. It will generate a random email address for you. Keep it random. That way no one else will be able to post pictures to your website via email! (For added security, see the "Whitelist" settings in SendToDropbox.) Once you have your SuperSekret SendToDropbox email address, go to the "Organization" tab, and drag the "To Address" and "Subject" from under "Available Attributes" to "Destination" so that it ends up as shown above. Make sure that the "To Address" comes before the "Subject." What this means is that every file that you send to your SuperSekret@sendtodropbox.com email address will be saved to ~/Dropbox/Apps/Attachments/SuperSekret@sendtodropbox.com/Your Subject Here/. I'll explain why that's important in a moment. launchd There is a feature in launchd called QueueDirectories which looks at a directory. It has to end up being empty, but that's OK because we are going to empty all of the files when we're done. Replace /Users/jsmith/Dropbox/Apps/Attachments/SuperSekret@sendtodropbox.com with whatever the SendToDropbox path is on your Mac: Now what about that /usr/local/bin/sendtodropbox-image.sh file? Well, that's the last piece of the puzzle. sendtodropbox-image.sh The script sendtodropbox-image.sh is going to process the files in your SendToDropbox folder ~/Dropbox/Apps/Attachments/SuperSekret@sendtodropbox.com by moving them into the folder that you use the host images, and then it's going to send you the URLs via Pushover using a shell script called posh that I have previously discussed over at GitHub. It also uses jhead to make sure that the iPhone pictures appear with the correct rotation. If you do not have it installed already, I recommend brew install jhead (or you can get it from rudix ). Now when I want to post an email, I just send an email, choose the size: and then about a minute later I'll get a confirmation with the URL And then I can use that image anywhere. Like right here, for example: You do not need a Mac server to do this if you have an "always on" Mac, you could do this and then sync it to any web server using unison or rsync. However, you'll have to figure out those steps on your own. Now that I've experienced what it's like to have a real Mac server, I can't imagine going back to anything else. If any of you scoffing at the idea that a Mac mini could be a "real" server: I am using a 2010 Mac mini (Macmini4,1) Intel Core 2 Duo with 2.66 GHz process with 4 GB of RAM and a non-SSD hard drive. Most of us would look at those specs and say that it is not "new" and not "powerful" but it rocks as a server. I've been running lots of apps on it at once, including Time Machine, Dropbox, OwnCloud, and BitTorrent Sync (I'm testing sync options for another article), as well as hosting my own websites on it, and it hasn't even blinked. Summary Recap Here's a checklist for you if you want to re-create this on your own Mac: Create a SendToDropbox account Setup an email address to be used for this purpose and configure its "Destination" as shown above (e.g. ~/Dropbox/Attachments/Foo/) Add the email address to your iPhone contacts Create a launchd plist file in your ~/Library/LaunchAgents/ folder named something like com.tjluoma.sendtodropbox.email-to-url.plist Set the QueueDirectories to the directory used by your SendToDropbox address created in step 1 ( ~/Dropbox/Attachments/Foo/) If you do not plan to put the shell script at /usr/local/bin/sendtodropbox-image.sh be sure to change the contents of the plist to point to wherever you will save the script. Load it using this command (substituting whatever name you chose): launchctl load ~/Library/LaunchAgents/com.tjluoma.sendtodropbox.email-to-url.plist Create the sendtodropbox-image.sh script, ideally at /usr/local/bin/ Change the SOURCE= line to point to the folder described in Step 1 (that is ~/Dropbox/Attachments/Foo/ or whatever you chose) Change the DIR= to the folder to your web server's path Make sure it is executable: chmod 755 /usr/local/bin/sendtodropbox-image.sh Setup Pushover Create a new account at https://pushover.net/login Generate a Token and User key at https://pushover.net/apps/build Get po.sh, configure it, make it executable Install jhead That's all. The setup will take you some time, but once you have it, you can use it with the knowledge that you never have to worry about a 3rd-party image hosting company going out of business, or changing their terms of service, or anything else they might do.

  • Using Keyboard Maestro 6 to automate a web database

    by 
    TJ Luoma
    TJ Luoma
    07.18.2013

    One of my favorite new features in Keyboard Maestro 6 is the ability to click on links in web pages using either Safari or Google Chrome. This new feature let me make an old macro (which was based around trying to click in the right place) a lot more efficient. I'm going to show you how I set this up. Although you probably won't be using this same web database system, chances are good that you could encounter something similar to it. My hope is that this will help people who are unfamiliar with Keyboard Maestro (or macro programs in general) understand how they might use automation to help make their computing lives a little easier. "What can't be automated?" Every week I log into EBSCO, a web database of journal articles. I put in my search terms or follow links from TextWeek - another site which has indexed articles by topic and links to EBSCO. That takes me to a summary page for the journal article which gives me publication information. I go through the results and find the articles that I want to read. There is no practical way to (usefully) automate that. I could probably find some way of fetching all of the results for a specific topic, but that wouldn't really be very useful. It's not exactly the stuff of summer blockbuster movies, but I rather enjoy it. The automation part kicks in when I actually find something that I want to read. Automate the tedious stuff Once I find an article I want to read later I have two options: I can click through and read the PDF through the site itself. This is invariably a lousy experience. The PDF ends up being loaded into one part of the screen, surrounded on three sides by parts of the website interface. I can save the PDF to my Downloads and/or open it in Preview, but it's all very clumsy and inefficient, as anyone who has used any sort of web database like this can attest. I can email the PDF to myself. In fact, I can email the PDF to myself and get a copy of the bibliographic information including a link back to the original in case I ever need to find it again. That's much nicer. Well, at least, theoretically. In practice, it's still fairly clumsy and inefficient. I have to click the "E-mail" link on the side of the page, as shown in the image below: There's no keyboard shortcut for that link, of course, which means I have to use the mouse. Or do I? Actually, with Keyboard Maestro 6 I can assign a keyboard shortcut to clicking links, and so I have set ⌘ + Y ("Y" as in "Y"es I want to read this article, but also because the key combination wasn't in use by Safari). When I press ⌘ + Y, Keyboard Maestro will click that link for me. But we're just getting started. Clicking that "E-mail" link doesn't actually email the PDF to me. In fact, all it does it open another AJAX/JavaScript pseudo-window with several additional fields: my email address. Yes, every time. No, it never remembers it, no matter how many times I've typed it in before. A Subject: line for the email. You might think that the title of the article I am reading would be automatically filled into the Subject: field, but you would be mistaken. A checkbox for sending the bibliographic information in plain text instead of HTML. You have probably already guessed that I'm not filling all of that in by hand, so you're probably expecting that I'm going to create another macro, right? Wrong! I don't need another macro, I can still use the one I've already created. Macro Step 1: "Click 'E-Mail' link" Macro Step 2: "Wait until 'Send' button appears (in that JavaScript/AJAX pseudo-window). Macro Step 3: When that button appears, press Tab twice to get to the "Email to" field. Macro Step 4: Fill in my email address (remember this part later) Macro Step 5: Press Tab again and enter the Title of the Safari window (which Keyboard Maestro can easily do) into the Subject: field Macro Step 6: Press Tab two more times which will put me on the checkbox for 'Send in plain text format' Macro Step 7: press Space to toggle the checkbox Which gives me something like this: Let's look at those steps again. Are any of them difficult? No. But how many times would I accidentally make a typo in my email address? Or tedious would it be to keep copying and pasting the Title: into the Subject: field versus the 0.01 seconds it takes the computer to do it automatically? How many times would I accidentally paste the Subject: into the 'Comments' box? Or forget to check the 'Plain Text" box? Macro Step 8: click that "Send" button Now we're done, right? Aha, you're catching on. We're not quite done. After the email is sent, there's a confirmation window: Macro Step 9: Pause until the "Continue" button appears, then press it. Now here's another little detail: sometimes I will open a bunch of tabs, and each tab is a different article, so when I am done, I want to close the tab because there is nothing more to do with it. However, other times I will click through from the search results and the article loads in that same page. If I close the tab there I will lose my search results and have to go back and start over again. Fortunately, there is an easy solution. Macro Step 10: If Safari's menu option "History » Back" is enabled, select that menu option and take me back to the search results, but if that menu option is not enabled it means that this article was opened in its own tab. Keyboard Maestro can do this easily. Just fill in the blanks: How many times would I accidentally choose the wrong one? Knowing myself, a lot. Sure, it should be possible to just re-open the last tab, but it doesn't always work that way, especially when working with database queries. If I was to do each of those steps myself, it would take about 20 seconds for each page, assuming that I never made a mistake. (Even that is cheating because I have a TextExpander macro for my email address.) It takes Keyboard Maestro between 2–3, and most of that time is actually waiting for the server-side actions to happen. This morning I found 15 articles that I wanted to read: 20 seconds times 15 articles is about 5 minutes. To me there's a bigger factor than the time saved: the convenience. Having this process take just a few seconds instead of a few minutes means that I can keep my focus on what I am doing. That means more attention on the parts of the process that can't be automated: the searching and the reading. More time and energy to do the parts of the task that I want to do and enjoy, and less time and energy spent on the boring parts that the computer does faster and more precisely anyway. One more thing... Maybe two... Remember "Macro Step 4: Fill in my email address"? There's actually a 'trick' to that part too. Because I'm having the computer do the typing anyway, I actually have it send each article to two email addresses (separated by semi-colons, not commas... Why? You'd have to ask EBSCO). The first is my regular Gmail address where the article gets filtered away "just in case." The second email address is a SendToDropbox.com address which I specifically use for these kinds of articles. I don't know what kind of black magic they are using over there at SendToDropbox, but by the time I have closed the tab or gone back to the previous page in Safari, Dropbox is already downloading the files that I have emailed to myself. SendToDropbox can automatically sort the files by date (which is handy since that will, effectively, group them by topic for me since I generally search for one topic per day). Of course I can't stop there, so I have Hazel at that folder which does some even nerdier things to the files that SendToDropbox creates. The point isn't to do what I have done... As I said at the beginning, chances are you don't use the same database to lookup journal articles... But what do you do on a regular basis that could be automated? Are there parts of something that you do over and over again that you find really tedious that the computer could do for you? These automation tools – Keyboard Maestro, Hazel, TextExpander – won't make you think that you are living with The Jetsons, but they can smooth out rough edges in your computing life, making it less frustrating and more enjoyable. That's why automation continues to be a big focus for me as I look for the "little things" that add up to a better experience using my Mac.

  • Roundup review of iOS apps to backup your contacts

    by 
    TJ Luoma
    TJ Luoma
    02.19.2013

    There are scads of apps on the App Store which will offer to backup your contacts. I tried four: a free app, a $1 app, a $2 app, and a $3 app (all prices listed are USD). One was great, two were pretty good, and one was downright atrocious. (Note: all of the apps I reviewed are "universal" – that is, designed for both iPad or iPhone/iPod touch. All are optimized for the iPhone 5, with one exception which I have noted below.) Easy Backup ($0) The trouble with finding a free app to backup your contacts is finding a free app which is really free, as opposed to several which are limited versions of non-free apps. Eventually I found Easy Backup which is actually free and does not seem to have any limitations. When it first launches, it asks to connect to your Facebook account "to get better profile information." (Uh huh. You can see where this is going, right?) Sure enough, when I connected to my Facebook account, there was a "Who can see posts from this app on Facebook?" selector. Hrm, apparently in order to access my Facebook contacts, they häve to post to my Facebook account. I set the selector to "Only Me." Then Facebook told me "Easy Backup is requesting optional permissions" to post on my behalf. Under the "Why is Easy Backup asking for these permissions?" it says "Backup all contacts from Facebook." Well that's just a bald-faced lie, is what that is. I selected "Allow None." (Aside: I have to admit that I'm confused by this 'business model' – you make a free app that you then want to let me post to my Facebook account. Why? So more people can find out about your free app? Also featured prominently throughout the app in the top-left corner is something I presume to be a "Like this app on Facebook" icon of a thumbs up. I tapped it once to see what it would do, and it appeared to try to automatically post a message to my Facebook account, but timed out, presumably because I had not granted it that permission earlier. To be fair, maybe it would have given me the option to edit the message before posting it. To be honest, I doubt it.) Despite the name, I found using this app to be a little confusing. At first I found various 'sharing' options in the app, but they all seemed to be related to sharing the app not (for example) letting me email myself a copy of them. Eventually I realized that my going to the 'Contacts' tab and choosing 'All Contacts' and then tapping the "Check Mark" icon on the next screen then choosing the "Forward Arrow" it give me five options: Copy, Move, Share, New Group, Cancel. Selecting "Share" brought up a new email message with a vCard attached. (Side note to new developers: if you have five options, don't label four of them with verbs and one of them with a noun. For example, in the above list of options, "Create Group" would have been a better choice than "New Group." Also, if pressing the button will result in something being emailed, label it "Email" not "Share." It will make things easier on your users.) The vCard which was created by Easy Backup lacked the '.vcf' extension, so it was not recognized as a vCard file until I added it. Yet another little detail. Summary: In the end, Easy Backup does work, and it's free. It even has a few extra features thrown in. But I didn't like it. Backup Contacts - Easy Backup ($1) Backup Contacts - Easy Backup was the first app I tried. (Yes, that's the real name of the app. The whole category is flooded with keyword loaded keyword search optimization keywords. Keyword.) For only $US1, it does all that you'd expect, and perhaps even a little more. Not only will it backup your local address book, but also your iCloud or Facebook address book, or "all of the above." Once you select the address book(s) it will show you which contacts are found, and offer to let you de-select some contacts (by default, all matching contacts are selected). Tap 'Backup' and it will ask you if you want to save the backup on the device, or export it via email. If you select email, a 'Contacts.vcf' file will be created and added to a new email message, ready for you to fill in the To: and Subject: lines of the email message. The only thing missing is the ability to backup directly to Dropbox, although that can be done by using SendToDropbox, a free service which allows you to email files and have them added to your Dropbox account. I also wish that it added the current date and time to the "Contacts.vcf" file. If I save that file from my email to my computer, I will have no reliable way of knowing when it was created. But those are both minor complaints to an otherwise excellent app. Summary: If you are looking for a straight-forward way to backup your contacts, Backup Contacts - Easy Backup is certainly worth a look. Contacts Backup Over Dropbox ($3, not iPhone 5 optimized) Contacts Backup Over Dropbox was the next app that I tried. Its $3 price tag ranks it as "expensive" in the realm of the App Store, but you'd be mistaken if you think that means that you are going to get a high quality app with a rich set of features. The app does backup to Dropbox, but probably not as you would expect. It creates a file at "/Dropbox/sunvy/abbackup/backup.ab" instead of the more standard "/Dropbox/Apps/{Name Of App}/" path that you might expect. But it gets much worse than that. The "backup.ab" file appears to be some sort of proprietary and/or encrypted format. You can use that file to restore your contacts from Dropbox to your iPhone by using this app, but if you were expecting that this app would export a copy of your contacts in the industry standard vCard format to Dropbox, you would be sorely disappointed. At least, I was. You might also note that there is an option to "Edit backup file" from the app, via a large and prominent button in the app. I was curious what that would do, so I tapped it, and was greeted by this: Um. What? Because this is a "family-friendly" website, I cannot accurately describe my disdain for this. In-App Purchases should never, ever, ever masquerade as basic features. But wait, it gets worse. The "Service Code Generator" does not actually allow you to edit your contacts, at least, not on the iPhone. Instead, that code allows you to log in to their website...which appears to be written in Japanese. Investigating further, I came across another app by this same company: Contacts Editor. Buried at the bottom of the app description are notes which tell you that you have 5 minutes to login to their website after uploading your data, or your data will be deleted from their servers. It also says: "When editing with support site (http://www.abeditor.com), if within 2 hours without any operation, all data will be deleted." I'm not sure if that means "two hours idle" or "two hours and you're still not done" and I'm certainly not about to spend $2 to check. Oh, and after your data is deleted from their servers, that "service code" will no longer work. So if you didn't realize that the 'Edit backup file' meant that you were going to spend $2 to generate a code to let you log in to a website written in Japanese within 5 minutes and finish editing within 2 hours, well, sorry! Summary: I would avoid Contacts Backup Over Dropbox as if it were a bowl of pus which had been sitting out in the summer sun. My Contacts Backup Pro ($2) I have saved the best for last: My Contacts Backup Pro. The app is feature-rich and very simple to use, with the exception of the Dropbox uploading, which works very well but is a little confusing at first. Launch the app (which is abbreviated "MCBackup" on your iOS device) and it will present you will with a screen showing you how many contacts it found, and a prominent 'Backup' button. Tap the button, it will show you its progress, and then offer to email the resulting file. Boom, done. If it stopped right here, this would have been my favorite app because it works quickly and easily. But there is actually a lot more hiding just underneath the surface. On the launch screen are also two smaller buttons for settings and help. vCard (VCF) or CSV Tap the familiar 'Gear' icon to open settings and you will find an option to set the 'Type' of export: either vCard or 'CSV (Excel)' format. CSV is a nice option for those who need it, or who want to use their import their contacts into another app that does not support VCF. Multiple VCF: create separate vCards for each contact. In the settings, under 'Configure' you can choose 'Multiple VCF' which will create a separate vCard for each of your contacts and then create a .zip file of all of them. However I recommend that you do not use that option unless you have a specific need for it. Multiple VCF files are not stored on the device, nor can they be uploaded to Dropbox through the app. When saving to Multiple VCF, your only option will be to email the resulting zip file. That said, I can think of times when it would be useful to have your contacts in separate vCards, so I'm glad to have this option. Direct upload to Dropbox. My favorite feature is direct support for saving to Dropbox. The process is a bit confusing, probably because this feature was recently added to the app, instead of being part of the original design. The key is understanding how the app works: when you create a backup, it will prompt you to email it, but it also saves a copy of the backup within the app itself. You can find this by going to the settings and pressing the "In App vCard Restore" option. There you will find all of your previous backups. You can delete them using the 'Edit' button, or tap on them and bring up a prompt to choose from 4 options: Email, Dropbox, Restore, Cancel. (Again I'll note that "Dropbox" isn't a verb. "Upload to Dropbox" would have been a more accurate label, although it might not have fit in the available space.) If you choose "Dropbox" it will be stored to "/Dropbox/Apps/MCBackup/" with unique filenames such as "MyContacts–2013–02–17–172220–1961.vcf" which makes it easy to tell when a backup was created: the '172220' refers to the hour/minute/second when the file was created, using the 24-hour clock. So if you want to upload to Dropbox but not via email, simply press the Backup button when you enter the app, then tap the Settings gear icon. In settings, choose "In App vCard Restore" and select the backup you want to upload. Tap it, choose "Dropbox" and voilà. Ok, I'll admit that it's a little more convoluted than necessary, but it works. If you want a simple "save to Dropbox" feature, I suggest signing up for SendToDropbox. Local Reminders: One feature that I really liked with MCBackup is that it can use local reminders to remind you to backup your contacts. Reminders can be set for every week or every month. Wi-Fi Access: Another unexpected bonus feature is the ability to download your vCard file over Wi-Fi. Because some email providers limit the size of outgoing email messages, a large contact database might not be able to be sent via email. In that case you can enable a web server from within MCBackup which will allow you to download your vCard backup (nice!), or upload a vCard backup to your iOS device (cool!), or edit contacts on your iPhone (what?). Yup, you read that right, you can actually edit your iOS contacts through your web browser on your Mac or PC. In fact, you can even create a new contact. Summary: If this had been the first app I had tested, I would have stopped looking. It's a steal for $2 and does everything I wanted, and then some. It generates unique file names, uploads to Dropbox in the preferred location, and allows me to email the backup if I prefer. Conclusion If you write an app which works well, it is easier to overlook minor problems. Now, if you'll excuse me, I have 3 apps to delete off my iPhone.