Syncing play positions between Spotify for Mac and iOS

Thanks to Sean Heisler for giving me the motivation to play around with this.

Setting the scene

You listen to music through Spotify. You listen at work, on your Mac, and when you leave for lunch or at the end of the day, you connect your iPhone to your car stereo or EarPods to listen to Spotify on the commute home.

The Problem

You were listening to a specific song, on an album or playlist, and you want to continue listening from where you left off. Sean had asked me if there was a simple way to do this and after we both explored the app and the forums we determined that there wasn’t something already out there.

The Solution

**In short**: I wrote some AppleScript that builds and sends a Spotify URL of the current track in Spotify for Mac to your iOS device. You can run this directly from the script or build a Service using Automator and tie it to a keyboard shortcut. Fork it on github here – []( "SpotifySync on github") – or copy and paste the AppleScript below in Script Editor on your Mac.

Setting it up

I’m going to focus on setting this up as a Service using Apple’s Automator app. There are many other ways to get this script to run but I like using the built in tools as everyone already has them.

Pre-flight Checklist

  1. As far as I know this only works on a Mac and iOS device (I have tested with an iMac running 10.10 and iPhone and iPad running 8.0.2).
  2. You need Spotify on both your Mac and iOS device (I’m a Premium subscriber but I don’t think that matters).
  3. You need Messages (Apple’s built in IM client) configured with iCloud on both devices (Mac and iOS).
  4. You need to have an existing conversation started with the phone number or iCloud email you are sending the message to.

Creating the Service

  1. On your Mac, open up Automator (in the system Applications folder) and choose New Document from the open dialog box (lower left corner).
  2. Choose Service from the menu that drops in.
  3. Select Run AppleScript from the action menu. You can search for it or choose it under Utilities from the Library (see videos below)

AppleScript in Automator

AppleScript in Automator with search

  1. Copy the AppleScript above and paste it in place of the (* Your script goes here *) text in your Automator window.
  2. In the text you just pasted into Automator, find the line that contains [Your Phone Number Here] and replace that text with your phone number or iCloud email address that is set up on your iOS device.
  3. Now open up Messages and compose and send a message to that same number/email.
  4. Switch back to Automator and click the Run button (highlighted in the image below). This should bring Spotify to the foreground and send an iMessage with a link in it (see pre-flight checklist if you get errors)

Automator Run Button

  1. If everything ran correctly you will have received the message on your iOS device with the link. Clicking that link will open Spotify on the device and start playing the track.
  2. Jump back over to Automator on your Mac and save the service (File>Save) and name it something memorable. Spotify Sync is an easy choice.

Bonus Step

For a quick and easy way to run the script lets to set up a keyboard shortcut for it. That way as you’re running out the door you can bang on your keyboard and send the song over to your iOS device.

  1. Open System Preferences, select Keyboard. From the menu tabs select Shortcuts and then choose Services from the left menu. Scroll to the bottom to find your newly created service, under General and select it.
  2. To the right of your selected Service you see a button that reads “add shortcut.” Click that button and then punch in the combination of keystrokes you wish to use to activate the Service. Choose something unique so you don’t get conficts. I have mine set to ⌃⌥⌘I

Keyboard shortcut for newly created Service

I encountered a few issues when adding the Service on other people’s Mac’s so if you have any problems feel free to get in touch and I’ll help anyway I can.

Excluding multi-day events when displaying upcoming events (The Events Calendar)

Background Notes

  • Using The Events Calendar plugin by Tribe for WP as a community calendar.
  • Need to show five upcoming events in a section on the home page.
  • Only want to show events that have a start date of today or in the future.


The function get_tribe_events would pull in events that encompassed today’s date but had started in the past. The client only wanted events that had a start date of today or in the future to be displayed to avoid a situation where five long spanning events stayed on the homepage as the next upcoming events.

Upcoming Events


The problem seemed to stem from the way The Events Calendar was handling reoccurring events (or events that spanned multiple days). It would apply a start date of today’s date if today was encompassed in the date range of the event. Therefore, in a foreach loop when you asked get_tribe_events to only show upcoming events or all events with a start day of at least today it would also include these multi-day events.

I tried a slew of conditional statements in the loop to try and ignore the events whose start date was in the past but I just couldn’t get it quite right, the loop still counted these false-positives and I was continually having to update the posts_per_page argument to prevent there from being too many or too few events. It wasn’t until I start printing a second instance of the start date of an event that I learned the loop was behaving normally but I targeting a fake start date.

From reading around it seems like each event (specifically those that were reoccurring or multi-day) were given two start dates in the database and get_tribe_events was pulling the “wrong” one for use in it’s decision on what was an upcoming event. If an event spanned multiple days it would receive today’s date as it’s start date so the loop would know to continue showing it even if the actual start date of the event was months in the past.


Once I knew that I needed to target a specific row in the database I switched across to a WP_Query to utilize the meta_query argument. I was then able to target the actual start date of the event with _EventStartDate and use compare to tell the query to only display events that occurred on or after today’s date.

Fix for upcoming events

Here’s the code I used to solve the problem:

Globo world clock app

This new app solves a reoccurring problem for me. I want to figure out a suitable time to call my Mum in Brisbane, Australia or my Dad in Bangalore, India.

In the past I try to remember how many hours ahead of Omaha each city is and then, literally, count on my fingers. When daylight savings kicks in here, I’m totally lost. My next stop would be the Clock app to check the local time and then count ahead until I hit a time that everyone is available.

I actually started a Treehouse course on iOS development in the hope that I could build this very app, or a dumbed down version of it.

Globo’s top feature, in my mind, is the “set actual time” screen that lets you pick a time, either locally or for another location, and then see what time it is across all locations you have saved. If it’s 10am in Brisbane, what time is it in Omaha?

If you communicate with anyone in different timezones then I recommend you grab this app for $0.99 and never mis-schedule a call or meeting again.

Source: Globo

The 10pm reminder

About 5 months ago I wrote of my woes with time tracking. I tried to find software that tracked my time for me and I specifically called out Rescue Time as a solution. It was not.

The next stop on my quest for better time tracking was a bit extreme. I decided to use a method, detailed by TJ Luma, where my Mac automatically took screenshots every 30 seconds. I could then sort through those screenshots to see what program, file, site etc I was in at any particular time. I ended up with a folder containing seven days worth of screenshots and no desire to look through them.

I solved all of my time tracking problems with a simple reminder. Every day at 10pm my phone buzzes one last time. It’s a reminder that asks “Do you have time to track from today?” For the first week I had things to add to my work log. It was annoying (even with the text expander snippets and Drafts). I started to track my time more accurately while I was doing the work just to avoid the 10pm chore. My reward for building a better habit was that I could go to sleep or read or just relax after 10pm rather than filling out a time sheet.

iPad 10pm Reminder

The reminder keeps my freelance work in check but I just took a position with a design agency and that means accounting for how I spend every minute of my working day. I use Day One as a work journal to handle this. Katie Floyd talked about using Day One on an MPU episode and I always thought it would be a great solution. The software provides a lot more context than a plain text file can with data like weather, photos, motion activity and location. I keep Day One open on my desktop at all times and I record anything I work on with a start and stop time. I’m able to quickly take that info and move it across into the company’s time tracking system.

Using Spaces with dual monitors in OS X Mavericks

Jump to the How to part

I bought a 13″ MacBook Pro in 2009 with the expectation that I would save again and buy a 27″ Cinema Display so I could actually get work done. While I still covet the larger screen I’ve been able to manage just fine with the smaller built in one. How can I get anything accomplished on a 1280×800 screen you ask?


Spaces is a feature of OS X (since Leopard) that enables you to create and switch between multiple desktops. I use three, although you can create up to 16, and I use the different desktops as dedicated places for different types of apps. Safari stays on desktop 1. Coda 2 and Dash are on desktop 2. Photoshop/Illustrator/Acorn are on Desktop 3. All other apps are called up and closed as I need them, no matter what space I’m on.

It’s not a perfect scenario but I’ve found that it works for me and I have established muscle memory for switching between desktops quickly and performing tasks on the active windows with keyboard shortcuts. It’s now just the way I work.

Adding a new dual screen set up

When I started working for Webster I got a different set up. A 24″ iMac and a 23″ Cinema Display as a second monitor. Sweet, I thought, no more switching between desktops I have tons of space now. Turns out, more screen real estate just means more open windows and a huge unorganized mess. Out of habit I would use my keyboard shortcuts while doing web work to try and switch between Safari and Coda and get frustrated when I had to ⌘+ Tab 10 times to get back to the app I wanted instead.

I had tried Spaces with multiple displays before Mavericks and I was annoyed that when you switched desktops both screens would switch as one. I actually said to one of my current co-workers how much I wished that Spaces could be display independent.

I went to Mission Control in the System Preferences anyway and my heart actually leapt when I saw this screen:

Dual Screen setting in Spaces

I could now use two desktops on the newer, crisper iMac screen (for code, browser testing, Photoshop/Acorn etc) and keep the 23″ Cinema Display reserved for DayOne (time tracking), Reminders (tasks), nvAlt (text files) and any window I need as reference for the work I’m doing on the main screen. I’m really happy with this set up and I’m starting to save again for that 27″ display to use at home.

In my experience the multiple display support in Mavericks is a big step forward.

The How To Part

With two or more displays connected go to your machine’s System Preferences and click on Mission Control in the top line of icons. On that screen, ensure that “Displays have separate Spaces” is checked.

Dual Screen setting in Spaces

You can now activate Mission Control by using the keyboard shortcut specified in the lower portion of that same Mission Control settings screen (seen above). Alternatively, you can enable mouse and track pad gestures to call up Mission Control. Just visit the Mouse and Trackpad areas under your System Preferences.

Once you access Mission Control, adding new Desktops is as simple as moving your mouse towards to top right corner of the screen and clicking on the +

Mission Control

Customizing Further

The way I typically switch between my Spaces is by using a keyboard shortcut that moves me to a desktop either left or right of the one I’m currently on.

To do this:

–> go to Keyboard in your System Preferences window.

–> click on Shortcuts in the top menu.

–> Select Mission Control from the list on the left and look for “Mission Control” with an expander arrow on the right.

–> Inside that list you’ll find “Move left a space” and “Move right a space.”

–> Set up your own preferred keyboard shortcut by selecting an action from the list on the right and then clicking on the existing shortcut (it will say “none” if there isn’t a shortcut already set up.)

–> Hold down your preferred key combo and you’re in business – mine are alt + → and alt + ←

This is the guy behind the guy behind the guy.

This is a great interview with many of the people involved in the making of Swingers. I love the retelling of how the final scene with Favreau, Vaughn and the baby came together.

I was 17 when I saw Swingers for the first time. I had no idea who these actors were but I knew I wanted to be as cool as Trent or Sue. I must have watched it close to the New Year because on Jan 31, 1999 I threw on a tight white singlet, bowling shirt, suit pants and yes an extra long wallet chain and raised a toast to the ladies.

I rode the train home. At 4am. Alone. So money.

Source: An oral history of Swingers

A push for in-house web teams

This post was written as a response to the Jan 9 post on boagworld: The recruitment crisis. During my procrastination to hit publish Paul has since written How to change your company to be digital first which addressed many of the sentiments I express here.

I see where Paul Boag is going with this post and admittedly I would love to find a company who is willing to change their structure and culture to better suit the typically hard to employ web professional that I am. Digital is essential, Boag says, “[w]hether you are selling kitchens or raising money for cancer research” but I think it’s the disbelief in that statement that is going to make retainment of talent so difficult during this mass agency exodus.

It’s not just web professionals who crave these working environments. All employees want more control, flexibility and trust from their employers. They all want a bright and colorful office with the latest technology, an espresso machine and a few hours a week reserved for paid training or self-directed learning.

If a company gears their culture towards a small group of employees then they will alienate the rest. This creates resentment between employees and your newly hired web workers will jump ship to find more accepting coworkers or just take you up on the offer to work from home rendering all previous investments wasted.

Upon reading Boag’s post I immediately thought of a recent Slate article about creativity being rejected when it seeks to change the status quo. I imagined many a middle manager squashing a creative and potentially successful idea because they felt threatened. Threatened by the employee(s) who had the idea but mostly threatened by someone’s ability to see a solution that they didn’t. This is part of the resistance to bringing digital in-house. Employees and managers alike are wondering: if digital is the answer, does that make me obsolete?

Perhaps an improved long term strategy would be to start educating your existing staff on the importance that the web and digital hold for the future of the company. Maybe you have a few weekend geeks in your ranks already who would be cheerleaders for bringing this work in-house and who may reveal themselves to be ready for recruitment first.

If you’re serious about investing in digital and pointing your business towards success in the digital space then think about what other areas of the company can benefit from a step towards that goal. Does your accounting department like the idea of a FreshBooks-type product? Allowing them to work from home on Fridays or when the kids are sick? Maybe new iPads for your sales people will get them excited about presenting reports and product demos to potential clients again? The whole company needs to see a benefit from the shift to digital for it to be welcomed and successful.

Recruiting and retaining web professionals is easy when everyone within the company sees the value in what we do. All the items that Boag listed allow you to recruit but it’s a company-wide belief that digital and the web is important, meaningful and should be supported that will keep employees happy and loyal. That and a foosball table of course.

Fix for the slow Open-Save dialog box in OS X Mavericks

Ever since upgrading to Mavericks, Finder would get hung up opening a folder through the Open/Save/Export dialog box. Everything was still responsive but all I got was a progress spinner when clicking on a folder, no files. After 5-10 seconds every thing catches up and all folders and files are again available. That 5-10 seconds was driving me crazy though.

According to OS X Daily it’s caused by the Finder attempting to mount network drives. They have a easy to follow step by step on how to fix the bug which worked perfectly for me. You will need to fire up the Terminal to get this one done though.

IRS provides ability to download past tax returns

I have often needed to show my past tax returns when proving my income. This is really handy for those of us who are self employed and don’t have access to pay stubs or employment verification.

Of course, I haven’t successfully been able to retrieve my past returns as I’m greeted by a Technical Difficulties error every time I log in.

Source: Download past tax returns

Are you employed, sir?

Today I was fired. Bummer.

It was a cool company to work for and I now have a much deeper understanding of how buildings and the systems within them are put together. I have increased my skill in software titles such as Revit, AutoCAD Architecture, Cyclone and Navisworks. I’m leaving with a handy and transferrable toolset.

Far more importantly though, I’m leaving with a clear understanding of where I need to position myself within companies in the future. I’m a generalist when it comes to my professional skills. I have consciously decided not to become an expert in any one area or on any one topic. I like to know a little about a lot. It keeps me from getting bored and I feel that given the right company or business venture, it will only enhance my most marketable skills: human interaction and management.

I realized, while working quietly in my cubicle, that I miss frequent and direct interaction with customers, vendors and management. I miss being influential to a company’s bottom line. I miss doing the things that bring me enjoyment.

I enjoy writing. I enjoy talking (too much sometimes). I enjoy teaching, helping and convincing. I especially enjoy being part of the problem-solving process. I can build and fix websites, computers, skyscrapers (virtual ones anyway). I can sell, support and manage people and products. I experience an actual thrill when people ask for my help or advice, even if it’s just a relative with broken wifi.

I crave to learn.

Today, I decided what my career is going to be when I grow up.