# Change Text into a Number

I would like to make an applescript that takes text put in, converts each letter into a number, adds 5 different numbers to each number in order, and converts it back into text.
example code:

``````display dialog "Meaasge" default answer "text"
convert each letter a to 1
convert each letter b to 2 ect.
add 5 to the first letter
add 1 to the next letter
add 9 to the next letter
... repeat until each number has been changed once (not going over 26!)
convert 1 back to a
convert 2 back to b...ect.
``````

You don’t provide enough information. What are you trying to do? Will the text contain capitals as well as lowercase letters? Will it contain non-alpha characters? What is the full list of numbers that will be added? Is there a pattern? Maybe it would help if you actually gave an example of what you wanted to do in English with the results. Is this for some sort of encryption routine kind of like a ROT-13?

Jon

something like
message: er
code:51
(e=5)
(r=18)
5+5 (e+5)=10
18+1 (r+1)=19
message = 10-19
result: j-s

Well, I still don’t fully understand but this should help:

Jon

[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

something like

``````set a to 1
set b to 2
set c to 3
set d to 4
set e to 5
set f to 6
set g to 7
set h to 8
set i to 9
set j to 10
set k to 11
set l to 12
set m to 13
set n to 14
set o to 15
set p to 16
set q to 17
set r to 18
set s to 19
set t to 20
set u to 21
set v to 22
set w to 23
set x to 24
set y to 25
set z to 26
display dialog "text" default answer ""
set aa to text returned of result
set character "a" of aa to (variable) a
``````

then change 1 to 2, 2 to 3, 26 to 1 ect

Yes, that’s what the “convert_characters_to_numbers” subroutine does:

Try the whole script I posted above using an input string of “abc” and a code of “111” that will rotate all the letters one position so the output will be “bcd”.

Jon

[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

its good but can you make it so the string will repeat until its all changed? also, i need to decrypt it, how would i?