Jump to content
Sign in to follow this  

How to check for double quotes in an input box?

Recommended Posts


I am wondering how I can error check an input box to stop user from inputing a double quote.

I know to avoid an error I have to double up the double quotes, but users won't.

How can I detect a double quote and return a friendly error?

If I use:

StringInStr("I am "a" String", """)


StringInStr("I am {"}a{"} String", "{"}")

I get a script error

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Share this post

Link to post
Share on other sites

maybe like this

$answer = InputBox("Question", "Where were you born?", "Planet Earth", "", _
    -1, -1, 0, 0)

if StringInStr($answer, '""') Then
    MsgBox(64,"Input Error", "Please do not use double quotes", 5 )



Share this post

Link to post
Share on other sites

cyanidemonkey it is kind of hard to help you without a part of code but, you can used StringReplace():

StringReplace($InputBox, '"', '')

and this will remove any double quote from the string.

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this