Re: Limiting number of dialog characters
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.