Skip to content

Instantly share code, notes, and snippets.

@poritsky
Created September 2, 2015 16:46
Show Gist options
  • Save poritsky/d255510d1b8a36dce521 to your computer and use it in GitHub Desktop.
Save poritsky/d255510d1b8a36dce521 to your computer and use it in GitHub Desktop.
Copy selected file name without extension to comments.
tell application "Finder"
set theFile to selection as alias
tell application "System Events" to tell disk item (theFile as text) to set {theName, theExtension} to {name, name extension}
if theExtension is not "" then set theName to text 1 thru -((count theExtension) + 2) of theName -- the name part
set comment of theFile to theName
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment