Originally published on 2017-09-28
Quite often I need to convert text in OSX buffer to uppercase.
This simple AppleScript does the trick.
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
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 |