Adding extra keys to input

I’m trying to create a scrip that runs on first login, sets host name and domain and deletes itself.

I’ve come this far.

display dialog “Indtast nummer pÃ¥ klistermærke pÃ¥ bunden” default answer “”
set the computerName to the text returned of the result
display dialog “Indtast dit domæne ex. (.test.dk)” default answer “”
set the domainName to the text returned of the result
do shell script "scutil --set ComputerName " & computerName as text with administrator privileges
do shell script "scutil --set LocalHostName " & computerName as text with administrator privileges
do shell script "scutil --set HostName " & computerName & domainName as text with administrator privileges
do shell script “dscacheutil -flushcache”
do shell script “rm -rf ~/Desktop/Selfdestruct.app”
tell application “Finder”
empty the trash
end tell

Don’t mind the dialog text. It’s in danish.

At Line 3 i would like the scrip to add the “.” so the user only has to enter the domain as “domain.com” and not “.domain.com”

Can anybody help me out?

Hi,

you can do it this way


.
set {text returned:domainName} to display dialog "Indtast dit domæne ex. (.test.dk)" default answer ""
if domainName does not start with "." then set domainName to "." & domainName