「/Library/ Dictionary /」に特定のファイル(辞書)が存在するか確認したい。これが私のApplescriptコード行です:
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
You have already got the dictionary.
奇妙なことに、リストされたファイルが存在しない場合でも、メッセージは常に表示されます。
私の目的は、リストされたファイルのいずれかが存在するかどうかを確認することです。それらの1つ以上が存在する場合は、メッセージが表示されます。
実際、このスクリプトはを介してUnix bashスクリプトとして実行される/usr/bin/osascript
ので、AppleスクリプトまたはBashスクリプトのいずれかを手伝っていただければ幸いです。