Created
July 28, 2026 21:30
-
-
Save codejake/3aa2e269b42fb73a908f3e6085e5756c to your computer and use it in GitHub Desktop.
new-text-file.applescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on run {input, parameters} | |
| tell application "Finder" | |
| if (count of Finder windows) > 0 then | |
| set destinationFolder to target of front Finder window | |
| else | |
| set destinationFolder to desktop | |
| end if | |
| set fileName to "Untitled.txt" | |
| set counter to 2 | |
| repeat while exists file fileName of destinationFolder | |
| set fileName to "Untitled " & counter & ".txt" | |
| set counter to counter + 1 | |
| end repeat | |
| set newFile to make new file at destinationFolder ¬ | |
| with properties {name:fileName} | |
| select newFile | |
| activate | |
| end tell | |
| return input | |
| end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment