• 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: Limiting number of dialog characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limiting number of dialog characters


  • Subject: Re: Limiting number of dialog characters
  • From: email@hidden
  • Date: Tue, 1 Oct 2002 16:42:20 EDT

You can't limit the amount of data entered in a display dialog/prompt user
interface box. You can, however, parse their answer down after you capture
what they typed, and then qualify that. Something like:
set OurLoopFlag to true as boolean
repeat while (OurLoopFlag)
display dialog "Please enter serial number: " buttons [con't]
{"Cancel", "OK"} default button 2 default answer [con't]
"1234567890123456789012"
if (button returned of the result is "OK") then
-- grab the contents of the dialog box
set x to the text returned of the result as text
end if
set xLength to the length of x
if xLength<22 then
set OurLoopFlag to true as boolean
else if xLength>22 then
set x to text 1 thru 22 of x
-- check the number to see if it's valid
-- if not valid
-- generate an error message to user and loop again
-- if valid, set OurLoopFlag to false as boolean -- to exit the loop
end if
end repeat


Roger Hie Wrote:
>
> Does anyone know how I can limit the amount of characters that can be
> entered in a dialog display? I want to limit the input characters to 22 by
> not letting anymore than 22 characters be entered. Much like entering a
> registration number.
>
> Thanks.
_______________________________________________
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.

  • Prev by Date: Re: Regex on OS X
  • Next by Date: Re: Adding a message to a mailbox in Mail
  • Previous by thread: Re: Limiting number of dialog characters
  • Next by thread: Scripting THROUGH terminal?
  • Index(es):
    • Date
    • Thread