Is it possible to write a short applescript or something to convert a files keywords and spotlight comments to tags?
Spotlight and keywords to tags?
Submitted by Ziggamorph on February 18, 2007 - 11:22.
Is it possible to write a short applescript or something to convert a files keywords and spotlight comments to tags? |
Hm, I'm not sure I
Hm, I'm not sure I understand that fully. Do you mean the ###begin_tags###.. section? Did you accidentally delete the tag database?
In future Punakea versions we are planning to include a backup in the file system, so that tags can be restored if they get lost. I don't know if it is a good idea to convert the kMDItemKeywords, though, as some apps put quite a lot of keywords there, that could get a little messy :)
As I understand it,
As I understand it, Ziggamorph wanted an option to convert plain keywords already entered into the spotlight comments field (like "one two three") to Punakea tags ("###begin_tags###@one;@two;@three;###end_tags###").
Hm. Yes, would be possible,
Hm. Yes, would be possible, but I think we will concentrate on the main app for the time being. Perhaps some user who knows applescript can do this? ;)
Actually, this might be a
Actually, this might be a way of getting Punakea off the ground - everyone who has already used tags in Spotlight comments would want to "import" them into any new app such as Punakea. So if you offered a scanning mechanism that would read, for example, comments with a certains prefix (e.g. the ampersand) and turn them into Punakea tags, you'd have a lot of happy users which could switch to Punakea instead of starting a whole new line of tags with their files.
This might be a good idea
This might be a good idea actually. But, as we have previously said, we are really hoping that leopard will make all of this spotlight comment workaround stuff unnecessary. If not, there will be a way to change how the comments look - and maybe a nice importer :)
"But, as we have previously
"But, as we have previously said, we are really hoping that leopard will make all of this spotlight comment workaround stuff unnecessary. If not, there will be a way to change how the comments look - and maybe a nice importer :)"
"we're hoping that Leopard supports a more sophisticated way to store tags on a file than just the workaround with the Spotlight comments. Hopefully we'll get some brandnew update on Leopard's Spotlight at WWDC starting June 11."
Now that you've been to WWDC & the (feature complete) Leopard beta is out any news on if there be a new tagging method in there?
And if not any news on if we'll be able to choose our own delimiters (e.g. the & symbol) in a future version?
Hm, I think we will stay
Hm, I think we will stay with the old way, and improve on that (different prefixes etc.) ;)
So in the future we'll be
So in the future we'll be able to use the & as a prefix?
If so that'd be great :)
We plan to at least :D
We plan to at least :D
Excellent, I'll be one happy
Excellent, I'll be one happy bunny, thanks :)
Here is a subroutine for
Here is a subroutine for some scripts I have been writing the past couple days. As I wrote this to process tags typed into a dialog box as part of a larger script, it only processes tag string separated by a ", " though it wouldn't be too hard to modify it a bit for other formats.
Johannes, I'm just starting to learn objective-c, so taking advantage of the framework is probably not an option right now, but having downloaded a file and tagged it using this subroutine, is there any easy way for me to notify punakea of the additions to that it can add new tags to its library?
-- Punakea's formatproperty tagPrepend : " ###begin_tags###"
property tagAppend : "###end_tags### "
property tagPrefix : "@"
property tagSeparator : ";"
-- the Call
set the_tags to my formatTags(the_tags)
-- The subroutine
on formatTags(fileTags)
if fileTags is not "" then
set currentDelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to ", "
set tagString to tagPrepend -- Adding the string prefix for Punakea
repeat with i from 1 to the count of text items of the fileTags
set thisTag to text item i of the fileTags
set tagString to tagString & (tagPrefix & thisTag & tagSeparator)
end repeat
set tagString to tagString & tagAppend -- Adding the string suffix for Punakea
set AppleScript's text item delimiters to ""
set AppleScript's text item delimiters to currentDelimiter
end if
return tagString
end formatTags
The new Punakea version has
The new Punakea version has a menu entry for rebuilding the tag database from the Finder Comments. This might be a bit of an overkill, though.
Using the framework to do this is really easy, though, you could simply call a method to have the tag created in the tag database, Punakea will notice any changes made to the database by external means. This is easy even if you don't have any experience in ObjC, you would simply follow the 'hands on' part in our 'for developers' section and create a new tag. This will work as soon as Punakea 0.4 and the new framework is out, which shouldn't be too long!