Re: Simple rot-13 encoding script
Re: Simple rot-13 encoding script
- Subject: Re: Simple rot-13 encoding script
- From: Malcolm Fitzgerald <email@hidden>
- Date: Wed, 21 May 2003 12:45:49 +1000
At 5:27 PM -0700 20/5/03, Ashlin Aronin wrote:
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
There may be other problems but I can see that your repeat loop is not working.
set currentChar to 1
repeat until currentChar = (count allChars)
-- repeat loop
currentChar = currentChar + 1 -- wrong! returns true or false
set currentChar to currentChar + 1 -- right! increment currentChar by 1
end repeat
You can also say
repeat with i from 1 to (count allChars)
-- do something, e.g,
display dialog (item i of allChars)
end repeat
--
--
Malcolm Fitzgerald email@hidden
Database Manager
http://www.asauthors.org
The Australian Society of Authors ph: 02 93180877 fax: 02 93180530
_______________________________________________
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.