How can i check if the lists item is a character or a number ?
I know that the a-zA-Z part is not correct, but i can’t figure out how to do it right.
Only a-z A-Z 0-9 and space should be allowed in the string the user entered.
And if you think that the way I try to solve isn’t the best, tell me.
display dialog "Enter name of new setup:" default answer ¬
"" buttons {"OK", "Cancel"} default button 1 with icon note
set SetupName to text returned of result
set SetupNamelen to (length of SetupName)
if SetupNamelen is less than 1 then
display dialog "You didn't enter a name for the setup.¬
Please press \"Add New Setup\" again and enter a name¬
next time." buttons {"OK"} default button 1
else if SetupNamelen is greater than 0 then
set setupnameitems to text items of SetupName
repeat with i from 1 to SetupNamelen
if item i of the setupnameitems is not equal to ([a - zA - Z0 - 9]) then -- <--- doesn't work - zA and Z0 are variables after compiling - which is not what i wanted ;)
display dialog "Only letters, numbers and space allowed!"
set addokay to false
else
set addokay to true
end if
end repeat
end if
AppleScript: 1.10.3
Browser: Firefox 1.5
Operating System: Mac OS X (10.4)