• 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: Basic casting question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic casting question


  • Subject: Re: Basic casting question
  • From: Pinus <email@hidden>
  • Date: Sun, 1 Mar 2009 19:38:45 +0100


Le 1 mars 09 à 19:29, Michelle Steiner a écrit :

On Mar 1, 2009, at 11:24 AM, Pinus wrote:

I'm surprisingly stuck by a cast I try to do from a string to a real.

I have a function that returns something like "339.700012"

I want this result to be casted as a real (set myResult to myResult as real) but I always get the same error :

"can't make "339.700012" into type real"

Is there something I missed regarding casting in AS ?

This works for me:

set myresult to foo()
set myresult to myresult as real

on foo()
return "339.700012"
end foo

Applescript 2.0.1, script editor 2.2.1 (100.1), Leopard 10.5.6

-- Michelle

Very strange...

I get this "339.700012" from MS Word 2008 :

set vPos to (get range information text object of selection information type vertical position relative to page)

the error says that the resulted string is an UTF16 text.

Stéphane.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Basic casting question (From: Pinus <email@hidden>)
 >Re: Basic casting question (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Basic casting question
  • Next by Date: Re: Basic casting question
  • Previous by thread: Re: Basic casting question
  • Next by thread: Re: Basic casting question
  • Index(es):
    • Date
    • Thread