Applescript/Finder - 如何检查固定文件夹中是否存在可变文件夹

Applescript/Finder - how to check if a variable folder exists within a fixed folder

我正在尝试让脚本检查是否有可变文件夹名称,例如。 "folder x",从包含文件夹 a-z 的文件夹中显示?

脚本的其余部分工作正常,但问题是无论我到目前为止做了什么,我只得到 "yes" 作为这一行的结果 if exists folder theTitleCV of alias "Comics:" then.

到目前为止我的脚本:

set theTitleCV to "Folder X"
set theTitle to "Folder X-52"

--Creating the folder if it doesn't exists
tell application "Finder"
    if exists folder theTitleCV of alias "Comics:" then
        if theTitleCV is equal to theTitle then
            make new folder of alias "Comics:" with properties {name:theTitleCV}
        else
            set theTitleResult to ((display dialog "Title Options" buttons {theTitleCV, theTitle, "Cancel"} default button 2))
            set theButton to button returned of theTitleResult
            make new folder of alias "Comics:" with properties {name:theButton}
        end if
    else
        return "Yes"
    end if
end tell

在此先感谢您提供的任何帮助。

P.S。如果之前已经提出并回答过此类问题,请指出要搜索的内容的方向。谢谢:)

感谢所有提供帮助的人,尤其是 vadian 发现了明显的错误。

我现在已经修复了脚本并添加了一个显示对话框。

set theTitleCV to "Folder X"
set theTitle to "Folder X-52"


--Creating the folder if it doesn't exist
tell application "Finder"
    if not (exists folder theTitleCV of disk "Comics") then
        if theTitleCV is equal to theTitle then
            make new folder of disk "Comics" with properties {name:theTitleCV}
        else
            set theTitleResult to ((display dialog "Title Options" buttons {theTitleCV, theTitle} default button 2 with icon ":System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:GenericFolderIcon.icns" as alias))
            set theButton to button returned of theTitleResult
            make new folder of disk "Comics" with properties {name:theButton}
        end if
    else
        tell application "Finder" to activate
        return display dialog "" & return & "Thank you for checking," & return & "but this folder already exists." with title "Folder Already Exists" buttons {"OK"} default button 1 with icon ":System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:AlertNoteIcon.icns" as alias
    end if
end tell