For the last few days I’ve been enjoying–perhaps ‘enjoying’ is the wrong word–revelling in a blast from the past, AppleScript. AppleScript occupies a special place in my heart, because AppleScript is the language that introduced me to programming. It seems I spend all my time programming in C and C++, and learning Swift these days, but alas I find all of those languages lacking when it comes to soft-automation. So it seems AppleScript has risen from the dead and reared its simplistic, yet surprisingly versatile head once again. (Plus, now that I have learned so much C, C++ and Swift, I’ve brought a much more formulaic style to my new AppleScript.) So, the premise. I have been asked to do some topological surveys, and then draw up those surveys using Illustrator. I, however, do not want to spend a hundred years learning Illustrator, nor do I want to spend a hundred years drawing up survey maps. I do, however, have a great interest in automation, and while I cannot currently automate the actual survey itself (although I have some ideas about that), I have managed to automate a good deal of the Illustrator work. And it’s taken me less than a week. . . there’s still a bit to do, mind you, but progress is progress and that’s an end of it! So, the problem. I had assumed that the main problem would be having to learn how to use Adobe’s “Actions”, which is Adobe’s version of OS X Automater as far as I could tell, but I quickly decided that I couldn’t be bothered with that. The little time I did spend looking into them revealed that they weren’t nearly as variable and automatic as I wanted them to be. Having used AppleScript before to control other applications, I was pleased to discover that Adobe programmes have extensive AppleScript support. The next problem was tackling Adobe’s 317 page Adobe-AppleScript documentation. For the sake of argument, let’s assume that I read that document. Moving on. Whilst dicking about in Illustrator, I discover that Illustrator operates on an invisible grid of Points (pts). I also find that the top left of a document is point x=0, y=0. This means that if you move right along the x-axis, the x-coordinate increases, but as you move down along the y-axis, the y-coordiate...

[Part 1 Learn your IR codes] [Part 2 Control Arduino using AppleScript] [Part 3 Examples and Downloads] UPDATE: Works with OS X Yosemite. Part 3 In Part 2 we learned how to control our Arduino using AppleScript, or more specifically, how to send Shell commands via AppleScript. In this next section we will look at a practical example, one which will take a User’s input and translate that into the appropriate IR commands for the appropriate digits on the remote. The script also sets the computer’s shutdown and boot up times. The finished scripts can be found in the downloads box below, they will need a few slight adjustments for your system before they will run, but I’ll explain those as we run through them. Downloads ArduinoIRCommands.scpt (signalTV script) SetWakeTime(db).scpt Arduino Sketch for controlling 22LG3000 (can be adjusted for other TVs) Don’t forget, you will still need to use Ken Shirriff’s IRremote library and Tod Kurt’s arduino-serial package. (Links in the ArduinoIRCommands script or in Part 2.) Using the ArduinoIRCommands script, you can now create an unlimited number of scripts to control your TV in a number of ways only limited by the functions of your TV. For instance, the more eagle-eyed of you will have noticed that in Part 2 I left some subroutines in the signalTV routine that I haven’t yet talked about, namely “sendSLEEP“, “sendGET2WAKE“, “sendWAKE2SLEEP” and “sendCANCELSLEEP“. You’ll also find these in the Arduino sketch linked above. These subroutines send a series of IR commands that get to a specific point inside the TV’s system menus. For instance, the order of button presses on my TV remote to get to the sleep screen, set it for 120 minutes and then exit the menu is as follows: Menu > Arrow Down > Arrow Down > Select > Arrow Down > Arrow Down > Select > Arrow Down > Arrow Down > Arrow Left > Exit. Seeing as we’ve already made methods for all of these actions, it makes AppleScripting a lot easier if we simply create a new method to do specifically that, rather than script 11 different commands and send them via serial every time. In the Arduino sketch you’ll see this method near the bottom: void sendSLEEP() { sendMENU(); sendADWN(); sendADWN(); sendSELECT(); sendADWN(); sendADWN(); sendSELECT(); sendADWN(); sendADWN(); sendALFT(); sendEXIT(); delay (10*100); } In...

For the last few days I’ve been enjoying–perhaps ‘enjoying’ is the wrong word–revelling in a blast from the past, AppleScript. AppleScript occupies a special place in my heart, because AppleScript is the language that introduced me to programming. It seems I spend all my time programming in C and C++, and learning Swift these days, but alas I find all of those languages lacking when it comes to soft-automation. So...

[Part 1 Learn your IR codes] [Part 2 Control Arduino using AppleScript] [Part 3 Examples and Downloads] UPDATE: Works with OS X Yosemite. Part 3 In Part 2 we learned how to control our Arduino using AppleScript, or more specifically, how to send Shell commands via AppleScript. In this next section we will look at a practical example, one which will take a User’s input and translate that into the appropriate IR commands...

[Part 1 Learn your IR codes] [Part 2 Control Arduino using AppleScript] [Part 3 Examples and Downloads] Part 2 This next part, for me at least, came with a bit of luck. I found a forum somewhere (which for the life of me I can’t re-find) which pointed out a very important part of the IR code which the IRrecord sketch we used last time didn’t show. As we know, the serial output of the IRrecord sketch showed us something...

[Part 1 Learn your IR codes] [Part 2 Control Arduino using AppleScript] [Part 3 Examples and Downloads] Part 1 What with my exams finished, I thought I’d take some down time and build an IR Remote that I can control with my computer. I use a 22” LG TV as a display for my MacBook, but because it’s a TV and not a monitor, it doesn’t switch off when I put my computer to sleep. Pressing the on/off button on the front of the TV doesn’t...

It seems fair that you might wonder whether or not I have what it takes to, not only teach myself Python, but also not give up halfway through. To such a request I would say this: “I taught myself AppleScript through mainly trial and (normally considerable) error. In the end I came up with what I called Bootle26. I described it as a security application, but it was more like a . . . internet nanny/taddler application. It cross...