A script just for fun
A script just for fun
- Subject: A script just for fun
- From: Michelle Steiner <email@hidden>
- Date: Wed, 17 Sep 2003 16:17:07 -0700
display dialog "Write a three digit number on a piece of paper. Click
OK to continue."
display dialog "Scramble the digits, and write the scrambled numbers on
a piece of paper. For example, if you originally wrote '123' then you
could scramble it as '312.' Click OK to continue."
display dialog "Subtract the smaller of the two numbers from the
larger, and write your answer on a piece of paper. Using the previous
example, 312 minus 123 is 189. Click OK to continue."
display dialog "Strike through one of the digits in your answer, and
enter the remaining digits, in any order, in this dialog. Click OK to
continue." default answer ""
set the digits to the text returned of the result
try
the digits as integer
on error
display dialog "You were supposed to enter integers only." buttons
{"Oh Heck"} default button 1
quit
end try
if length of the digits is 2 then
set interim to (first character of the digits as integer) * 10 +
(second character of the digits) as integer
set final_answer to 9 - interim
repeat until final_answer is greater than 0
set final_answer to final_answer + 9
end repeat
else
set final_answer to 9 - (character 1 of the digits) as integer
end if
display dialog "The number you struck through was " & final_answer as
text
--
"There's some good in the world, Mr. Frodo, and it's worth fighting
for."
_______________________________________________
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.