• 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
Re: How to calculate/process this one?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to calculate/process this one?


  • Subject: Re: How to calculate/process this one?
  • From: Martin Michel <email@hidden>
  • Date: Sat, 27 Apr 2002 16:21:34 +0200

Hi,

thanks to everybody who posted routines so far. I do not yet know how they all work in detail, some of them are doing stuff I have never seen. I guess it is time for taking another learning lesson.

So far there are only two problems:

1) The one that MrTea mentioned: Sometimes I get an error telling me that X cannot be made into an integer.
b) Sometimes the numbers are not getting smaller and smaller by the time but bigger and bigger. I do not know how to get rid of this problem.

Please, don't get me wrong: I am very happy that all of you are trying to help me and I appreciate your efforts a lot. After all, it is saturday ;-) But I did not much calculating with AppleScript in the past, so I do not know how to solve my problems.

With very kind regards,

Martin

Please excuse my English, I am not a native speaker.

Am Samstag den, 27. April 2002, um 15:44, schrieb Jean-Baptiste Le Stang:

Hi,

I have a problem thinking of a routine which does the following:

Let's say I have a random number like 11050. Now I want to add each pair
of consecutive digits to give the next line (so 11050 becomes 2155). I
want to repeat this step until I have a two-digit number.

I tried over and over again but did not find a solution for this problem.

Anybody out there who could help me?

With very kind regards,

Martin
_______________________________________________
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.

Try the following

set mynum to 11050 as string
set newnum to ""

repeat with x from 1 to (count mynum) - 1
set newnum to newnum & (((item x) of mynum) + ((item (x + 1)) of mynum)
as string)
end repeat

repeat until (newnum as integer < 100)
set mynum to newnum
set newnum to ""
repeat with x from 1 to (count mynum) - 1
set newnum to newnum & (((item x) of mynum) + ((item (x + 1)) of
mynum) as string)
end repeat
end repeat

JB Le Stang
_______________________________________________
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.
_______________________________________________
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: How to calculate/process this one?
      • From: Jean-Baptiste Le Stang <email@hidden>
    • Re: How to calculate/process this one?
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: How to calculate/process this one? (From: Jean-Baptiste Le Stang <email@hidden>)

  • Prev by Date: Exponential notation [was: Re: How to calculate/process this one?]
  • Next by Date: Re: Exponential notation [was: Re: How to calculate/process this one?]
  • Previous by thread: Re: How to calculate/process this one?
  • Next by thread: Re: How to calculate/process this one?
  • Index(es):
    • Date
    • Thread