13 Replies Latest reply: Feb 22, 2013 7:59 AM by red_menace
MattJayC Level 1 Level 1 (0 points)

I've been using this script, it returns back the number of photos either on of us has done. I've noticed that there are a lot not accounted for.

 

this is how I can search through spotlight

Screen shot 2013-02-21 at 14.35.39.png

As you may be able to see there are over 500. This is as it is shown in the content creator how can i pull out this bit of info using mdfind?

Many Thanks

 

Matt

 

 

 

 

set thekinds to ""

set the preEdit to {"Music"}

set spotlightqueryList2 to {"Shot_by_Matthew", "Shot_by_Shah"}

set tc2 to count spotlightqueryList2

set theseCount2 to {}

repeat tc2 times

          set end of theseCount2 to 0

end repeat

 

repeat with k in preEdit

          set thepath2 to my existsItem(tHome & k)

          if thepath2 is not "" then -- exists

                    repeat with l from 1 to tc2

                              set tQuery to item l of spotlightqueryList2

                              do shell script "mdfind -onlyin " & thepath2 & " " & tQuery & " " & thekinds & " | wc -l" -- wc return the number of lines

                              set item l of theseCount2 to (item l of theseCount2) + (the result as integer) -- add the number of lines

                    end repeat

          end if

 

end repeat

 

 

set csvPath to "DCKGEN:Brands:Zoom:Online Photography:" & csvFileName

set oTID to text item delimiters

set text item delimiters to "," -- CSV delimiter

set thisLine2 to (theseCount2 as text) -- convert list to text, each number is separated by comma

 

set text item delimiters to oTID

 

 

set csvPath to "DCKGEN:Brands:Zoom:Online Photography:" & csvFileName

set oTID to text item delimiters

set text item delimiters to "," -- CSV delimiter

 

set thisLine2 to (theseCount2 as text) -- convert list to text, each number is separated by comma

set text item delimiters to oTID

 

--- append this line to CSV file

do shell script "echo " &  (quoted form of thisLine2) & " >>" & quoted form of POSIX path of csvPath