This page looks plain and unstyled because you're using a non-standard compliant browser. To see it in its best form, please upgrade to a browser that supports web standards. It's free and painless.

Paul's Time Sink

| Main | Albums |

Reprogramming X10 light switch

Paul Westbrook | 06 June, 2005 21:34

12073WbigFor some reason, our KeypadLinc X-10 light switch got reset to the default settings, so I decided to reprogram it with some buttons that would be easier to use.  Since it has 6 buttons on it, and I only need to control 3 lights, I decided to configure it so that each light would have two buttons to control it, one to dim and one to brighten. 

This works fine for the light that is directly connected to the switch, but it doesn't work as I expect for the remote lights.  I wanted to program the buttons so that pressing and holding the buttons would continue to send the dim/brighten commands.  But it looks like for remote lights, if you use the non-toggle mode to send a bright or dim, the commands do not repeat.
 (More)

AppleScript frustrations

Paul Westbrook | 06 June, 2005 21:27

I spent a lot of time this past weekend trying to improve the AppleScript that I mentioned before.  I want to uses this script to automatically move all tracks that were added to iTunes, from Shrook, into a single playlist.

Since Shrook downloads all of the podcast tracks to ~/Library/Application Support/Shrook2/Attachments, all that would been needed to is to find all of the tracks in the iTunes library that are in that directory, and then make sure they were in the playlist.

The AppleScript that I wrote before does this job, but it takes a long time if the iTunes Library has a lot of tracks, as it had to iterate over each of them.  So I wanted too change the script to iterate over the files that Shrook had downloaded, and then check each one to see if it has been added.

This script sample should work:

tell application "iTunes"

if (exists (get some file track of library playlist 1 whose location is theFile)) then

set this_track to (get some file track of library playlist 1 whose location is (theFile as alias))
set dbid to this_track's database ID
if not (exists (some track of playlist podcastPlaylist whose database ID is dbid)) then

duplicate this_track to playlist podcastPlaylist

end if

end if

end tell

 (More)

Powered by LifeType
Design by Book of Styles