Hello all!
I am writing a script that “encrypts” a string so that a person without the script can’t read it. Here is the script, where t equals the string “Hello” :
on jassic(t)
set q to {}
considering case
set AppleScript's text item delimiters to {""}
set q to every text item of t
repeat with x from 1 to (count q)
if item x of q is "a" then set item x of q to "w"
if item x of q is "b" then set item x of q to "v"
if item x of q is "c" then set item x of q to "u"
if item x of q is "d" then set item x of q to "t"
if item x of q is "e" then set item x of q to "s"
if item x of q is "f" then set item x of q to "r"
if item x of q is "g" then set item x of q to "q"
if item x of q is "h" then set item x of q to "p"
if item x of q is "i" then set item x of q to "o"
if item x of q is "j" then set item x of q to "n"
if item x of q is "k" then set item x of q to "m"
if item x of q is "l" then set item x of q to "l"
if item x of q is "m" then set item x of q to "k"
if item x of q is "n" then set item x of q to "j"
if item x of q is "o" then set item x of q to "i"
if item x of q is "p" then set item x of q to "h"
if item x of q is "q" then set item x of q to "g"
if item x of q is "r" then set item x of q to "f"
if item x of q is "s" then set item x of q to "e"
if item x of q is "t" then set item x of q to "d"
if item x of q is "u" then set item x of q to "c"
if item x of q is "v" then set item x of q to "b"
if item x of q is "a" then set item x of q to "a"
if item x of q is "x" then set item x of q to "z"
if item x of q is "y" then set item x of q to "y"
if item x of q is "z" then set item x of q to "x"
--uppercase
if item x of q is "A" then set item x of q to "W"
if item x of q is "B" then set item x of q to "V"
if item x of q is "C" then set item x of q to "U"
if item x of q is "D" then set item x of q to "T"
if item x of q is "E" then set item x of q to "S"
if item x of q is "F" then set item x of q to "R"
if item x of q is "G" then set item x of q to "Q"
if item x of q is "H" then set item x of q to "P"
if item x of q is "I" then set item x of q to "O"
if item x of q is "J" then set item x of q to "N"
if item x of q is "K" then set item x of q to "M"
if item x of q is "L" then set item x of q to "L"
if item x of q is "M" then set item x of q to "K"
if item x of q is "N" then set item x of q to "J"
if item x of q is "O" then set item x of q to "I"
if item x of q is "P" then set item x of q to "H"
if item x of q is "Q" then set item x of q to "G"
if item x of q is "R" then set item x of q to "F"
if item x of q is "S" then set item x of q to "E"
if item x of q is "T" then set item x of q to "D"
if item x of q is "U" then set item x of q to "C"
if item x of q is "V" then set item x of q to "B"
if item x of q is "W" then set item x of q to "A"
if item x of q is "X" then set item x of q to "Z"
if item x of q is "Y" then set item x of q to "Y"
if item x of q is "Z" then set item x of q to "X"
end repeat
end considering
set returnString to q as string --return it as a string, not a list
return returnString
end jassic
The result is “Helli”
Only the last character, “o”, was changed.
No errors are thrown, and I have done a script similar to this before and it worked.
Could anyone point out what I am doing wrong? I think its a human error. Thanks for your help!