Site Meter
Applescript

SafariBookmarsk2Web

SafariBooksMarks2Web is an applescript that will read the bookmakrs from Safari and create a javascript that can be placed in a website. The javascript functions will display the links on your website.

Why?

The primary purpose of this script was so I could update the links on my blog without having to regenerate the entire site every time (since every page has the links on them). I also wanted to be able to manage those links from Safari, since that's where I do all my surfing. A single javascript function can now access them from the website without updating the site every time.

How Do I Use It?

When you run the application it will present you with a dialog of the root directory. This is the directory in your Safari Bookmarks that has the links you want displayed. The default is the Bookmarks Bar.



When you click OK it will parse your Safari Bookmarks.plist file and pull out all the links and directory structure. It will then stick all of them into a file called safaribookmarks.js on your desktop. You can then use this file in your site.\

Before you use it you will need to put the file on your website in the <HEAD> section:
<script type="text/javascript" src="safaribookmarks.js" language="JavaScript"></script>

There are two functions:

randomlink will display a random link from the list. Use this code in your website: <script language="JavaScript"> randomlink(); </script>

writelinks will write a list of the URLs in a HTML list format with the subdirectories as headers. Use this code in your website:<script language="JavaScript"> writelinks(); </script>

[Update:] Beta 2 adds the ability to have comments for a website. Separate the name with the comment with a double pipe ||.

Where Do I Download It?

Click here:
SafariBookmarks2Web 2.zip


Are There Any Known issues?

This is a beta. It works for me, maybe not so much for you. It also probably doesn't have the options you want. Please give me feedback so I can improve it.

If a bookmark is listed first and a folder is listed after it, it will stick the bookmark in the next directory. For example Apple is listed under Mac Sites in my bookmarks then there is a folder called General News. For some reason it is put into General News. This doesn't happen if you put the bookmarks after the folders.

There is an error after running the script. The safaribookmarks.js should still be produced ok.



The more links you have, the longer it takes to run since it reads in the entries bookmarks list.

I've thought long and hard about weather to share the code for this. For now I've decided not to. 
|

NOAA Weather Data

[Updated 11/2/06] This script used CURL to download data.

I was looking for a way to get weather from the internet without using 3rd party programs like Weatherman for use with Indigo. There's nothing wrong with them but they don't always provide the information I need. I started playing around with the experimental feeds that the NOAA website provides and was able to parse that data with Applescript. The script requires XML Tools, a free scripting addition that provides the XML parsing. From there you need to get the correct NOAA XML URL for your state (note, use XML NOT RSS.).

The XML feed does not contain as much information as Weatherman provides. But if you don't want to pay for Weatherman at the moment this is a good alternative. Also note that this is an experimental service by the NOAA, it could go away.

Recently Slashdot had a article about the availability of free data by the NOAA. Software providers don't want you to have free data since that hurts their revenue stream. If you think free data from the NOAA is important then please send them feedback.

SECompiledScript
Download NOAA Weather Script.scpt

|

Weather Data From WeatherManX For Indigo

To get weather data into my home automation set up I use a Applescriptable program called WeathermanX. It gets all avaialbe data including forecasts and puts them into Indigo variables. WeathermanX has the option to run a script based on certain situations, however there's I could just as easily set up a time date trigger to fire this off ever so often.

The only missing last observation time which I hope the developer will add to weatherman in the future. There is another script I use which runs at midnight that tracks the min and max temps for the last x days. I'll post that later.

[Update:] I was wrong, observation time is in the WeathermanX applescript dictionary. I've added that and set it so it creates variables for every possible data point that Weatherman allows. It also puts min/max temps in a list rather than individual days.

SECompiledScript
Download WMXtoIndigo.scpt

|

Applescripting iCal And Indigo

[Update 08/27/2004] My earlier attempts at scripting Indigo and iCal were good but I have greatly simplified the process. There are two functions as before:

  • LogDevice(DeviceName) - Will automatically create the iCal event based on device parameters. Be sure to call this after you have changed the devices state.
  • logmessages(MessageGroup, message, EventKind) - General message logging. For logging messages not related to devices.

[Update 06/19/04:] See this article on getting data from iCal.

[Updated 05/30/04] Here's the latest incarnation of my iCal logging script. I've changed it quite a bit. There's two ways to use it.

  1. Use LogDevice(DeviceName) for devices.
  2. Use logmessages(MessageGroup, message, EventKind) for non devices.

You set EventKind to true for the start of an event and EventKind to false for the end of a event. Or if you want to just do a single logging use false for EventKind. This version makes use of the built in iCal properties and filters out Motion Detectors.

Note: I use the description field pretty heavily and this script may require that you have the proper info there.

[Updated 4/19/2004] I had given up on my iCal logging script, but decided to give it another try with some serious updates. Here's what's new:

  • It can track when a device is turned on and when one is turned off. If I turn on my living room lights at 5pm and turn them off 8pm it will show an event that starts at 5pm and ends at 8pm. It's a lot easier to to read this information in an iCal type interface then a log file.
  • It does some cleaning up so if a device is turned on and Indigo never sees that it was turned off it will remove the event all together. This needs some work.
  • It logs motion detectors different from "on/off devices".
  • It uses the description field to determine what kind of device it is and what calendar to put it in. I'm pretty consistent with my descriptions which look like this: Switchlinc controlling a lamp in the living room.

There's still some things to fix so expect an update to this in the next few weeks as I have time to work on it.

One of the limitation of Indigo is its ability to control scheduled events. When ever you have an event that needs to occur at a specified time you get a Time/Date trigger. Say for example you want to have a motion detector turn on a light, you would set the motion detector to turn on the light when motion was detected then turn off the light after a specified amount of time. I'm doing this in my living room. But when I want the light to stay on I use a Palm Pad to keep the light on, at the same time I need to cancel any scheduled auto off triggers for that light. Indigo does give me the ability to disable any auto off triggers that are created by Indigo. But I would rather delete them. If I create my own auto off triggers there's no way for me to look through the triggers and delete them my what units they effect.

I started looking at iCal for my scheduling needs. iCal 1.5.1 has much better Applesciptablity specifily the ability to have files run as an alarm. Since I am no expert at Applescript I looked at what Applescript were already out there for iCal. I found the iCal Script Pack by Blank Rebel Productions. With this I was able to make a motion logging script. Basically every time a motion detector is tripped it creates a event under a calendar named for the motion detector. I can then go at look at iCal and see if/when there was motion during the day while I was gone.

This has worked out pretty well. Except I seem to be tasking iCal to its limits on my Lombard. I must have thousands of entries per calendar and right now I have 6 motion detector that log data to iCal. But it does work. I plan to do some other stuff with this data like predict how long lights need to stay on and output the data to a web page.

Next step was to use iCal to actually control the scheduled events. The idea was to have a script that created the file to be attached to the alarm. The Auto off script would be basic telling Indigo to turn off the specified unit. There would be a script to delete any existing scheduled events and finally a script to schedule the event.

The script was made after some help from the MacScripter.net BBS. But at this point it doesn't seem to work. First problem is the "File Alarm" doesn't seem to fire. It shows scheduled but I never see the applescript popup and run. Second problem is the file for the alarm is suppose to have a variable assigned in it that is the unit to be turned off. But for whatever reason the variable doesn't get assigned to it. This is probably due to some lack of understanding of Applescript on my part.

For now I'm giving up on this project. I've got my system mostly working like I want and I know the developer of Indigo is working to improve the indigo.

SECompiledScript
Download MutiLogging.scpt

|