search your scripts quickly by contents

hold option down and click + which has changed into .

I can’t remember how I did this, but it’s there :wink:

Edit: Contents does the same job

Not for me, Stefan – but don’t beat it to death on my behalf; I’ll just continue to open the Scripts Folder itself (I have it in my sidebar) and search from the Finder Window and it’s probably the flakiness of GUI scripting causing the problem anyway. Thanks just the same.

I wrote a new GUI script that works on my machine without the savedSearch folder. Just goes after it in the Finder Window:

set toFind to text returned of (display dialog "Enter the word(s) to find in Scripts." default answer "" with icon 1)
set B to button returned of (display dialog "Contents or File Name?" buttons {"Content", "File Name"} with icon 1 default button 1)

tell application "Finder" to open (path to scripts folder from user domain)
delay 0.5
tell application "System Events" to tell process "Finder"
	set value of text field 1 of group 1 of tool bar 1 of window "Scripts" to toFind
	delay 0.5
	click radio button 2 of radio group 1 of group 1 of group 1 of splitter group 1 of window 1
	if B is "Content" then
		click radio button 1 of radio group 2 of group 1 of group 1 of splitter group 1 of window 1
	else
		click radio button 2 of radio group 2 of group 1 of group 1 of splitter group 1 of window 1
	end if
end tell

In a slightly better form (presents the choice of find in content or find in file name in the same dialog as the text to be fournd):

tell application "Finder"
	activate
	set {Btn, toFind} to {button returned, text returned} of (display dialog "Enter the word(s) to find in Scripts." default answer "" buttons {"Cancel", "In Content", "File Name"} default button "In Content" with icon 1)
end tell

tell application "Finder" to open (path to scripts folder from user domain)
delay 0.5
tell application "System Events" to tell process "Finder"
	set value of text field 1 of group 1 of tool bar 1 of window "Scripts" to toFind
	delay 0.5
	click radio button 2 of radio group 1 of group 1 of group 1 of splitter group 1 of window 1
	if Btn contains "Content" then
		click radio button 1 of radio group 2 of group 1 of group 1 of splitter group 1 of window 1
	else
		click radio button 2 of radio group 2 of group 1 of group 1 of splitter group 1 of window 1
	end if
end tell

No matter which method you use to quickly search for AppleScripts by filename or content (assuming you’re running Script Debugger 4 so script metadata is available), finding and installing a Quicklook plugin for AppleScripts makes finding what you want really efficient – just Quicklook at the files found to quickly identify the one you want. Great stuff.