on run tell application "System Events" set needs_restart to false if name of every application process contains "MarsEdit" then tell application "MarsEdit" to quit set needs_restart to true end if set plist to property list file "~/Library/Application Support/MarsEdit/Weblogs.plist" set arr to value of contents of plist set nms to {} repeat with w in arr set nms to nms & {|name| of w} end repeat set r to choose from list nms with prompt "Choose weblog to edit:" with title "MarsEdit weblogs" if (r is false) then return set blog to first item of r set dict to {} repeat with w in arr if |name| of w is equal to blog then set dict to w exit repeat end if end repeat set cats to categories of dict set c_name to "" repeat while c_name is equal to "" display dialog "Name of category" default answer "" set c_name to text returned of result end repeat set c_id to "" repeat while c_id is equal to "" display dialog "ID of category" default answer ((count of cats) + 1) set c_id to text returned of result end repeat set cats to cats & {{|categoryId|:c_id, |categoryName|:c_name}} set categories of dict to cats set value of contents of plist to arr if needs_restart then tell application "MarsEdit" to activate end tell end run