To download the lselect4QS action direct, go here: http://tr.im/CJcd
Description:
        Select files in the current Finder folder using shell glob syntax.
        The "ls" command line utility is used to determine which files match
        the pattern, and then they are selected.

For more info on lselect, glob selection, etc
        go to anoved's site http://anoved.net/software/lselect/

Where to Save:
~/Library/Application Support/Quicksilver/Actions

Usage:
To Use activate Quicksilver in text entry mode via trigger or by
normal QS
         activate and typing a period. Type your lselect search exactly as
you would
         anoved's lselect applescript.

        If you want to add to what is already selected in the Finder prior
        to invoking Quicksilver: type a "+" before your search.
        So "+silver" would add any files with silver in their name to current
selection.
Code:
[
using terms from application "Quicksilver"
        on process text qtxt
                set myselections to my lselect(qtxt)
                return ""
        end process text
end using terms from
on lselect(intxt)
        if (count of words of intxt) > 1 then
                set AppleScript's text item delimiters to " "
                set inlst to every text item of intxt
                set AppleScript's text item delimiters to ""
                set usePath to ""
                set selQues to ""
                repeat with j from 1 to count of inlst
                        set thsTxt to item j of inlst
                        if (thsTxt contains "/") then
                                set usePath to thsTxt
                        else
                                if ((count of selQues) > 0) then
                                        set selQues to selQues & " " & thsTxt
                                else
                                        set selQues to thsTxt
                                end if
                        end if
                end repeat
                set query to quoted form of selQues
                if ((count of usePath) > 0) then
                        set newPath to usePath as POSIX file
                        tell application "Finder"
                                try
                                        set newWin to make new Finder window to 
newPath
                                        set current view of newWin to column 
view
                                on error
                                        set newWin to make new Finder window to 
folder "Desktop" of home
                                end try
                                activate
                        end tell
                        set pwdAlias to my getpwd()
                else
                        set pwdAlias to my getpwd()
                end if
        else
                set query to intxt
                set pwdAlias to my getpwd()
        end if
        set pwd to POSIX path of pwdAlias
        tell application "Finder"
                if query = "" then return
                if character 1 of query is not "+" then
                        set selectables to {}
                        try
                                tell me to set matches to do shell script 
("/bin/ls " & quoted
form of pwd & " | grep -i " & query)
                        on error
                                return
                        end try
                        repeat with matchpath in paragraphs of matches
                                set matchpath to pwd & matchpath
                                set posixmatch to matchpath as POSIX file
                                try
                                        set fileinfo to info for posixmatch 
without size
                                        if visible of fileinfo then set end of 
selectables to posixmatch
                                end try
                        end repeat
                        try
                                select every item of selectables
                                --activate
                                --display dialog (count of selectables)
                                if (count of selectables) > 0 then
                                        return selectables as list
                                else
                                        return
                                end if
                        on error
                                return
                        end try
                else
                        try
                                set selectables to selection
                                try
                                        if selection as alias is equal to 
pwdAlias then set selectables
to {}
                                end try
                        on error
                                set selectables to {}
                        end try
                        if (count of query) > 1 then
                                set query to characters 2 thru (count of intxt) 
of intxt as string
                        else
                                return
                        end if
                        try
                                tell me to set matches to do shell script 
("/bin/ls " & quoted
form of pwd & " | grep -i " & query)
                        on error
                                return
                        end try
                        repeat with matchpath in paragraphs of matches
                                set matchpath to pwd & matchpath
                                set posixmatch to matchpath as POSIX file
                                try
                                        set fileinfo to info for posixmatch 
without size
                                        if visible of fileinfo then set end of 
selectables to posixmatch
                                end try
                        end repeat
                        try
                                select every item of selectables
                                if (count of selectables) > 0 then
                                        return selectables
                                else
                                        return
                                end if
                        on error
                                return
                        end try
                end if
        end tell
end lselect
on getpwd()
        tell application "Finder"
                try
                        set pwdAlias to (the target of the front window) as 
alias
                on error
                        set newWin to make new Finder window to folder 
"Desktop" of home
                        set pwdAlias to (the target of the front window) as 
alias
                end try
        end tell
        return pwdAlias
end getpwd
]

Reply via email to