Iosicons

The other day a colleague and I were trying to remember how to get the icon art for iOS apps to help write notes. We though we remembered a way to get them out from examining the package. Later I was reading the ADE list, where there was a bit of bemoaning that you can no longer copy the art from iTunes. Someone mentioned that the art was now is a file iTunesArtwork inside the .ipa files in the iTunes folder, the .ipa file being zip files.

Icon Extraction Manual

This means you can get the art work by, changing the extension on an ios app file to .zip, expanding the archive, adding a .png extension to the iTunesArtwork file. You end up with the artwork png file.

Automating

This seems like a fairly long road for a short cut. A wee bit of though lead me to try a few shell scripts. Basically you can use the unzip command to extract the iTunesArtwork file with a png extension and you get a png file of the artwork.

To make this a little easier I wrapped up the shell script in an AppleScript. Drag a bunch of .ipa files onto the droplet and it will create a folder on your desktop and extract the art work as png files. Double click the droplet and it will prompt you for a file and do the same. The files are named the same as the .ipa files except I replace all non alphanumerical characters with an underscore. I’ve put the script in my dropbox in case anyone would find it useful, and uploaded the text so you can View the Script.

BTW: Rounded Corners

So the artwork extracted does not have the rounded corners:

I Movie 140.ipa

You can change the way that looks on the web with a bit of css:
I Movie 140.ipa

style="-moz-border-radius: 20%;-webkit-border-radius: 20%;border-radius: 20%;"

This might help other folk documenting iOS stuff. I’ve now got a folder of >600 icons ready to go.

I like listening to podcasts. I usually listen to them while driving. I use instacast to play podcasts on my iPhone. Instacast allows you to subscribe to podcast feeds, it downloads episodes while you are on WiFi for playback later. I subscribe to a few educational podcast, some mac ones, the Scottish Poetry Library and Machine of Death. I change these about occasionally.

Sometimes though I want to listen to individual podcasts episodes without subscribing to the whole feed. Recently I’ve been doing this by downloading the podcast media to dropbox, making the files favourites on my phone while on WiFi(which downloads them onto the phone) and listening later. To speed this up a bit and to allow me to do this from my phone or an ipad I have a folder in my dropbox with an AppleScript Folder Action attached to the folder. I add a text file with the url to a media file to this folder (typically with droptext) and it is automatically downloaded to my desktop in a dropbox folder. I then can favourite etc as normal.

huffduffer

This still leaves a bit to be desired, I need to remember to favourite the files while on Wifi so that they are ready to play in the car.

Huffduffer looks like it is made to solve this problem. It is a service that allows you to create a podcast feed from episodes of different podcasts or just mp3 files found on the web. You use a bookmarklet which finds any mp3 files on the current webpage and adds them to your podcast.

Earlier this week I saw a link to huffduffer and created an account: Johnjohnston on Huffduffer. The only problem is I created the account on my phone and left it a few days to install the bookmarklet on my desktop. By then I had forgotten the password!

Attempts to reset my password failed, and perhaps because it is the weekend, requests to get this fixed have not been answered yet. It looks like a few other folk have the problem

Not Huffduffer

So today I decided to try a wee bit of DIY with AppleScript. I’ve already got a few dropbox folders set up with Folder actions to do some automation 1 so had a rough idea of how to go about this.

What I want to do is, on iOS copy the url to a webpage, switch to droptext, make a new text file containing the url and save it into the folder. The Folder Action script then parses the webpage for mp3 and m4a files and adds them to a RSS file. I’ve describe to this file in instacast so don’t need to think about it much other than opening instacast when on wifi and letting it download episodes.

Google helped with a couple of tricky parts, getting the address of mp3 files out of the web page:
how to extract an mp3’s url from m3u…: Apple Support Communities and getting the correct style of date so that the RSS feed validates:
RFC 822 Dates with AppleScript | Joe Maller.

The script basically adds the mp3 urls to a text file along with the date they are added. This text file is parsed to produce an RSS feed. The script certainly lacks any polish, but it works. Here is the RSS feed in my dropbox. And here is what it looks like in
Instacast:

instacast not huduffer

As you can see, the feed is quite minimal, the names come from the mp3 file name. The script (I’ve uploaded it here), needs lots of work. I briefly tried to get the titles from the tile of the webpage, but ran into some odd characters which threw things off. I’ve also hard coded file paths into the script and it would be better not too. Most of the script, dealing with detecting the files added is a lift form the examples that Apple ship. My bit just process the url. I’ve also adapt this to run from a mac grabbing the front url from Safari, this script is in my FastScripts folder s oI can run it with a keyboard shortcut.

Not sure if anyone is interested in this stuff here, but it fascinates me and posting it is one way of keeping track.

1. I’ve blogged a couple of other applescript/dropbox ideas OCR via dropbox with Tesseract and
Testing a new system

This is going to be another slightly geeky post. The previous one, Testing a new system, was about a way to blog using dropbox and AppleScript folder actions had me thinking about other things that could be done using this sort of system. The way I am doing this relays on having dropbox and a mac that is on when you want it. If you don’t have a mac you might like Wappwolf which is a web service that can do a lot of things with files in your dropbox automatically.

So I already have a system for blogging by dropping files into a folder on my dropbox and was looking around for another idea to play with. There seems to be a few OCR apps for iPhones but I had noticed that Tesseract was available on Google Code and googled around to see how it could be installed and run on a mac. One I found was TesseractOCR Mac a Cocoa Front end to the Tesseract OCR program. I downloaded this and gave it a try. It worked well on my desktop. I then struck gold: Installing and using Tesseract 2.04 on Mac OS X 10.6.6 with Homebrew | Ramble On. This post explains clearly how to install Tesseract on a mac so that it can be used on the command line. It is also a good intro to homebrew.

Homebrew

Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with OS X.

For someone who has struggled with this sort of thing before, homebrew is pretty straightforward. Installing homebrew is just a case of copying a line of code from the installation page, pasting it into the terminal and pressing return.

imagemagick

Following the instructions from Ramble On I just typed brew install imagemagick in the terminal and hit return. Lots of scary text scrolls by:

Install Imagemagick

installing Tesseract

Once imagemagick was installed I repeated the process for Tesseract.

Testing Tesseract

As I was wanting to figure out how to use my phoe for OCR I took a photo of a bit of newspaper, I used Camera+, the clarity filter, cropped and made the image Black and White:

fr_160
Click the image to see fullsized on flickr

I used Wifi Photo Transfer to grab the photo from my camera and put it on the desktop.

The OCR process is in two steps using the terminal and the newly installed applications:

  1. Convert to 200dpi tiff:
    cd Desktop
    convert -density 200 -units PixelsPerInch -type Grayscale +compress fr_160.jpg fr_160.tif
  2. Preform OCR on the tif
    tesseract fr_160.tif fr_160 -1 eng

I now have two extra files on my desktop, fr_160.tif and fr_160.txt, the txt file contains the OCR text:

(_;oogle is facing fresh criticism after
admitting that it has not deleted all of the
private data, including emails and pass-
words, it secretly collected from internet
users around the UK as it gathered data for
its Street View maps.
The search firm was ordered in Decem-
ber 2010 to delete the private information
hoovered up by its Street View cars from
open Wi-Fi networks. r
But yesterday Google told the Infor-
mation Commissioner’s Office “human
error” had prevented it from erasing the
data, which could include the millions of
emails and passwords .
Google admitted in May 2010 its Street
View cars had “mistakenly” collected pri-

Which is pretty good.

OCR for dropbox

I now can see that tesseract works well and needed to make it work on images added to a particular dropbox folder.

There are a few folder action scripts that come with a mac, there are in /Library/Scripts/Folder Action Scripts/ several of these deal with images files ad contain routines for handling the dropping of files. These ‘standard’ routines move added files of the correct file type to a subfolder and then pass them on to a sub-routine that deals with the files. I could just duplicated one of these and edit the process_item sub routine. Basically I just scripted the process tested above. I’ve uploaded the script ocr folder action as html, incase anyone will find it useful or fun.

To use the script you put it in the Folder Action Scripts (copy the text of the html file paste it in the appleScript script editor.). Add a folder to dropbox and attached the script to that (right click on the folder and choose Folder Actions Setup…).

Most of my bit of the script just uses do shell script to run the scripts above, the only gotcha was that although I can use convert in the terminal, in a script I have to use the full path to the script:
set ocrscript to

"/usr/local/Cellar/tesseract/3.01/bin/tesseract '" & tif_file & "' '" & tif_file & "' -1 eng"

do shell script ocrscript

This is to do with the way homebrew installs applications and the fact AppleScript doesn’t access commands from /usr/local/….

My script is fairly crude, especially about file endings, if I add :Photo 28-07-2012 12 35 55.jpg to the dropbox folder, it is moved into the processed files folder and Photo 28-07-2012 12 35 55.jpg.tif and Photo 28-07-2012 12 35 55.jpg.tif.txt are created. Not elegant.

The whole process from taking a photo to opening the txt file in dropbox only takes a couple of minutes when using 3G. The system will not deal with columns or more than a single block of text but it does that fairly well. Mostly it was fun to figure out how to do.

This is a quick test of a alternative way to post to my blog.

I tend to blog from my MacBook. I’ve been testing various iOS systems for blogging on the go. I’ve also read a lot about blogging systems that use Dropbox files to produce a post. In the past I’ve experimented with posting to a blog with AppleScript and thought I could knit something simple together. This consists of several parts:

  • a folder on my Dropbox called BlogThis
  • a Folder Action AppleScript on this folder on my always on work mac.
  • The MetaweblogAPI enabled on this blog and supported by AppleScript.

When a file arrives on Dropbox and syncs to my work mac the Folder Action AppleScript posts it to my blog. It uses the first line of the file as a title. If the file is HTML it posts that, if it is markdown it converts it to HTML first.

NOCs

This post was created with [NOCs](http://www.wisd.com/) on my iPhone. Once I’ve finished a local, iPhone, draft NOCs allows me to move it to any Dropbox folder.

Extending

About 6 years show I was testing posting images via the MetaWeblogApi and it should be easy enough to use a Dropbox folder for that, or to script an FTP upload. This would mean I could add an image from my phone to my Dropbox. This would upload to this sit and could be encorporated into a post. Until the I could use Flickr.

I am not sure if anyone is very interested in this sort of thing. If they are I’ll be able to post more details from a desktop. This is about as long a post as I’d like to write on a phone.

Not quite perfect yet, I had to edit the img tag here. More fun to be had.

Update: it was like magic watching my home mac when posting this from my phone, growl told me that a file had been addd to my dropbox and almost immediately that a file had ben moved (by the work mac).

A couple of weks ago I had posted More Posterous Worries I had tweeted to @posterous and mailed the help to no avail. Then a week ago I tweeted to Sachin Agarwal @agarwal and got this response :

Agarwal Conversation

Sachin was a founder and CEO of @posterous. I had amazing support from him at the start of EDUtalk but was surprised he had time for a few emails. Not only that, the missing player for mp3 urls that was troubling us was fixed. (I still need to update all those post but new ones are fine).

API 2

Happy with this, today I though I’d update the script that posts audioBoo to posterous. Unfortunately there seems to be a problem with curl and the current version of php running here. Rather than try to work around that I’ve changed track and created an AppleScript that:

  1. Downloads the rss feed from http://audioboo.fm/tag/edutalk.rss
  2. Loops through it checking for new boos
  3. Posts these to EDUtalk, marking them private.
  4. Keeps a list of published boos so that I’ll later be able to download for the Radio EDUtalk AutoDJ archive.

I plan to have the script running all the time and checking each hour for new boos. It seems to work fine, not that it does anything clever like error checking, but given a bit of time I can fix that.

Consolerium games guru Charile Love has come up with a pile of interesting stuff linked to his work and glow. A while back he published a guide to Creating Your Custom Glow Theme which has been very useful for me. Recently he has produce a url shortner for glow Glo.li with a web interface, glow webpart: Making Glow Better with glo.li and wordpress pluging and the Internet Explorer and Firefox Toolbar Alphas (with integrated Glow Search) now in beta all very much worth checking out if you use glow.

URL shortners are not necessarly a good thing I don’t think they have much place on blog posts or web pages. There a a couple of places they are handy, twitter with its 140 char limitation and printed material. Newspapers often use them and I’ve found thenm useful for printend notes. I also imagine they are worth using with children in glow. A typical glow url, say:

https://portal.glowscotland.org.uk/establishments/nationalsite/International%20Children’s%20Games/ICG%20Activities/Lists/Pages/D4.aspx

is not an easy one to put on the board for kids to type;-) http://glo.li/9hzYzG is a lot simpler.

Charlie’s Toolbar has glo.li built in making it really easy to grab a shortened url from any page in fireFox and Internet Explorer. Unfortunatly for me I am pretty welded to the Safari browser so can’t install the toolbar (I guess someone could make an extension for glo.li) but I did already use applescript with tinyurl for shortening links. I am not sure how many other glow users use applescript too but here is how it works:

Gloli

I commented on Charlie’s blog post asking about acces to gloli via the command line and he kindly explained it to me. I wrapped this up into an appleScript which I assign a keyboard shortcut via FastScripts (I’ve blogged about FastScripts before). Now I just press command-alt-control-g to get the url for the current page displated in Safari onto my clipboard ready to paste. I’ve posted the script and how to do this here: glo.li url shortner applescript just incase anyone is interested. The script does include the easiest/lasziest way to strip html I’ve manged to figure out.

If you are a glow user I suggest that you check out Charlie’s blog straight away.

This is a ‘mac’ post not really aimed at education except in so far as a lot of educationalists seem to be using Dropbox. Dropbox is of course a cloud storage & synchronisation application. Basically dropbox sets up a dropbox folder on your computer and syncs it with one online. You can set up dropbox on several computers and they are all kept in sync. This is extremely useful if you use different computers in different locations. I have my home mac, desktop at work, work laptop, iPhone and the iPad I am typing this part of the post on, all with the same files seamlessly synced. What makes drop box different is that on a computer it’s just another folder you do not need to do anything special to keep it in sync.

If you want to get a dropbox account & give me more storage on dropbox Get Dropbox.

I’ve been using drop box as a working directory for sometime now, as week as a way to view files on my phone and the iPad as well as being able to work on files at home and at work without worrying about taking them back and forward. Recently I’ve started using in a couple of slightly more sophisticated ways.

FastScripts

Dropbox Fastscripts

One of my favourite utilities is FastScripts, this is a menubar application that allows you quickly run AppleScripts (it also does shell and other scripts) these can be given keyboard shortcuts and are sorted into application specific lists.

Fox example I often use tiny url to shorten urls so have a script that takes the current URL from safari and puts a URL onto the clipboard. This script has a shortcut of Apple-ALT-control-U.

FastScripts list scripts stored in the Scripts folder in either the mac’s or user’s Library. Inside that folder it organises the different applications scripts inside an Application folder folders:

Fastscript libs

In this case you can see that the Applications folder is an alias. What I did was to move the applications folder to my dropbox folder, I then dragged it back, but with the command and alt keys held down. This left the folder in my dropbox but creates an alias in the Scripts folder, FastScripts sees the files in my dropbox. I can then create the alias in my other macs Scripts folder replaces the one already there. Now when I make a new script on any of the macs it is shared with the other ones and available through FastScripts.

TextMate, Droptext

I find that I use plain text files more and more, I write blogs posts, todo list, web pages and first drafts in TextMate. TextMate has some amazing features that are way above my head but I find it a must have application. Some of the files I use often I keep in a folder _notes in dropbox. Also in dropbox is a textMate project. A textMate project is just a easy way to see all of the files inside the _notes folder and its subfolder (power users can do a lot more with projects).

Textmate Project

What is great is I can access and edit these files from any of the computers I use and view them through the dropbox app on an iPhone or iPad. I can also use a 59p app droptext to edit these files on the iPad.

I have never really been one for productivity systems, I’ve always like 43 Folders but mainly as a distraction. However, I do like automating repetitive tasks and things that work automagically Dropbox, FastScripts & TextMate fit that bill.

Delicious Applescript Blog

A while back I stopped splicing my daily delicious links into my RSS feed via FeedBurner, a couple of folk told me they did not find it very helpful. I’ve been wondering if a weekly list would be of interest?

To make it a little simpler I made a AppleScript that downloads the RSS from my delicious links, creates some html and posts it here using the MetWeblogAPI. It is not an elegant bit of code but I’ve put it up on my wiki: week in delicious in case anyone wold find it useful. It would be easy to tweak for a different number of days or just to pickup a particular tag.

I am not sure if I am going to use it, if I do I’ll probably only post a particular tag but I could not resist the temptation for a little auto blogging.

The script could be changed for other autoblogging tasks too. I’ve put it with few other Apple Scripts that I find occasionally useful on the Wiki.

Commentcompare

There has been a fair bit of comment recently on how twitter is taking over from blogging and commenting on blogs. My own blog has never had a high number of comments, but the number has dropped. Recently I’ve noticed that posts are tweeted and retweeted, but not commented on.

Every so often I try to up my own commenting, without posting ‘me too’ or suchlike and to keep track of the comments I make. In the past I’ve used coComment, but found it did not always work for me and sometimes reports posts have new comments when they do not. I’ve also just bookmarked the posts I comment on in my browser, but that gets a bit messy and is not portable.

So I’ve come up with the following solution, it uses AppleScript so is a mac only method, but I am sure someone could do, or has done the same sort of thing with greasemonkey for firefox.

It consists of two simple scripts, the first based on one called @review (I think) that I downloaded a few years ago and can’t find a reference to credit. This script takes the current url in Safari and posts it to delicious tagging it with @comment and making it private. The private part is to stop the links showing up in my RSS feed with my other links. The script: @comment.scpt.html is pretty simple, and uses the delicious API.

The second script just retrieves the last 10 links from my delicious tagged @comment, opens a new window in Safari and tabs for each of the links. Again a simple enough script: opencomments.scpt.html. It relies on the private RSS feed supplied by delicious, you can copy yours from the delicious page listing links:

Deliciousrsslinks

Fastscript Grab

I run both of these scripts from FastScripts. FastScripts is a replacement for the mac’s Script menu. It lists scripts, current application at the top, and allows you to add keyboard shortcuts. So my @comment script is invoked with control-alt-command-c which is easy to hit. I just post a comment and hit the key combination, growl notification is built into the script and lets me know if the submission to delicious was successful.

The scripts can be copied and pasted into the Script Editor if you want to use them, all you need to do is add your username and password to both and get the private delicious RSS feed url.

I would be interested in finding other ways of keeping track of conversations, so please let me know if you have a good way.

twitter icon

I’ve messed about with the twitter API before in a ham fisted sort of way (say ObliqueTweet, twitter presenter or Tweets @iowconference08) by basically borrowing various snippets of code, this is another such effort.

I notice an interesting post on Tom Smith’s theOTHERblog: Twitter, Growl, Boosh! In AppleScript!!. I’ve borrowed code from Tom before and was interested in this latest script. The script basically used growl to show tweets for a search or hashtag to be used when watch tv with a group spread over different locations. Tom’s script used the Vienna rss reader as a intermediary for handling the RSS. I recently switched from Vienna to NetNewsWire and didn’t have Vienna installed so took a slightly different approach.

I remembered that someone had mentioned that AppleScript handles xml now (via the ‘System Events’ application) and this seemed like an opportunity to mess about with that and growl.

Growltweets

I’ve cobbled together an applescript that runs and every minute, downloads the latest from a twitter search and growls them. The script is pretty rough at the moment (and in all likelihood will stay that way) but I’ve posted it for view and will upload the actual script once it looks a wee bit better.

The script might be of use in the same way Tom’s is, to display tweets over a shared experience. Or perhaps so make sure I don’t miss an @johnjohnston tweet but don’t get caught up in twitter while I am ‘working’ but really it served to give me a bit more practice with the twitter search API and in starting to learn to parse xml with AppleScript. As twitter become bigger by the second and its API continues to grow I hope one day I’ll do something useful.

twitter image Mirjami Manninen from smashingmagazine