Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some strange behaviour of code



On 1/24/06, Andreas Kiel <email@hidden> wrote:
> Hi all,
>
> Maybe I should post the below on another list, but since it happens within
> an ASS app, I'll try it here.
>
> I've done some code where the script reads some values from an XML. The
> values are stored in the XML as text (which is normal)
> so a result could be "54", "3190" etc. If I use:
> "set theResult to theResult as number"
> I get an AppleScript error:
> "Can't make {} into type number." where the "number" is highlighted.
> If I use:
> "set theResult to theResult as number
>  return theResult"
> I get 54, 3190 etc.
>
> I tried other things like:
> "set theResult to theResult as integer"
> "set theResult to theResult/1"
> "set theResult to theResult div 1"
> "set theResult to theResult  - 0"
>
> in any case I get the same error as above and either the "integer, 1, 0"
> highlighted, adding the "return theResult" will return the expected value.
>
> Any ideas out there, why this happens?
>
It looks like you are getting a list back from what ever the prior
command is.  An empty list at that.  Could it be that there is no data
in the XML?

-Mark
Just because nothing is false, it doesn't mean that anything is true.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >Some strange behaviour of code (From: Andreas Kiel <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.