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



我正在尝试让脚本检查是否有一个可变文件夹名称,例如"文件夹x",存在于一个包含文件夹a-z的文件夹中?

脚本的其余部分运行良好,但问题是,无论我到目前为止做了什么,我都只能得到这行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

提前感谢您提供的任何帮助。

附言:如果这类问题以前被问过并回答过,请告诉我该搜索什么。谢谢:(

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

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

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

相关内容

  • 没有找到相关文章

最新更新