• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Simple rot-13 encoding script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple rot-13 encoding script


  • Subject: Simple rot-13 encoding script
  • From: Ashlin Aronin <email@hidden>
  • Date: Tue, 20 May 2003 17:27:55 -0700

Hello all! I made this simple script to encode rot-13, but it isn't
working. Here's my code:

set currentChar to 1
display dialog "rot-13" with icon note default answer "" buttons ["Cancel",
"OK"] default button 2
if (text returned of result) is not equal to "" then
set the message_text to (text returned of result)
else
display dialog "You didn't enter anything." buttons ["OK"] default
button 1
quit
end if

set AppleScript's text item delimiters to ""
set allChars to every text item of the message_text


repeat until currentChar = (count allChars)
set allChars to replace_chars(item currentChar of allChars, "a", "n")
set allChars to replace_chars(item currentChar of allChars, "b", "o")
set allChars to replace_chars(item currentChar of allChars, "c", "p")
set allChars to replace_chars(item currentChar of allChars, "d", "q")
set allChars to replace_chars(item currentChar of allChars, "e", "r")
set allChars to replace_chars(item currentChar of allChars, "f", "s")
set allChars to replace_chars(item currentChar of allChars, "g", "t")
set allChars to replace_chars(item currentChar of allChars, "h", "u")
set allChars to replace_chars(item currentChar of allChars, "i", "v")
set allChars to replace_chars(item currentChar of allChars, "j", "w")
set allChars to replace_chars(item currentChar of allChars, "k", "x")
set allChars to replace_chars(item currentChar of allChars, "l", "y")
set allChars to replace_chars(item currentChar of allChars, "m", "z")
set allChars to replace_chars(item currentChar of allChars, "n", "a")
set allChars to replace_chars(item currentChar of allChars, "o", "b")
set allChars to replace_chars(item currentChar of allChars, "p", "c")
set allChars to replace_chars(item currentChar of allChars, "q", "d")
set allChars to replace_chars(item currentChar of allChars, "r", "e")
set allChars to replace_chars(item currentChar of allChars, "s", "f")
set allChars to replace_chars(item currentChar of allChars, "t", "g")
set allChars to replace_chars(item currentChar of allChars, "u", "h")
set allChars to replace_chars(item currentChar of allChars, "v", "i")
set allChars to replace_chars(item currentChar of allChars, "w", "j")
set allChars to replace_chars(item currentChar of allChars, "x", "k")
set allChars to replace_chars(item currentChar of allChars, "y", "l")
set allChars to replace_chars(item currentChar of allChars, "z", "m")
currentChar = currentChar + 1
end repeat
display dialog allChars buttons ["OK"] default button 1


on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars


Can anyone tell me what's wrong?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Simple rot-13 encoding script
      • From: Paul Skinner <email@hidden>
    • Re: Simple rot-13 encoding script
      • From: Jon Pugh <email@hidden>
    • Re: Simple rot-13 encoding script
      • From: Malcolm Fitzgerald <email@hidden>
    • Re: Simple rot-13 encoding script
      • From: Michelle Steiner <email@hidden>
    • Re: Simple rot-13 encoding script
      • From: Martin Crisp <email@hidden>
  • Prev by Date: Re: applescript-users digest, Vol 3 #1681 - 15 msgs
  • Next by Date: Re: Simple rot-13 encoding script
  • Previous by thread: Re: applescript-users digest, Vol 3 #1681 - 15 msgs
  • Next by thread: Re: Simple rot-13 encoding script
  • Index(es):
    • Date
    • Thread