I am searching for a file or directory. But when “theResult” is null, I get a applescript error - “Error of Type 1 has occurred (1).” This error occurs on the ‘set theResult…’ line of code below. Why the error? How do I avoid?
TIA
on getShellResults(theWindow)
set theSearchString to (contents of text field "search" of theWindow as string)
set theWD to "/Library/Application Support/"
set theResult to do shell script ("ls -a1 " & quoted form of theWD & " | grep -i '.*" & theSearchString & ".*'")
popTable(theResult, theWD)
end getShellResults