• 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
A script just for fun
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: Hex > Text
  • Next by Date: debugging Quark 4 script for osx
  • Previous by thread: Re: Quark 6 applescript problem
  • Next by thread: Re: A script just for fun
  • Index(es):
    • Date
    • Thread