gpt4 book ai didi

applescript - 创建文件夹 Applescript

转载 作者:行者123 更新时间:2023-12-01 10:52:26 31 4
gpt4 key购买 nike

我有一个用于创建作业文件夹的 Applescript。 Applescript 要求提供项目名称和文件夹的存储位置。输入作业名称和文件夹位置后,脚本会创建主文件夹和四个子文件夹。

现在我希望脚本在当前子文件夹之一中创建带编号的子文件夹,并提示用户要创建多少个文件夹。这可能吗?

tell application "Finder"
set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name")
set loc to choose folder "Choose Parent Folder Location"
set newfoldername to JobName
set newfo to make new folder at loc with properties {name:newfoldername}
make new folder at newfo with properties {name:"Job Materials"}
make new folder at newfo with properties {name:"Previews"}
make new folder at newfo with properties {name:"PSDs"}
make new folder at newfo with properties {name:"VX"}
end tell

最佳答案

set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name")
set loc to choose folder "Choose Parent Folder Location"

tell application "Finder"
set newfo to make new folder at loc with properties {name:JobName}
make new folder at newfo with properties {name:"Job Materials"}
make new folder at newfo with properties {name:"Previews"}
set targetFolder to make new folder at newfo with properties {name:"PSDs"}
make new folder at newfo with properties {name:"VX"}
end tell

repeat
set subCount to text returned of (display dialog "How many subfolders?" default answer 3)
try
if subCount ≠ "" then
subCount as integer
exit repeat
end if
end try
end repeat

repeat with i from 1 to subCount
tell application "Finder" to make new folder at targetFolder with properties {name:"Subfolder " & i}
end repeat

关于applescript - 创建文件夹 Applescript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17432796/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com