• 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: Making sure the input field returns integer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making sure the input field returns integer


  • Subject: Re: Making sure the input field returns integer
  • From: Andrew Oliver <email@hidden>
  • Date: Mon, 17 Mar 2003 12:23:10 -0800

There's no direct method to do this. You have to parse the result and
redisplay the dialog if it doesn't meet your needs:

set gotNum to false
repeat until gotNum
display dialog "Enter a number" default answer "0"
set inputVal to text returned of result
try
set inputVal to inputVal as integer
-- if we get here, AppleScript can coerce the string to a integer,
so we're OK
set gotNum to true
end try
end repeat

On 3/17/03 11:44 AM, "Guillaume Iacino" <email@hidden> wrote:

> Hi,
>
> Does someone has an example of an input field that only accepts integer (no
> string or decimal number).
>
> display dialog "Please enter number" default button "OK"
> set NumberResult to (text returned of result)
>
> Thank you in advance for your help.
>
> Guillaume
> _______________________________________________
> 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.

References: 
 >Making sure the input field returns integer (From: email@hidden (Guillaume Iacino))

  • Prev by Date: Re: Perl or AppleScript ?
  • Next by Date: Re: Perl or AppleScript ?
  • Previous by thread: Making sure the input field returns integer
  • Next by thread: Re: Making sure the input field returns integer
  • Index(es):
    • Date
    • Thread