applescript

My Siri-like Mac speech recognition and computer interaction software

Eighteen months before Apple released their Siri software on the iPhone 4S, I found myself stranded in a motel in Dease Lake, British Columbia, and wrote a little speech recognition, text to voice, and computer interaction application. Here's a demo of how my Mac "Siri like" software application works:

First Mac Ruby Appscript examples

I just took a brief look at Ruby Appscript as a potential replacement for AppleScript on Mac OS X. So far it looks promising, and works on Mac OS X 10.6 (Snow Leopard) just fine.

The hardest part about working with it yet has been finding a few examples to get going with. Based on my forty-five minutes of working with it just now, here are a couple of quick Ruby Appscript examples that might help get you going a little faster.

AppleScript dialog icons

AppleScript dialog icons FAQ: How do I put icons on my AppleScript dialogs?

I started to get into this a little bit in my earlier "How to customize AppleScript dialogs" tutorial, but in this article I thought I'd just dig into the AppleScript dialog icons details.

AppleScript dialog icons - The "with icon" syntax

In short, you add icons to your AppleScript dialog using the AppleScript "with icon" syntax. Here are a few simple examples.

First, the AppleScript dialog note icon:

The AppleScript for loop (and while loop) examples

AppleScript for loop FAQ: How do I use an AppleScript for loop? (Also, how do you use an AppleScript while loop?)

This is actually a bit of a trick question, as there is no AppleScript for loop or while loop syntax. Instead you use the AppleScript repeat command, as shown in the following examples.

AppleScript for loop examples

Where you might expect an AppleScript for loop to iterate over a list, you use the AppleScript "repeat with" syntax:

An AppleScript list iterate/loop example

AppleScript list FAQ: How do I iterate/loop over an AppleScript list?

As I continue to work on my Mac speech recognition software projects, I've often found the need to loop over an AppleScript list. One way to loop over an AppleScript list is to use the AppleScript repeat with syntax:

An AppleScript list size example

AppleScript list FAQ: How do I get the AppleScript list size, i.e., the size of an AppleScript list (or number of items in a list)?

To get the count of the number of items in an AppleScript list, use this syntax:

set myList to {"Problem", "There was a problem", "Bummer"}
set listSize to count of myList

The variable listSize will now contain the AppleScript list size (the number of items in the AppleScript list named myList).

AppleScript random examples

AppleScript random FAQ: Can you share some AppleScript random list item examples?

While working with some Mac speech recognition software I originally didn't know how to do something with a random item from an AppleScript list, so my first AppleScript random script attempt looked like this:

AppleScript list examples

AppleScript list FAQ: Can you share some simple AppleScript list examples?

Sure. As I've been doing a lot of work with Mac speech recognition software lately I've been working a lot of with AppleScript lists. Let's take a look at some common AppleScript list examples (and programming needs).

How to create an AppleScript list

A simple AppleScript list can be created like this:

An AppleScript current time example

AppleScript time FAQ: Can you share an AppleScript example that shows how to work with the current time?

If you ever need an AppleScript current time example, or an AppleScript to parse and format the current time, I hope this following script will be helpful. This AppleScript script gets the current time, formats it, and then speaks the current time back to you in a human-friendly format:

iTunes AppleScript examples (command examples)

iTunes AppleScript examples FAQ: Can you share some iTunes AppleScript examples (iTunes AppleScript example scripts)?

As I've been working a lot with Mac speech recognition software lately, AppleScript has once again become important in my life. I've been writing a lot of small AppleScript scripts, including AppleScript iTunes scripts, and I thought I'd share snippets of code from those iTunes scripts here for anyone else they might benefit.

Syndicate content