• 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: Where to report Script Editor bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where to report Script Editor bug?


  • Subject: Re: Where to report Script Editor bug?
  • From: Richard Rönnbäck <email@hidden>
  • Date: Fri, 20 Feb 2004 20:37:48 +0100

Paul,

Thanks for your suggestion, but as I said: When I run it in from any other
environment, Script Debbuger, the Script Menu, Smile, as application, Script
Editor 1.9 etc. it DOES coerce to string

It is ONLY the Script Editor 2.0 (v43) that returns that result, and only
for 32, any other value will coerce.

I really can't see how that would be expected behavior, to me it really
seems like a bug




On 04-02-20 19.42, "Paul Berkowitz" <email@hidden> wrote:

> On 2/20/04 10:10 AM, "Richard Rvnnbdck" <email@hidden> wrote:
>
>> This:
>>
>> set myConvertedTemp to (32 as degrees Fahrenheit) as degrees Celsius
>> get myConvertedTemp as string
>>
>> will result in:
>>
>> " 0e+0"
>>
>> but when run from the Script Editor, but when run from Script Debugger, the
>> script menu, or saved as an application, it will return 0
>>
>> Easy enough to work around, but should probably be reported anyway, so where
>> do I do that?
>
> 1. I get exactly the same result (" 0e+0") in Script Debugger.
>
> 2. It's not a bug. Who said 'degrees Celsius' was supposed to coerce
> directly to string?
>
> If you do just
>
> set myConvertedTemp to (32 as degrees Fahrenheit) as degrees Celsius
> --> 0.0 degrees Celsius
>
> You can coerce that to a real or to an integer easily:
>
> get myConvertedTemp as real
> --> 0.0
>
> get myConvertedTemp as integer
> --> 0
>
> If you're not in Panther, you should stick with 'as real' or else do a div 1
> or round operation on the real to get an integer if that's what you want, in
> case the real isn't a whole number. (Only in Panther can you coerce reals to
> integers if they're not whole numbers ending in .0).
>
> And then coerce the real or integer to string:
>
> get myConvertedTemp as real as string
> --> "0.0"
>
> get myConvertedTemp as integer as string
> --> "0"
>
> If not in Panther, I'd do this:
>
> set myConvertedTemp to (round ((33 as degrees Fahrenheit) as degrees
> Celsius as real)) as string
> --> "1"
>
> In Panther, this will also work:
>
> set myConvertedTemp to ((33 as degrees Fahrenheit) as degrees Celsius as
> integer) as string
> --> "1"
>
> There are also ways to get it to 1 or 2 decimal places, as you wish. (You
> probably don't want this:
>
> set myConvertedTemp to ((33 as degrees Fahrenheit) as degrees Celsius as
> real) as string
> --> "0.555555555556"

--
Richard Rvnnbdck
08-444 06 08
070-774 06 08
_______________________________________________
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: Where to report Script Editor bug?
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: Where to report Script Editor bug? (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Setting Finder window background picture
  • Next by Date: Re: startup disk question
  • Previous by thread: Re: Where to report Script Editor bug?
  • Next by thread: Re: Where to report Script Editor bug?
  • Index(es):
    • Date
    • Thread