Your QS scripts will be much easier from now on, Chris, because of
this tidbit: QS automatically puts the results returned from any
Applescript action into its first pane.
Thus you can accomplish your goal here—without messing around with the
qs command line tool and shell redirects—as follows:
using terms from application "Quicksilver"
on process text thequery
set r to do shell script ¬
"mdfind " & quoted form of thequery
set f to {}
repeat with p in every paragraph of r
set end of f to (POSIX file p) as alias
end repeat
return f
end process text
end using terms from
On Sep 17, 5:29 am, Chris Cairns <[email protected]> wrote:
> this script works:
> try
> tell me to activate
> set thequery to display dialog "Enter the search query:" default
> answer "" with title "Spotlight Search"
> set thequery to quoted form of text returned of thequery
> -------------------------------------------------------------------
> --display dialog thequery
> set ifolder to (path to documents folder from user domain)
> set ifolder to ifolder & "QSspotlight.txt" as text
> set qifolder to quoted form of (POSIX path of ifolder)
> -------------------------------------------------------------------
> set thecmd to do shell script "mdfind " & thequery
> set thecmd to quoted form of thecmd
> do shell script "echo " & thecmd & " > " & qifolder
> do shell script "qs " & qifolder
>
> on error e
> tell me to activate
> display dialog e
> end try
>
> but this script fails:
>
> using terms from application "Quicksilver"
> on process text thequery
> try
> set thequery to quoted form of thequery
>
> -------------------------------------------------------------------
> --display dialog thequery
> set ifolder to (path to documents folder from user
> domain)
> set ifolder to ifolder & "QSspotlight.txt" as text
> set qifolder to quoted form of (POSIX path of ifolder)
>
> -------------------------------------------------------------------
> set thecmd to do shell script "mdfind " & thequery
> set thecmd to quoted form of thecmd
> say 1
> do shell script "echo " & thecmd & " > " & qifolder
> say 2
> do shell script "qs " & qifolder
> say 3
> on error e
> tell me to activate
> display dialog e
> end try
> end process text
> end using terms from
>
> this part fails: do shell script "qs " & qifolder
> process "qs" in Activity monitor has to be quit to exit out of the
> script when it fails.