macosapplescriptcontextmenufinder

Create File within Finder [MacBook Pro M2]


Is there a way to create files outside of applications, but within the finder? Preferably with the context menu.

All I found were mentions about a AppleScript, but it was hidden behind a Paywall...


Solution

  • Someone here gave you -1 because your question is not accurate. I will assume that you want to create a new empty file with the Finder to further fill it with some content. Here's how it's done.

    tell application "Finder"
        make new file at desktop with properties {name:"emptyFile.html"}
    end tell
    

    NOTE: you can indicate any other name extension (like ".txt") instead.

    Also, the desktop is default location, so you can to not indicate the location in the case you need create new file on it. Oneliner for this case:

    tell application "Finder" to make new file with properties {name:"empty.txt"}