View Single Post
02-28-2007   #3 (permalink)
NotVeryPC
Operator
 
Join Date: Dec 2006
Posts: 9
NotVeryPC has disabled reputation
With help from MacScripter.net, here's the finished scritp:

Code:
set QuicksilverTags to (path to home folder as string) & "Library:Caches:Quicksilver:Indexes:QSPresetQSFileTagsPlugIn.qsindex"

do shell script "grep string " & (quoted form of POSIX path of QuicksilverTags) & " | awk {'print $1'}"

set theTags to result

--> From the MacScripter.net Text Delimiters Tutorial.
set newText to switchText of theTags from "<string>qs.tag.file</string>" to ""
to switchText of currentText from SearchString to ReplaceString
	set storedDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to SearchString
	set currentText to currentText's text items
	set AppleScript's text item delimiters to ReplaceString
	set currentText to currentText as Unicode text
	set AppleScript's text item delimiters to storedDelimiters
	
	currentText
	
	set this_text to currentText
	
	set new_text to ""
	
	--> From the MacScripter Forum.
	repeat with myPara in paragraphs of this_text
		if new_text does not contain myPara then set new_text to new_text & myPara & return
	end repeat
	set new_text to (characters 1 thru -2 of new_text) as text
	
	set more_text to new_text
	set replace_text to ""
	
	--> From MacScripter Forum.
	repeat with myPara in paragraphs of more_text
		
		if replace_text does not contain myPara then set replace_text to replace_text & (text 9 thru -10 of myPara) & return
	end repeat
	
	set output to "Tags: " & return & replace_text
	
end switchText -- the end of the handler.
Just call it from GeekTool.
NotVeryPC is offline   Reply With Quote