Applescript制作新文件夹

hel*_*elp 1 macos scripting applescript

我想在Apple脚本中创建一个新的Folder命令

为什么这个脚本有效?

tell application "Finder"
activate
end tell
tell application "System Events"
tell process "Finder"
    tell menu bar 1
        tell menu bar item "File"
            tell menu "File"
                click menu item "New folder"
            end tell
        end tell
    end tell
end tell
end tell
Run Code Online (Sandbox Code Playgroud)

mip*_*adi 25

您可以使用AppleScript直接执行此操作:

tell application "Finder"
    set p to path to desktop -- Or whatever path you want
    make new folder at p with properties {name:"New Folder"}
end tell
Run Code Online (Sandbox Code Playgroud)