Automator Plugin Script: Archive to...
 Posted: Wed Apr 09, 2008 1:18 pm
Posted: Wed Apr 09, 2008 1:18 pmHere's the script for the Automator plugin I mentioned here.
It should work without modification, but you might want to read the thread at Apple discussions.
Install SpotMeta's CLI utility from its prefs window.
Set up the archiving attributes in SpotMeta before using the plugin.
As far as I can tell the plugin will set the attributes correctly without setting them up first, but SpotMeta will not show them, as they are not in its Definitions file.
There could be some confusion when you take a look in SpotMeta...
			It should work without modification, but you might want to read the thread at Apple discussions.
Install SpotMeta's CLI utility from its prefs window.
Set up the archiving attributes in SpotMeta before using the plugin.
As far as I can tell the plugin will set the attributes correctly without setting them up first, but SpotMeta will not show them, as they are not in its Definitions file.
There could be some confusion when you take a look in SpotMeta...
- Code: Select all
- (*
 Archive to...
 script for an automator plugin
 uses SpotMeta <http://www.fluffy.co.uk/spotmeta/>
 some help from "red_menace" <http://discussions.apple.com/thread.jspa?messageID=6854368>
 
 Actions in workflow:
 * get Finder selection
 * run script
 * view results (does nothing, but read thread)
 * move Finder selection
 *)
 on run {input, parameters}
 -- input: a list of items received from the previous action
 -- output: a list of items passed on to the next action
 
 set output to {} --to catch input
 set theCmd to "spotmeta set " -- talk to SpotMeta's CLI utility
 
 -- format date attribute, date = current date
 set dateAttr to "d:archiveDate='now' " -- say 'current date' to SpotMeta
 
 -- get archive category from user
 set archiveCategories to {"Archive", "Reference", "Software"}
 set archiveCategory to choose from list archiveCategories with prompt "Select one category:" with title "Archiving to..." without multiple selections allowed
 
 if archiveCategory is not false then -- user made selection
 set archiveAttr to "c:archiveCategory=" & archiveCategory-- format archiveCategory attribute
 set theCmd to theCmd & dateAttr & archiveAttr-- add attributes to cmd string
 
 repeat with anItem in input -- set attributes on passed items
 set end of output to (anItem as alias) -- workflow does not move files when script passes references
 set theCmd to theCmd & " " & quoted form of POSIX path of (anItem as alias) -- add filepath to cmd string
 do shell script theCmd -- set attributes
 end repeat
 
 else -- user pressed cancel
 set output to {} -- complete workflow without moving files
 end if
 return output
 end run