• 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: Kai Edwards <email@hidden>
  • Date: Tue, 01 Oct 2002 21:06:53 +0000

on Tue, 01 Oct 2002 11:16:39 +1000, Roger Hie <email@hidden> 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.

If you'd like to also modify messages and icons, try something like this:

------------------------------------------------------------------
set {ent, icn, msg} to {"", 1, "Please enter the code:"}
repeat
set ent to (display dialog msg default answer [NO BREAK]
ent with icon icn)'s text returned
if ent's length is greater than 0 and [NO BREAK]
ent's length is not greater than 22 then exit repeat
set {icn, msg} to {2, [NO BREAK]
"Please make sure the entry is between 1 and 22 characters long:"}
beep
end repeat
-- do something with ent
------------------------------------------------------------------

Kai

--
email@hidden
email@hidden
_______________________________________________
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: Substituting missing Classic terms - a bridge to OS X (was Setting and getting a file's icon in OS X?)
  • Next by Date: Re: Changing codes.
  • Previous by thread: Limiting number of dialog characters
  • Next by thread: Re: Limiting number of dialog characters
  • Index(es):
    • Date
    • Thread