Skip to content

Instantly share code, notes, and snippets.

@swbuehler
Created December 26, 2015 19:03
Show Gist options
  • Save swbuehler/846e7720902d5c8b89e4 to your computer and use it in GitHub Desktop.
Save swbuehler/846e7720902d5c8b89e4 to your computer and use it in GitHub Desktop.
Reads separate .yaml file into Finder comments, deletes .yaml file.
tell application "Finder"
set theYAMLs to the selection
repeat with thisYAML in theYAMLs
set theName to the name of thisYAML
set theName to (text 1 thru -6 of theName)
set thePath to the POSIX path of (thisYAML as string)
repeat with thisExtension in {".pdf", ".tiff", ".tif", ".png", ".jpg"}
try
set theAssociatedFile to file (theName & thisExtension) of the folder of thisYAML
end try
end repeat
set the comment of theAssociatedFile to (do shell script "cat " & the quoted form of thePath)
move thisYAML to the trash
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment