我创建了一个AppleScript,它具有在我想要的地方创建文件夹的功能,然后在这个文件夹中放置许多空文本文件。
我想知道如何在执行此脚本的过程中创建一个窗口,说明脚本正确执行并询问我是否要使用简单的按钮在Finder中显示该文件夹。 / p>
我的剧本:
set folderName to text returned of (display dialog "Please enter the folder name:" default answer "Folder_Name")
set loc to choose folder "Choose Parent Folder Location"
tell application "Finder"
set newfolder to make new folder at loc with properties {name:folderName}
make new file at newfolder with properties {name:"fileA.txt"}
make new file at newfolder with properties {name:"fileB.txt"}
make new file at newfolder with properties {name:"fileC.txt"}
end tell
有可能吗?
所以,如果有可能的话,你能帮我吗?
答案 0 :(得分:1)
set folderName to text returned of (display dialog "Please enter the folder name:" default answer "Folder_Name")
set loc to choose folder "Choose Parent Folder Location"
try
tell application "Finder"
set newfolder to make new folder at loc with properties {name:folderName}
make new file at newfolder with properties {name:"fileA.txt"}
make new file at newfolder with properties {name:"fileB.txt"}
make new file at newfolder with properties {name:"fileC.txt"}
end tell
display dialog "Script executed correctly. Reveal Folder" buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel"
if button returned of the result = "OK" then
tell application "Finder"
reveal newfolder
activate
end tell
end if
end try