The Programming Connection

I have been working in the area of audio/video production for the last nine years, but in the past my focus was on IT and programming. Over the past year or so I have been feeling the itch to do some development again and it is a great distraction from my day to day production work.

I have developed in many different languages and environments.C/C++, Visual Basic, C#/.Net, RPG, Perl, Python, PHP, Objective C, Javascript, and Ruby just to name a few. Recently I have had some ideas for a few new projects, some just to scratch an itch and others to solve work needs. I could just jump into the tools that I have used in the past. For example if I was going to work on a web project I would lean torwards Rails, or if I needed to do a small utility app Ruby or Python might get the call. These are the tools that were productive for me in the past.

Being that some time has passed and I’m really not under any deadlines, I thought it would be fun to check out new languages/frameworks. I have always loved developing my skills and maybe some of it is just to see what all the fuss is about. So I have looked at many new to me languages and frameworks, such as Go, Scala, Erlang, Angular, Rust, Swift, and Ember. All of them have some intereseting ideas and yes I know they all cover many different development needs, but I really haven’t connected with any of them in the way that I did with frameworks like Rails.

It is strange to say that you “connect” with a programming language, but you do. I guess it is like how I like to play Fender Jazz basses, but can’t seem to get comforable with a Fender P bass. Maybe a little closer to this topic Vim vs Emacs, but I don’t want to start a editor flame war. That connection seems to lead to you wanting to dig deaper and continue to build your skill.

Recently I have come across a few new framworks and languages that I have
started to “connect” with. I thought that I might do a few posts on them: and try to
explain what has caught my attention. The two that I’m going to start with are
Meteor.js and Elixir/Phoenix.

Update to the Move Mail Applescript

Today I made an update to my move script that allows you to select more than one message and move them all to the “All Mail” folder. You can refer to my Things Mail Script post if you would like to setup a hot key for the script. Here is the code:


tell application "Mail"
set theSelectedMessages to selection
repeat with selected_message in theSelectedMessages
set currentMailbox to the mailbox of the selected_message
set currentAccount to the account of the currentMailbox
set filedMailbox to "All Mail"
move selected_message to mailbox filedMailbox of currentAccount
end repeat
end tell

Error in Things Todo Script

In my previous post I had in small error in the script that created the todos in Things from a mail message. Here is the updated script:


tell application "Mail"
set cr to ASCII character 13 -->You can probably use the Unicode Equivalent but I didn't know it and this worked right away.
set LF to ASCII character 10 --> Same as here
set carriage_return to (cr & LF as Unicode text)
set theSelectedMessages to selection
set the selected_message to item 1 of the theSelectedMessages
set message_id to the message id of the selected_message
set message_url to "message:%3C" & message_id & "%3E"
set TheSubject to the subject of the selected_message
set theBody to "[url=" & message_url & "]From: " & the sender of the selected_message & " - Subject: " & TheSubject & "[/url]"
tell application "Things"
show quick entry panel with properties {name:TheSubject, notes:theBody}
end tell
set currentMailbox to the mailbox of the selected_message
set currentAccount to the account of the currentMailbox
set filedMailbox to "All Mail"
move selected_message to mailbox filedMailbox of currentAccount
end tell

Things Mail Script

ThingsRecently I have been trying to be more focused on the stuff that I need to get done. Just like everyone, I have email, phone calls and such that lead to things that I have to get done. I seemed to be doing ok with most of them, but emails were getting lost in the sea of stuff that I received every day. I read this post from Michael Hyatt and thought that I would give inbox zero a try.

So to get to inbox zero I had to employ some tools to help make this happen. The rule is that if you can deal with the email within two minutes, just get it done. If not then it becomes a task. OS X doesn’t really have any good tools to handle tasks and nothing at all that would sync with the iPhone. I don’t want to go into the details of of my choice, but I ended up with Things on the desktop and iPhone.

I’m a distracted person and for me to keep up with a system it has to be easy. I quickly get frustrated by software not being integrated so I go back to my same old ways. If this was going to be successful I would need to implement some apple scripts. Two keystrokes is what I needed. If I had handled the email I need a command to move the message to my “All Mail” folder and if not another command to create the task. Things has extensive Apple scripting support so I was on my way. I found some sample code in the Things Wiki and modified it to suit my needs. I will put the code for the scripts at the bottom of this post.

Come to find out the scripting was the easiest part of this project. It was harder to find a way to run the script from a keystroke. During my research I keep coming up with MailActOn which I downloaded and it did the trick, but I just couldn’t bring myself to purchase it. The only feature I needed was the keystroke mapping and thought there had to be an open source solution to my problem. After digging deeper into Google, I found out that the swiss army knife of Mac software, Quicksilver, could solve my problem. I’m not going into the detail of how to set it up in this post, but with a little research I was up and running.

I have been working with this solution for about a month and so far I have really liked it. Of course the scripts only work on my laptop and not on the iPhone, but with copy and paste in iPhone 3.0 I have survived. I hope that the Things people add a way to create a to do from a mail message on the iPhone.

Move Message To “All Mail” Folder Script:
At some point I’m going to update this script to move multiple selected messages, but right now it only moves one.

tell application "Mail"
set theSelectedMessages to selection
set the selected_message to item 1 of the theSelectedMessages
set currentMailbox to the mailbox of the selected_message
set currentAccount to the account of the currentMailbox
set filedMailbox to "All Mail"
move selected_message to mailbox filedMailbox of currentAccount
end tell

Create A To Do And Move The Message To “All Mail” Folder Script:
tell application "Mail"
set cr to ASCII character 13 -->You can probably use the Unicode Equivalent but I didn't know it and this worked right away.
set LF to ASCII character 10 --> Same as here
set carriage_return to (cr & LF as Unicode text)
set theSelectedMessages to selection
set the selected_message to item 1 of the theSelectedMessages
set message_id to the message id of the selected_message
set message_url to "message:%3C" & message_id & "%3E"
set TheSubject to the subject of the selected_message
set theBody to "[url=" & message_url & "]From: " & the sender of the selected_message & " - Subject: " & TheSubject & "[/url]"
tell application "Things"
show quick entry panel with properties {name:TheSubject, notes:theBody}
end tell
set currentMailbox to the mailbox of the selected_message
set currentAccount to the account of the currentMailbox
set filedMailbox to "All Mail"
move selected_message to mailbox filedMailbox of currentAccount
end tell

* Updated after an error was found