Applescript to make new folder

后端 未结 5 1110
死守一世寂寞
死守一世寂寞 2021-01-16 03:10

I Want to make a new Folder command in apple script

Why dosent this script work?

tell application \"Finder\"
activate
end tell
tell application \"Sys         


        
5条回答
  •  误落风尘
    2021-01-16 03:48

    You can directly with an applescript script by simulating keystroke on ("N" and command and shift) this will create a new folder on the desktop or in the open Finder window.

    Below the script, you can test it in the script editor

    tell application "System Events" to tell process "Finder"
        set frontmost to true
        keystroke "N" using {command down, shift down}
    end tell
    

    Your script works if you add under "tell process" Finder " "set frontmost to true" Which give

    tell application "System Events"
        tell process "Finder"
            set frontmost to true
                    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
    

提交回复
热议问题