Originally published on 2017-09-28

Quite often I need to convert text in OSX buffer to uppercase.
This simple AppleScript does the trick.

set clipdata to get the clipboard as text
set the clipboard to my change_case(the clipdata, "upper")
on change_case(this_text, this_case)
if this_case is "lower" then
set the new_text to do shell script "echo " & quoted form of (this_text) & " | tr A-Z a-z"
else
set the new_text to do shell script "echo " & quoted form of (this_text) & " | tr a-z A-Z"
end if
return the new_text
end change_case