Hey all.
I’ve cobbled together my first “original” script. I have to credit this to my fellow posters here, who have given me direct guidance and whose past posts I’ve studied as I develop my - still elementary - scripting technique.
I’m attempting to make aliases of files in a directory and dump them in a common folder. The hitch is excluding a list of files and that’s where I’ve gotten hung up. I just want to have it use a list of files for the script to ignore when making the aliases.
Here’s what I’ve come up with. I think I’m pretty close, but the script just doesn’t seem to know what to do with the “allList” variable - the one from which the file names will be excluded.
Anyhow, thanks for all your help thus far. Please find the script below.
tell application "Finder"
set folderRef to (make new folder at desktop with properties {name:"Not In Their List"})
set fileRef to (choose folder) as string
set textFile to (choose file of type "TEXT") as text
-- Exclude list
set excludedList to paragraphs of (read file textFile)
tell application "Finder" to set allList to every item of fileRef whose name is not in excludedList
set pSF to POSIX path of fileRef
set tPaths to {}
repeat with aFile in excludedList -- a form that's faster because you don't have to count the list
try
set end of tPaths to POSIX file (do shell script "mdfind -onlyin " & pSF & space & quoted form of aFile) as alias
on error -- no file by that name was found in the searchfolder.
set end of tPaths to aFile & " N/A"
end try
end repeat
make new alias file at folderRef to every item of allList
repeat with i from 1 to number of items in allList
end repeat
end tell