-- Insert tags -- -- Grab the tags from the keyword field of the post -- and generate technorati tag links -- -- based on the MarsEdit insert itunes script -- Borrowed the formatting from -- http://www.johnsjottings.com/archives/2005/01/14/ -- technorati_tags_in_movable_type.html -- -- 1/21/05 Laura Lemay llemay@gmail.com global textToInsert on displayErrorMessage(s) display dialog (s) buttons {"OK"} default button "OK" with icon caution end displayErrorMessage tell application "MarsEdit" try set currentWindow to post window 1 on error errorMessage displayErrorMessage("CanŐt add tag info because no post windows are open. This script adds tag information to the frontmost post window.") of me return end try -- get the keywords out of the post set keys to words in keywords of currentWindow -- | set textToInsert to "
Technorati Tags: " repeat with theKey in keys set textToInsert to textToInsert & "" & theKey & " | " end repeat set textToInsert to textToInsert & "
" -- If the selected (highlighted) text is not empty, preserve it by -- prepending it to the text we're about to add. set selectionContents to selected text of post window 1 if selectionContents is not "" then set textToInsert to selectionContents & " " & textToInsert end if -- Replace the selected text with the new text set selected text of post window 1 to textToInsert end tell