Skip to Content
Author's profile photo Ronald Konijnenburg

So you want to fire of voice commands to HANA on your MAC?

Sometimes you just wake up on a saturday morning with an idea. “I wonder if I can connect to HANA via speech from my Mac”. It would mean I could fire off a request to HANA, get a response back and have the results returned to me via Speech.

Now I have showed you on a number of occasions that can be done on the iPhone by using Siri, but I was wondering how difficult it would be to do it from a Mac. It turns out, it’s a piece of cake.

The first thing I did was look for an ODBC driver for OS X. Now I pretty much expected that we do not have one, but I tried anyway:


And lo and behold, my buddy and fellow mentor Carsten responded. No ODBC driver… Now normally that would have ended my adventure, but as HANA is amongst many things a developers platform, it’s pretty easy to use RESTful services (XS, oData) to connect to HANA. Why would anyone still need ODBC I asked myself:


So with that said, let’s script!

A quick Google shows the Mac has something called “speakable items”. You can use voice commands to have your Mac do whatever you want. Well, that means it can also speak to HANA.


So whenever I say “Mac + a command”, the command is executed and this little fellow will pop up executing my every wish:


How cool is that!

But how do I attach a command to my speakable items? It is simple: AppleScript.

AppleScript is Apple’s own scripting language which can automate a ton of stuff on your Mac. The cool part is that once you save your AppleScript in a specific folder called “speakable items”  you can actually trigger actions by voice. Just name the script to a voice command and we should be good to go. The fun starts 😉

First off, I need a JSON parser for AppleScript . As simple Google search gives me one:

JSON Helper

It turns out to be a fantastic piece of software which runs in the background waiting for AppleScript to ask it to do something, just like Apple’s own System Events does. A brief look at the samples gives me an idea on how I need to create my script. In the end, 5 lines of code is all I need:

tell application “JSON Helper”

       set myRecord to fetch JSON from “admin” password “welcome”

       set myResult to |TEMPERATURE| of item 1 of results of d of myRecord as string

       say (“The temperature of the HANA Alerter is ” & myResult & ” °C”)

end tell

Basically I call JSON helper from my script, I feed it my XS service (the mentioned URL is the XS URL I rerouted to a public domain, the original would look like this:$orderby=TIMESTAMP%20desc&$top=1&$format=json), username and password for basic authentication and finally I format the result into something readable. The last step in my script (say) speaks the output of my service. Executing services via speech by voice just became a reality!

I just used one of my services which was still active (from my TechEd HANA Alerter demo). Ofcourse you can do whatever you want with this technology. Any HANA table or view you can make accessible via voice on your Mac!

Below a clip on how it will all look in the end:

Have fun and let me know in the comments which use cases you build! I’m sure you can be tremendously creative.

Thank you for reading and take care,


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Tammy Powlas
      Tammy Powlas

      "Tres cool"

      Well done - I can't think of any ideas at the moment (probably because I don't have a Mac) but thank you for sharing.

      Author's profile photo Ronald Konijnenburg
      Ronald Konijnenburg
      Blog Post Author

      Hi Tammy. just think sitting at your desk and wanting to know how many customers are in a store, what the daily sales are, who called in sick,... Everything can be queried with a little imagination and HANA 🙂

      Author's profile photo Twan van den Broek
      Twan van den Broek

      I see another DemoJam use case coming up ... 😉

      You have great ideas in the morning Ronald!

      Author's profile photo Ronald Konijnenburg
      Ronald Konijnenburg
      Blog Post Author

      Thanks buddy, but for DemoJam I think I have a better idea 😉

      Author's profile photo Xavier Hacking
      Xavier Hacking

      Haha good old AppleScript, still useful! Very nice!

      Author's profile photo Ronald Konijnenburg
      Ronald Konijnenburg
      Blog Post Author

      Proofing to the world you can do just about anything with services (and AppleScript 😉

      Author's profile photo Former Member
      Former Member

      Very very cool. I think this a great example for user interface and the power HANA can offer. This is a nice example. We could try to get together to find some more use cases for a cool demo session. Very very cool !!!

      Author's profile photo Matthias Wild
      Matthias Wild

      Very cool - thanks for sharing! I will testdrive this!

      Author's profile photo Ronald Konijnenburg
      Ronald Konijnenburg
      Blog Post Author

      Have fun 😉

      Author's profile photo Former Member
      Former Member

      cool stuff !! nice one !!