Remove this ad
avatar

ericn

superstar

Posts: 284

Lead

Jul 25 10 10:30 PM

Tags : :

The search box in Finder drives me nuts. It only looks for files in Apple approved folders, and so it is useless when I am looking for a system or a preference file. Hence some time back, I made an AppleScript which searches across the entire disk (minus some secure folders) for files with names matching some text and, then, returns the results in a TextEdit document window. I call this AppleScript Locate:


tell application "System Events"

 activate

 set thePattern to text returned of (display dialog "Search for" default answer "")

end tell

if thePattern = "" then return

try

set foundFiles to do shell script "mdfind -name " & quoted form of thePattern & " | /usr/bin/egrep -i " & quoted form of thePattern & "[^/]*/?$ | /usr/bin/grep -vi " & quoted form of thePattern & ".*" & quoted form of thePattern

on error

set foundFiles to "Nothing Returned"

end try

if foundFiles = "" then set foundFiles to "Nothing Returned"


tell application "TextEdit"

activate

delay 0.5

try

set theDoc to document 1

get text of theDoc

if result is not "" then

make new document

set theDoc to result

end if

on error

make new document

set theDoc to result

end try

set text of theDoc to foundFiles

end tell


I attached this script to an Abracadabra gesture:



(For more info on Abracadabra see: Pen Gestures on the Modbook and Pen Gestures on the Modbook Part Two.)


You could also use the script with FlyGesture or Butler.



Once you have the search results such as these results for "quickclicks", 



You can highlight the file you are interested in and use the context menu (control-click) to reveal the file in Finder.




EricN

Quote    Reply   
Remove this ad
Remove this ad
avatar

ericn

superstar

Posts: 284

#1 [url]

Jul 29 10 2:39 PM


A good use for this AppleScript:
Find and delete all the Flash cookies on your Mac.

Since Flash cookies all have the same extension (.sol), they are easy to find. Just use .sol as your search term in the Locate script above.

Quote    Reply   
Add Reply

Quick Reply

bbcode help