Last active
August 29, 2015 14:12
-
-
Save jimmitchell/d58cbe8feee535d675d8 to your computer and use it in GitHub Desktop.
AppleScript to Add Empty Files in Finder Quickly
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
property defaultFileName : "newFile.txt" | |
tell me to activate | |
set theFileName to text returned of (display dialog "Enter a file name:" default answer defaultFileName) | |
tell application "Finder" | |
activate | |
if the (count of windows) is not 0 then | |
set theFolder to (folder of the front window) as text | |
set theFolder to POSIX path of theFolder | |
else | |
set theFolder to POSIX path of (get path to desktop) | |
end if | |
set addedFile to (theFolder & theFileName) | |
do shell script "touch '" & addedFile & "'" | |
if the (count of windows) is not 0 then | |
set addedFile to (POSIX file addedFile) as alias | |
select addedFile | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment