Created
January 15, 2015 17:03
-
-
Save mreis1/efcb2b5e96105866df61 to your computer and use it in GitHub Desktop.
Apple: Create text file at current folder from finder window
This file contains 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
http://apple.stackexchange.com/questions/129699/create-a-new-txt-file-in-finder-keyboard-shortcut | |
Open Automator, create a Service, set the input to "no input", Drag and Drop the "Execute AppleScript" Workflow Element onto the grey space, save the workflow; | |
Settings -> Keyboard -> Shortcuts -> Services, Assign a Shortcut | |
The Shortcut may not work, if it is assigned to an Apple-Intern Shortcut already. So be creative on choosing a new one. | |
Add this to the script: | |
try | |
tell application "Finder" to set the this_folder ¬ | |
to (folder of the front window) as alias | |
on error -- no open folder windows | |
set the this_folder to path to desktop folder as alias | |
end try | |
set thefilename to text returned of (display dialog ¬ | |
"Create file named:" default answer "filename.txt") | |
set thefullpath to POSIX path of this_folder & thefilename | |
do shell script "touch \"" & thefullpath & "\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment