tell application "AppleScript Editor"
set the_script_text to contents of document 1 as text
get properties of document 1 of window 1
save document 1
set thePath to get path of document 1
set existsPath to false
repeat while existsPath is false
set thePath to get path of document 1
try
set savePath to thePath
set existsPath to true
on error
set existsPath to false
end try
end repeat
my setComm((thePath), the_script_text)
end tell
on setComm(this_item, the_script_text)
tell application "Finder"
set comment of (alias (POSIX file this_item as Unicode text)) to the_script_text
end tell
end setComm
I use Spark to create an Applescript-Action for AppleScript-Editor, call it "Sichern" (German localization) choose <cmd-s> as keyboard-shortcut and from now on the AS-Text is written into the Comment of the File and gets therefor Spotlight-searchable.
hth
demski
Am 13.06.2012 um 10:50 schrieb demski:
Hi,
unfortunately neither I recall the source nor where to find it (just googled a bit)
but there was a nifty little script that I managed to be run instead of AppleScript Editor's save Command which saved the whole text of the AS to the Spotlight Comments of the .scpt File.
Therefor the Script text was fully searchable...
Unfortunately I lost this little helper during machine/system changes...
But maybe someone of you finds it before I make my own?
hth, demski