Last active
March 24, 2025 17:25
-
-
Save visualkom/9a47dd5f8fbc0e64961b to your computer and use it in GitHub Desktop.
[ROT13 service for Mac OS X] #mail #html
This file contains hidden or 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
# ROT13 service for Mac OS X | |
# | |
# Adds a ROT13 option to the text selection context menu in all apps | |
# | |
# Use Automator.app to create a new service, and then select the Run AppleScript | |
# action. Select the "Output replaces selected text" option. Paste this code in | |
# to the text box, and save as ROT13. Now switch to a new app, select some text, | |
# and open the context menu to find the new option. | |
# | |
# Based on code found at: | |
# | |
# http://rosettacode.org/wiki/Rot-13#AppleScript | |
# | |
# Original code licenced under the GNU Free Documentation License 1.2. | |
# | |
# For my modifications: | |
# | |
# Copyright 2013, Noah Slater <[email protected]> | |
# | |
# Copying and distribution of this file, with or without modification, are | |
# permitted in any medium without royalty provided the copyright notice and this | |
# notice are preserved. This file is offered as-is, without any warranty. | |
on run {input, parameters} | |
set input to input as string | |
set output to "" | |
if length of input is greater than 0 then | |
repeat with char in (characters of input) | |
if (char ≥ "a" and char ≤ "m") or (char ≥ "A" and char ≤ "M") then | |
set char to character id ((id of char) + 13) | |
else if (char ≥ "n" and char ≤ "z") or (char ≥ "N" and char ≤ "Z") then | |
set char to character id ((id of char) - 13) | |
end if | |
set output to output & char | |
end repeat | |
end if | |
return output as text | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment