• 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: Evaluate text to boolean
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Evaluate text to boolean


  • Subject: Re: Evaluate text to boolean
  • From: Paul Berkowitz <email@hidden>
  • Date: Sat, 15 Jun 2002 12:01:04 -0700

On 6/15/02 10:35 AM, "Gnarlodious" <email@hidden> wrote:

> So how do I make x a boolean?

In OS 10.1.2 + (AS 1.8.x), you can simply do

set x to x as boolean

which will work if x is "true" or false" (case-insensitive). If that's not
working for you, try not cramming everything onto one line.

In earlier versions of AS, just supply a handler

set x to my Boolicize(x)

on Boolicize(x)
if x = "true" then
return true
else if x = "false" then
return false
else
beep 100 -- or whatever
error number -128 -- or go on
end if
end



--
Paul Berkowitz
_______________________________________________
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.

References: 
 >Evaluate text to boolean (From: Gnarlodious <email@hidden>)

  • Prev by Date: Re: can I do this better?
  • Next by Date: Re: Evaluate text to boolean
  • Previous by thread: Evaluate text to boolean
  • Next by thread: Re: Evaluate text to boolean
  • Index(es):
    • Date
    • Thread