Scott Hanselman

Hey Siri, what's my blood sugar? Learning to Code with Apple's iPhone Shortcuts

February 27, '19 Comments [5] Posted in Apple
Sponsored By

BA library of dozens of shortcuts on iOSear with me here. Apple Shortcuts (free on the App Store) is extraordinary and you shouldn't sleep on it. In fact, you should use it and explore it as it's amazing. I would go even further and say it could be a great place to learn to code!

Apple Shortcuts on iPhone is a lot like Microsoft Flow, except for your phone. Shortcuts let you string together Actions (ahem, functions) into multi-step tasks (ahem, functions that call functions). There's a rich and growing gallery of shortcuts that you can copy into your local (to your phone) library. You can then name them and invoke your Shortcuts with Siri.

Here's a few links to Shortcuts that (assuming you are reading this from your iPhone) you can add to your library with a click!

Once you have a shortcut you can invoke it as an item/icon on your springboard/home screen, you can have Siri run it with your voice, or invoke it via a "share sheet" that is available in all apps.

It would be reasonable to think this was a simple macro system with a few basic building blocks, but I don't think Apple's team gets enough credit. This is a complete development environment on your phone.

For example, here's a incredibly intricate and powerful Shortcut if one is pulled over by the police.

It pauses any music that may be playing, turns down your brightness and volume, turns on Do Not Disturb, and sends a message to the contact of your choosing letting them know you’re being pulled over and what your current location is. It then opens your front camera and starts a video recording so you have a video record of being pulled over.

Once you stop the recording it sends a copy of the video to a contact you specify, puts volume and brightness back to where they were, turns off Do Not Disturb, and gives you the option to send to iCloud Drive or Dropbox!

You could then record a Siri shortcut and just say "Hey Siri, I'm being pulled over" and all this happens automatically, hands free.

Take a look at the Laundry Timer app here. It's a very classic "take input and do a thing" program. You can build and extend workflows like this and the data from one flows through to the next one.

A multiple step shortcut with many actions that flow data into the next, organized in a pipeline

Note the Shortcut above. The "Adjust Date" action pops up a Date and is used as a Diff(erence) against the "Current Date" action, then used again in the Add New Reminder as an input to "Add New Reminder." These contextual variables flow through and are easily accessible in this genius UI. It really is near-perfect. Try it.

At this point you may be thinking, um, OK, that's cute, but where's the learn to code revolution here? It's not that open-ended of a system, what can I really do?

Like many connected cars, my car has a kind of REST API that its app uses to do things like heat up the climate system. Here I can literally POST (like Curl, but on your iPhone!) to an endpoint and pass in a FORM and parse the resulting JSON. Wow! Drink that in. You can write complex functions with iOS Shortcuts. Really.

calling a REST API with an iOS shortcut

Hang on. My body has a REST API. I use the open source Nightscout project to create a REST API on top of my Diabetes Continuous Glucose Meter then surface it in places like my lighted keyboard or even my Git Prompt.

How hard would it be to - right now as I make this blog post - write a method to have Siri retrieve my blood sugar and announce it to me when I say "Siri what's my blood sugar?" Let's see!

I make a URL object with my REST API that returns my sugar as JSON, it gets passed into Get Contents of URL. That makes a Dictionary from the Input, then gets the value of "sgv" (serum glucose value) and then the result of that is used to make a string with the Text action.

Preparing to make a shortcut

Now I have Siri SAY it. I can "debug" by running the Shortcut with the play button.

Building a shortcut

Then I can Add it to Siri and record my phrase. Here's me saying "what's my blood sugar" and she's telling me. Yes, I know. I had a cookie. I deserved it.

Running your shortcut

This is just the start. It could also tell me my trend lines, text someone if it's high, make a chart, I figure can do anything! I'm going to continue to explore Shortcuts but this little NightScout one can be downloaded to YOUR phone here. You'll only need to put in YOUR own URL for your Nightscout instance.

Sponsor: Manage GitHub Pull Requests right from the IDE with the latest JetBrains Rider. An integrated performance profiler on Windows comes to the rescue as well.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Simulating an iPhone or iPad browser for ASP.NET Mobile Web Development with WebMatrix 2 or Visual Studio 2012

June 11, '12 Comments [27] Posted in Apple | ASP.NET | Tools | WebMatrix
Sponsored By

I mentioned the Electric Plum Mobile Simulator as a nice way to check your site on an iPhone while using a Windows machine in my post called "Create a great mobile experience for your website today. Please."

Microsoft WebMatrix 2 RC is out this week and has a nice feature included - support for the Electric Plum Mobile Simulator for iPhone and iPad built right in. WebMatrix is Microsoft's lightweight editor for ASP.NET, PHP and node.js, as well the best way to install open source applications. It's a bit of a playground for the team. Features can be tried out in WebMatrix, and if they pop, we can move them into Visual Studio. I've been singing about Electric Plum for months, so I'm happy to see it in WebMatrix.

Here's how to use the iPhone simulator there, and how to add an iPhone Simulator to Visual Studio 2012 RC's list of browsers manually.

First, install WebMatrix 2 RC. You'll want this even if you're going to add Electric Plum to Visual Studio. From the Run menu, select Add new...

Adding iPhones to the WebMatrix run menu

From here, you'll go to the Browser Extension area where you can add not only iPhone and iPad but also the Windows Phone 7 emulator.

New Mobile emulators in WebMatrix 2 include iPhone

Now the Run button has more browsers as a choice. Here I've left the iPhone as the default choice.

My Run button now has an iPhone picture on it

And when I run it, I get the nice Electric Plum iPhone simulation with my current site loaded automatically. (Did you notice that WebMatrix used NuGet to install this feature? All these extensions are buried in C:\Users\YOU\AppData\Local\Microsoft\WebMatrix\Extensions\20RC currently)

Electric Plum Mobile Simulator

To add this browser to Visual Studio 2012 RC, go to the new browser button (integrated with the Debug button) while in a web project and select Browse With... and add in C:\Users\YOU\AppData\Local\Microsoft\WebMatrix\Extensions\20RC\iPhoneSimulator\ElectricMobileSim\ElectricMobileSim.exe. For arguments put in 1 for the iPhone.

Adding Electric Plum's iPhone simulator in my Visual Studio

Now, make another entry for IPad and use arguments "2" for iPad. Your VIsual Studio 2012 RC menu should now look like this.

Look, iPhone's in my Visual Studio Menu

Now, this is just using the basic version of Electric Plum that you can download inside WebMatrix. You can get a MUCH more functional version for $29.99. It will give you a developer console, GPS support, accelerometer and some additional HTML5 support like local storage, etc. If you're seriously doing iPhone websites on a Windows machine, it's a bargain and you get both iPhone and iPad plus a load of features.

(NOTE: I am NOT affliated with Electric Plum nor do I sell their products. I just think they are cool folks.)

Have fun! Do you want to see stuff like this in VS? Tell me in the comments and I'll make sure the right people see your voice!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Getting a new iPhone or iPad? Don't forget to enter your password 7 times!

March 17, '12 Comments [19] Posted in Apple
Sponsored By

I like it when companies have a single login. I've got a single Windows Live ID, a single Apple ID and a single Google login. For the most part, that along with my OpenID unlocks 90% of the Internet for me. What I don't like is entering these single IDs more than once on the same device. I was restoring an iPad from its backup just now and since passwords aren't stored in backups, I needed to re-enter mine. I entered my work and home email passwords, which makes sense. Then, rather than entering my Apple ID once in friendly Settings applet called "Enter your Apple ID only once here and I'll handle the rest," or even better, being prompted to enter my Apple ID when I started the device for the first time, again just once, instead I proceeded to have to enter the same Apple ID and password at least seven times.

Let's review, shall we? First, in the Store that manages your ID for applications and automatic downloads.*


Next in Video for Home Sharing...


But also Music for Home Sharing...


Then Game Center, which still looks totally ridiculous and out of place.

Game Center

Don't forget iMessage and also click Receive At to make sure all your emails are listed. But, you can't use your phone number here, so good luck getting iMessages to sync across devices.


Also add FaceTime which is not iMessage. No one ever FaceTimes you but, they might, so, be ready.


Don't forget iCloud. Remember also that Find My iPad in here is NOT the same Find My Whatever from MobileMe, and that's maybe not the same ID and password.


I love the hardware, the design and the devices, but man, Single Sign On anyone? Did I miss any?

* Ya, I know, two iOS posts in a row. Sue me. Or, better yet, just Mark as Read and we'll talk tomorrow, OK?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Living a Microsoft lifestyle using Apple iOS products - Lync, OneNote, Xbox for iPhone and iPad and more, oh my

December 22, '11 Comments [31] Posted in Apple | Mobile | Tools
Sponsored By

My iOS Home ScreenSure, I work for The Man in my day job, but I have an iPhone, a few iPod Touches, and two iPads in my personal mobile life. I have great respect for the Windows Phone 7 UX and I have a Samsung Focus that runs Mango that I swap my SIM into every few months to check out, but I'm invested in the iOS app store enough now that switching doesn't make sense for me. I'm teased by some co-workers and community folks who think I should blindly use only Microsoft products. That's fine. I use what works for me and I encourage you to do the same.

I am, however, a Microsoft Office fan and use OneNote (I switched from Evernote recently when Cloud sync via Skydrive for OneNote become available. I also use Lync (formerly Office Communicator) extensively at work as I'm remote.

Recently Microsoft released Lync for iPhone and iPad (as well as Google Android and Microsoft’s Windows Phone). The addition of Lync to my iPhone and iPad was effectively the last link in the chain for me as far as making sure my iPhone was connected to work.

I thought I'd take stock of the Microsoft apps that I'm using on my iOS devices, how they work and how I use them.

Microsoft Lync for iOS

I love Lync. Truly. It's corporate instant messaging, sure, but it's also VOIP, presence information, a company directory and it's integrated nicely with Office 365 and Outlook.

I've got a work phone number in the 425 area code that will simultaneously ring at my 503 mobile phone. Lync on the iPhone will also let me make calls from my 425 number by starting the call from Redmond then calling me immediately. Lync gives me iPhone-style access to my Voice Mail. It's a lot like the Google Voice app, except for Corporate VOIP.

The Microsoft Lync iPhone Application - Voice Mailsphoto 4

It supports notifications as well and I've sorted it to the top in my iOS5 notification center. It'll keep you signed in for 36 hours and send you notifications as long as you've enabled push notify. If not, it'll run in the background for an hour. There's no reason not to turn on notifications on iOS5 as far as I can see, so 36 hours is fine as I'll be launching it more often than that and keep it alive. Even better, it'll notify you to sign in (relaunch) if you don't go back in within 36 hours. Because the notifications are server-side, there's no battery hit.

The Microsoft Lync iPhone Application - ChatsThe Microsoft Lync iPhone Application - My Profile

There's a complete matrix of what mobile platforms support what in Lync over on TechNet.

Bing for iPhone

It's funny, I mostly Google for Web Pages but after my "give Bing a month" challenge, I use Bing for Movies, Weather, Travel and stuff that isn't web page searching. In fact, right now my home page is actually three tabs: DuckDuckGo, Bing and Google. Then I use the one that will give me the best results.

On the iPhone, Bing is a great app with a lot of depth. On the iPad it's AMAZING. If you have an iPad, no joke, check out the Bing App. You'll be impressed, especially when you realize how long ago it was released. It's innovative UI on the iPad predates the Twitter iPad release.

Bing has a great image search, but it's also got three nice features that use the iPhone camera. It'll search tags and QR Codes, it'll search books and CDs using just cover art, and it'll look at text and auto-OCR (Optical Character Recognition) the text then let you search on it.

Bing iOS Application - Home ScreenBing iOS Application - Movies

Frankly, the real crime here is that Microsoft does tell enough people about these features. Rather than trying to uncomfortably fit "let me Bing that" into popular TV shows, why not just have a main character USE the application for a real world problem and not make it so in your face? The Bing iOS app shines when you just use it.

Bing iOS Application - Image Search with CameraBing iOS Application - Camera and OCR

Here I've pointed it at a book cover and it's found the book then linked me to shopping. In the other screenshot I've pointed it at some text, it recognized it, then I can click the words I want to use to search with. Nice for translating signs or searching for ingredients on menus.

Microsoft OneNote for iPhone and iPad

I recently switched away from Evernote in favor of OneNote because I find OneNote's "freeform" notes more flexible over EverNote's more constrained "bullets and lists." OneNote also integrates nicely with Outlook and Office.


When OneNote added cloud syncing with Windows Live SkyDrive, that was nice as I could use OneNote on multiple machines. Then OneNote for iPhone and iPad came out and I was sold.

Microsoft OneNote on IOS - NoteMicrosoft OneNote on IOS - List of Notes

OneNote supports up to 500 notes for free and then they charge. I use it a LOT and I'm still only at 180 notes.

Microsoft OneNote on IOS - SectionMicrosoft OneNote on IOS - Searching

They could still stand to improve it on the iPad with ink support but generally, having OneNote and Lync together on my iPhone or iPad along with my mail makes me a pretty good little corporate tool when I'm hanging at the Holiday Inn Omaha.

Xbox for iOS

There's even an Xbox app for iPhone. Madness. You can keep track of Achievements, answer messages, set beacons, but also watch videos and game trailers.

Xbox Achievements on iPhoneXbox Avatar editing on iPhone

You can even change your avatar's look. Jazz hands!

Xbox Videos on iPhoneHalo Waypoint for iPhone

By the way, there's even a Halo Waypoint app for iPhone.

Lots of Microsoft apps in the Apple MarketplaceOther Microsoft apps on iPhone

There's a bunch of other apps from Microsoft on iOS, including:

  • Microsoft SkyDrive for iPhone - Exactly that. It's a drive in the Sky. They give you 25 gigs for free. I keep my OneNote files up there for syncing but you can put anything there like photos, documents, etc.
  • Kintectimals - A nice tie-in with the actual Xbox game for kids with Kinect. It's really cute on the iPad and actually lets you unlock 5 new cubs from the iOS device that your kids can then use on their Xbox directly.
  • Photosynth - This app has been downloaded 4.4 MILLION teams on the iPhone. You kinda have to see it to believe it, but it's kind of a 360 degree panorama on steroids.
  • Windows Live Messenger - If this is your IM of choice, they've got that also.

I'm pretty stoked about Microsoft's (apparently) new focus on services being available everywhere, rather than sweating whether someone is using those services on a Microsoft piece of hardware.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

There is only one Cloud Icon in the Entire Universe

October 16, '11 Comments [45] Posted in Apple | Musings
Sponsored By

I recently worked on the update to the ASP.NET site, now in beta at On that site we used an icon from the Pictos collection. I have an email from March of 2010 where we selected that icon, in fact.

Recently we updated the old site's cloud icon from this, to this:

Old ASP.NET Cloud IconNew ASP.NET Cloud Icon

I saw a few tweets and got some emails that said "nice iCloud icon." Well, it does look familiar! ;)

iCloud Icon

Of course, MobileMe before this:

Mobile Me Icon

I knew I'd see this icon somewhere before. Folks have even written articles talking about how beautiful this icon is and how the Golden Ratio is infused in its design. There are even tutorials written on how to create the icon from scratch in PhotoShop.

iCloud Icon Golden Ratio

Apple's logo artists have infused the iCloud logo with some mathematical elegance. In this case, the golden ratio or φ...Simple, but profound. Awesome Apple's design philosophy.

Funny thing about the Golden Ratio, if you look for it, you'll find it everywhere. Read about it in the book "The Golden Ratio: The Story of PHI" or watch this video on the Golden Ratio.  It's intuitive. Cool, also that they attribute this icon and it's "brilliance" to the Apple Designers, except the icon isn't from Apple, it's straight from Pictos 1. I know, because we bought it from them for our site. Plus Pictos 1 has been around for years. It includes a regular cloud, clouds with arrows up and down and a lightening bolt cloud.

Pictos - The Original iCloud Icon

Of course, there's only so many ways to draw a cloud, right? But somehow this one just nails it and is itself iconic, if you'll excuse the pun.

Where else might you have seen this cloud icon? Seems everyone with an internet-connected or music app uses it:

Another app using the same cloud iconYet another app using the same cloud icon

Just a few...

Daum Cloud UtilitiesCloud 2 Go

Dreams ControllerCloud of Inspirations

Cloud WalletCosa Icon

Zendit iconWiFi Fast Connect

iStorage IconSound Cloud Icon

Even though the first appearance of this cloud icon was in the commercial Pictos 1 set, you'll find suspiciously similar clouds in other cloud icons packs like the one at that's Creative Commons. Notice that you can change the look of the cloud icon slight if you the circles smaller or larger or add a border, push and pull, or squish and stretch.

More clouds!

But again, it's essentially four circles. My 3 year old draws similar clouds. At what point does a unique design stop being unique and just absorb into the consciousness?

Today, it seems there is only one cloud icon in the universe and it's four circles with a flat base. I like it.

UPDATE: Hat tip to Ian Griffiths who points out that the BBC Weather Service beat all of us to the iCloud icon, kind of...over 30 years ago. ;)

iCloud - BBC Style, 30 years ago

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Page 1 of 2 in the Apple category Next Page

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.