I have written a droplet that uses a shell script (from macosxhints) to identify potential duplicate files, this works beautifully on my laptop but fails on my desktop machine.
If I remove the "try" I get an applescript error that appears to be the names of duplicate files, so it looks like the "do shell script" is working (it also works in the Terminal) but for some reason I can't set the_results to the text returned from the shell script?
The script is shown below.
-- This uses
-- dupecheck - identify potential duplicates of a file using Spotlight metadata
to open the_file
set the_results to ""
set posix_path to quoted form of the POSIX path of the_file
set dup_path to (path to me as string)
set full_dup_path to dup_path & "Contents:Resources:Scripts:dupecheck"
set dup_path_posix to quoted form of the POSIX path of full_dup_path
set the_script to dup_path_posix & " " & posix_path
--display dialog the_script
try
set the_results to do shell script the_script
end try
if the_results = "" then
display dialog "No duplicates found"
else
set num_files to the number of paragraphs in the_results
display dialog "The number of duplicates is " & num_files & return & return & the_results buttons {"Finish", "Show All"} default button 2
if the button returned of the result is "Show All" then
repeat with i from 1 to num_files
set result_1 to paragraph i of the_results
--display dialog result_1
set the_dup_file to POSIX file result_1
--display dialog the_dup_file
tell application "Finder"
activate
select the_dup_file
end tell
end repeat
else
-- do nothing
end if
end if
end open