-- http://macscripter.net/viewtopic.php?id=24776
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", "In File Name"} default button "In Content" with icon 1)
open (path to scripts folder from user domain)
end tell
-- Now GUI script that window for a search.
delay 0.5 -- wait for the Finder to get on with it.
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 -- wait for Sys Events to get to the right place before clicking.
click radio button 2 of radio group 1 of group 1 of group 1 of splitter group 1 of window 1
if Btn contains "File" then click radio button 2 of radio group 2 of group 1 of group 1 of splitter group 1 of window 1
end tell
http://macscripter.net/viewtopic.php?id=24776
Jag har ändrat lite i det så att det söker mer som man (jag) vill. Öppna i Skriptredigeraren och spara som app eller script och kör från dockan eller med FastScripts Lite:
property toFind : ""
tell application "Finder"
activate
try
set myN to name of window 1
set myDialog to "Sök i mappen ”" & myN & "”"
set myRadioButton to 2
on error
open startup disk
set myN to name of window 1
set myDialog to "Sök i Denna mac:"
set myRadioButton to 1
end try
set toolbar visible of window 1 to true
set {Btn, toFind} to {button returned, text returned} of (display dialog myDialog default answer toFind buttons {"Avbryt", "I innehåll", "I filnamn"} default button 3 with icon 1 giving up after 60)
end tell
-- Now GUI script that window for a search.
delay 0.5 -- wait for the Finder to get on with it.
tell application "System Events" to tell process "Finder"
set value of text field 1 of group 1 of tool bar 1 of window 1 to toFind
delay 0.5 -- wait for Sys Events to get to the right place before clicking.
click radio button myRadioButton of radio group 1 of group 1 of group 1 of splitter group 1 of window 1
if Btn contains "Filnamn" then click radio button 2 of radio group 2 of group 1 of group 1 of splitter group 1 of window 1
end tell