I want to check if any of particular files (dictionaries) exist in "/Library/Dictionaries/". Here is my Applescript code lines:
tell application "Finder"
try
set theFolder to ("/Library/Dictionaries/")
set fileNames to {"dict1.dictionary", "dict2.dictionary", "dict3.dictionary", "dict_n.dictionary"}
on error
set fileNames to false
end try
if fileNames is not false then
try
display dialog "You have already got the dictionary."
end try
end if
end tell
Weirdly, the message You have already got the dictionary.
is always shown albeit no listed files exist.
My purpose is to check if any of the listed files exits, and if one or more of them exits then the message is to be displayed.
In fact, this script will be run as a Unix bash script via /usr/bin/osascript
, so I will be very grateful if you can help with either Apple script or Bash script.