This has been a goal for many an Applescripter for a long time.
Not sure anyone has hit the holly grail without using a third party scripting app with a Spotlight indexer..
I have tried a few things in the past but this thread prompted me again to have another go.
I now normally try and save all my applescripts in one places, in a Scripts folder in my Documents folder and also use Hazel to watch place like my Documents folder and desktop for scpt files and move them into the Scripts folder.
My new idea is to run a shell script that will be passed a scpt file that is saved in my Normal scripts folder as a normal scpt file and use the shell command osadecompile to decompile and read the file. Then create a text version in my new Script Text folder.
The code I am using is:
fname=`basename "$1"`
echo "`osadecompile "$1"`" > "/Users/UserName/Documents/Scripts/Script Text/$fname".txt
Hazel conveniently uses $1 for the file path of the file being passed.
And I use the command basename to get the file name.
In Hazel it looks like this.
Notice I am using a date last modified condition with 5 minutes.
This is to try and catch any edits I do.
The nice thing I found is when I find the text file with the code I am looking for, I can either copy the text, refer to it, or find the scpt file easily because I have the same file name in the text file file name.
i.e
display iTunes artwork.scpt
display iTunes artwork.scpt.txt
This idea should be able to be used with other folder watching apps or hopefully give you some inspiration ...