VoodooPad Pro Blogging

Please note that VoodooPad Pro has been renamed to VoodooPad.
It’s time to package up all my VoodooPad blogging scripts and assorted web export plugins so that I can

  1. Remember what the heck I was thinking.
  2. Remember what all these pieces were supposed to accomplish as a whole.
  3. Provide some sort of reference to others interested in this stuff.

Concept: To use VoodooPad as a CMS for a web site, allowing for static sites and inclusion of blog-style concatenated page. The blog-style page was originally intended as a News page of a static business site. SEO optimization necessitating the addition of a page with re-newing content. Google likes it more.
Disclaimer: I like Markdown and built these scripts around the fact that the VP document is essentially always formatted in plain text. Images need to be added using links.
I will include a sample package that contains a VP document, a web export plugin and several script plugins. The site the sample is based upon is at.
VoodooPad is a requirement as the meta data and triggers are necessary in the creation of the files. My workflow is as follows.

  1. Create new page/post.
  2. Run script plugin Blog > Meta Markup - HomepageMeta on new page.
  3. Run script plugin Blog > Make Homepage and Feed
  4. Run web export.
  5. FTP files up to site. I use Transmit. It’s also a great app.

The script will move all the created files into a folder structure so that the file structure on the computer will match the web site structure.
VoodooPad document
Item meta data is contained in the HomepageMeta page of the document. This is where most of the personalized info on the site is contained.
In the VP document, tags are used to create a pseudo-folder structure. This means that a page may only have one tag. Some pages are not exported but are used as reference, ie. links in the sidebar or the HomepageMeta page. Pages that are to be rendered at the root level of the site are tagged main.
Triggers can be used to include certain information into specific pages or info on every page. I use this for things like Google Analytics which needs to be on every page or the analytics confirmation that is only on the index.html page.
The Web Export Plugin
Some customization of these files will be necessary for your specific site.

Images are kept in the web export plugin. Files like robots.txt that need to be at the root level are kept in a root folder inside the web export plugin.

  • preflight.sh – creates the actual folder hierarchy, the folders are created in the preflight.sh script. The preflight.sh script also copies files like images to the export folder.

  • postflight.sh – can be used to rename pages that may be PHP based from .html to .php

  • deleteVPExtra.sh – deletes the extra pages that VoodooPad creates during a web export. No changes to this file are needed.

  • fixRelativePaths.sh – fixes the relative URLs that occur inside of nested pages. No changes to this file are needed.

  • parseMetaXml.rb – Parses the meta.xml file that VoodooPad creates and uses that infomation to move files into their correct folder structure on the disk and to create a valid sitemap.xml file for use with Google Sitemaps. It also creates and parses the vpDocMeta.xml file for variables.

  • Info.plist – This file was edited to call these scripts during the web export process.

  • vpDocMeta.xml – This file resides inside the root folder of the Web Export Plugin. It is created by the parseMetaXml.rb script. It contains the following data points.

  • root – default value is main. This is the name of the tag of rendered pages that belong at the root level of the folder structure.
  • baseUrl – This is the base URL for the site for creation of the sitemap.xml file.
  • isHomeIndex – default value is false. This is only used if the the page name in VP for the index page of the site is home. This is true if the main page is a blog-style homepage.
  • noIndex – default value is private. This is the name of a directory whose files you don’t want included in sitemap.xml.

Script Plugins
These are placed in the ~/Library/Application Support/VoodooPad/Script PlugIns/ folder. No changes should be required in these scripts. They will be viewable from the Plugin > Blog menu in VoodooPad.

  • meta_markup_HomepageMeta.lua – Takes the data from the page HomepageMeta in the VP doc and adds specific item meta data to the frontmost page.
  • meta_markup_update.lua – Propagates changes made to the HomepageMeta page to all the item meta data of all pages that require them. This is only just the pages used for the blog-style page.
  • blog_home_atom.lua – Creates the blog-style page now called home in the VP document and also creates a valid atom.xml feed in the output directory.

Comments and questions are welcome. If some enterprising person wants to wrap this all up in the new plugin architecture that would be cool. I’m happy to help if I can.

iCal – Exchange Time Zone Fix – Chapter 3

I’ve updated the iCal-Invite-Fix script again. This time to allow for adding multiple Exchange servers to the script so that you should only need a single script. The set-up is slightly more complex.
As the image above shows there are now only 2 properties, both of which are lists. These lists work together as an array; which means the order of the list items is crucial.

  • exchange_fragment contains unique fragments of the TZID that the Exchange server sends.
  • ical_tzid contains the tzid info that iCal expects to see.

If you have any problems setting it up let me know. This post has all the info for the script.
Download the iCal-Invite-Fix script.

Importing Mail Message Attachments Into Aperture

So I’ve just gotten my new Unibody MacBook and Aperture. Immediately I find myself wanting for a Quick Look > Add to Aperture just like there is for iPhoto. Unfortunately it’s nowhere to be found. Fortunately Aperture is scriptable.
Version 1.0 of SaveAttachments2Aperture is now available. It’s currently very simple with little error checking. It works multiple attachments per message and imports all attachments of a selected message into a new Aperture project.
It could be used in a Mail rule though I prefer to select it manually from the Script menu. I have it saved in ~/Library/Scripts/Applications/Mail/.
A thanks goes out to Automating Aperture where I got some of the Aperture scripting.
Comments welcome.
Now at version 1.1. I added some simple logic to only import certain file types. You might need to add to this list. If I’m missing some let me know, especially with Raw images.
v1.2 – add a bunch of the usual camera raw file types

iCal – Exchange Time Zone Fix – Chapter 2

It was a few months ago that I originally wrote the first incarnation of the MailExchange2iCal script. Since then I’ve been in contact with a few users trying to make it work for them and I’ve found a number of peculiarities in the types of email invites sent by Exchange/Outlook. The biggest problem was that the time zone data for the event was improperly formatted. This caused all sorts of problems for Mac users.
Let’s start at the beginning. Sometimes integration of a Mac in the corporate environment is a bit difficult and takes a bit of ingenuity. This is especially true when dealing with Exchange. The current versions of iCal and iCal Server are CalDAV and iCalendar compliant. Only Outlook 2007 is said to be CalDAV and iCalendar compliant. Previous versions of Outlook are not compliant and don’t play well with other calendar applications. Here’s the actual time zone (TZID) spec and the spec for how it should be formatted. You can see by looking at it that the TZID that Outlook produces is non-compliant.
A quick Google search shows an article or two that explain this very well.
I’ve found that there are at least 3 different types of invites that can be sent by Exchange/Outlook.

  1. METHOD:REQUEST – This is the usual email requesting that you attend a meeting.
  2. METHOD:PUBLISH – This is essentially a publication notice for an event. It doesn’t ask you to reply.
  3. METHOD:CANCEL – This is a cancellation notice for an event.

Additionally, I’ve found that the emails that contain these invites are formated in at least 3 different ways. Sometimes the calendar event is within the body of the message and is encoded with Content-Transfer-Encoding in either 8bit or quoted-printable. Always the .ics file is attached.
My script does the following:

  1. It parses the message to either extract the calendar data from the body of the message or from the .ics attachment.
  2. It then figures out if the invite is of type METHOD:REQUEST, METHOD:PUBLISH or METHOD:CANCEL.
  3. If the invite is one of the first 2 types. The time zone is fixed and the event is imported into iCal. You might have to select into which calendar the event will be imported.
  4. If the invite is of type METHOD:CANCEL then the script will locate the corresponding event and set it’s status to cancelled.
  • You will have to manually delete the event. It will appear in iCal to have a white strike-through font style.
  • Repeating events all seem to have the same UID (Unique IDentifier).

I don’t know why. Every repeating event will be thusly marked as cancelled. You will then manually delete the specific event and manually run the script again while the cancellation message is selected. This will reset the remaining repeating events back to confirmed. Yes, I know this is a bit of a kludge but I don’t have a better method.

  1. It will parse the message to allow for invites from multiple Exchange servers.

My script, now re-named iCal-Invite-Fix.scpt, will need to be customized for each Exchange server from which you receive invites. There are 3 properties at the beginning of the script. They are exchange_fragment, ical_tzid and myCalendar. These first two properties are lists and the order of the items is crucial. The specific item (position in list) of each list must correspond to each other.

  • exchange_fragment is a unique fragment of the TZID that your Exchange server sends.
  • ical_tzid is the time zone of the Exchange server in proper format.
  • This means no spaces, though spaces are replaced automatically with the underscore ‘_’.
  • For instance, I’m in Southern California and the correct time zone should be written as US/Pacific or America/Los_Angeles. You can find this information by selecting the time zone drop down menu in the upper right corner of your iCal window and select Other.... If you look in iCal’s upper right corner for the time zone menu bar the last example will appear as America/Los Angeles.
  • myCalendar is the name of the calendar that normally receives the events. It is needed for the cancellation to function.

Save the script and either set it up to run from a mail rule or as I do call it from the System AppleScript menu. You will need to save the script in ~/Library/Scripts/Applications/Mail/ folder. Create this folder if it doesn’t exist.
To set the script up to run automatically you will need to create a new Mail rule as follows.

  1. Mail -> Preferences -> Rules -> Add Rule
  2. Description “iCal Invite Fix”
  3. If “any” of the following conditions are met:
    • “Any Attachment Name” “ends with” “.ics”
  4. Perform the following actions:
    • Run AppleScript “~/Library/Scripts/Applications/Mail/iCal-Invite-Fix.scpt”
  5. Click “OK” and then “Apply”

You can also run the script manually from the system-wide script menu. To install this menu. Open up the /Applications/AppleScript/AppleScript Utility.app and check the Show Script menu in menu bar box. If you put the script in the folder location indicated above it will now be visible when Mail.app is the current application.
Download the iCal-Invite-Fix script.
Please let me know if there are any problems or you need help setting this up. The script was not entirely my creation and credit also goes to others. I’m quite certain any errors are likely mine. 😉
Updated: Now produces CalDAV-compliant TZIDs, no quotes.
Updated again: Now will move the .ics files from /tmp to the Trash.
Update 12/03/2008: Fixed the METHOD:PUBLISH invite to no longer ask to select which calendar to add event. It will automatically select the first local calendar, like it does with METHOD:REQUEST.
Updated 12/28/2008: Added ability to use single script with multiple Exchange servers. The trade-off is a slightly more complex set up.

iCal – Exchange Time Zone Fix – Part 2

I’ve come across a problem with the original MailExchange2iCal-TZ-fix script. It seems if the .ics invite was only listed as an attachment or in base64 encoding then the script would fail. I’ve subsequently revised the script to handle this and to more gracefully ask into which calendar you want the event imported.
I’ve also fixed the script so that it runs successfully from a rule.
Note: The ical_TZID property cannot have any spaces. Replace all spaces with underscores “_“. In iCal America/Los_Angeles will look like America/Los Angeles in the iCal dropdown menu.
Let me know if there are any problems.
As always you can download the MailExchange2iCal-TZ-fix script here.

Text and Quote Wrapping

If any of you find yourself using webmail you’ll know what I’m talking about. If you’re at all like me, you like to be able to follow the replies in an email thread. Using webmail the quoting and wrapping get screwed up quite easily.
I was looking for a simple way to rewrap, unwrap, increase the quote level, and decrease the quote level of any selection of text. I found that there were several good shareware programs that did this, and many other things. But I was really looking for a simple one-trick pony of sorts. So in the usual fashion I decided to roll my own. What I did was create a single shell script that when passed a parameter will do what you want to whatever is in the clipboard. It then replaces the clipboard with the changed text.
I call the package quote_changes. Go get it.
After you unzip it, put it in ~/Library/Scripts/. Activate your system-wide script menu from the AppleScript Utility.app.
The scripts are all meant to be in the same folder. The scripts that does all the work is change_quote.sh. The usage of the script is as follows:
$ change_quote.sh increase — will rewrap the text on the clipboard and increase the level of quoting (>). The additional scripts in the package are simply calls with the appropriate parameters. The full usage is
$ change_quote.sh (increase|decrease|rewrap|unwrap)
If anyone has any problems let me know. I hope others find this useful. Enjoy.