require serial number....

I would like a snippet of code (or a full script) that requires people to type in a serial number (I will create serial numbers) before a program can be used.

I hope this is easy to do. And many thanks.

Ben

set userOK to false

repeat until userOK
	set uiReturned to display dialog "Enter serial number" default answer ""
	
	set userOK to (text returned of uiReturned = "1234")
end repeat

-- rest of script

perfect, thanks!

Consider, that using this way the serial number is stored as plain text in the script.
It can easily be read with a text or hex editor