Xkingkongx Posted August 28, 2009 Share Posted August 28, 2009 Hello, i have been using the forum a lot to make my script and so made an account. Anyway, My Question is this. Is there a function that will either give 0 or 1 to a inputbox/variable if it has characters/numbers in? Is there a way to do it. Thanks in advance. Link to comment Share on other sites More sharing options...
Xkingkongx Posted August 28, 2009 Author Share Posted August 28, 2009 (edited) I tried to use GUICtrlRead Funcif it was 0 but it didnt work Edited August 28, 2009 by Xkingkongx Link to comment Share on other sites More sharing options...
Xkingkongx Posted August 28, 2009 Author Share Posted August 28, 2009 Cracked It! For people wondering it is this. $inputbox = GuiCtrlCreateInput("") $userinput = GUICtrlRead ($inputbox) if $userinput = "" Then MsgBox(0,"Error", "Please Enter Something!") Else DO something else! EndIF Link to comment Share on other sites More sharing options...
nfaustin Posted August 28, 2009 Share Posted August 28, 2009 (edited) Is there a function that will either give 0 or 1 to a inputbox/variable if it has characters/numbers in?You said characters/numbers in it?  The question should be "check if inputbox/variable is empty or not?"Your question is unclear.Edit:typo Edited August 28, 2009 by nfaustin [font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font] Link to comment Share on other sites More sharing options...
Nutster Posted August 29, 2009 Share Posted August 29, 2009 (edited) You can force the InputBox function to require input using the Mandatory flag.$sInput = InputBox("Enter a sentence.", "Testing", "", " M") If @Error = 1 Then ; Cancel button was pressed. By having the " M" flag at the end, you can not press the Ok button if there is no text. Else ; At least one character is present in the variable. Endif If you want to check if any text is in a string, can use a comparison.If $sCheck > "" Then ; You got stuff in it Else ; It is empty. EndIfEdit: Simplified the second code block. That's what I get for coding when tired. Edited September 1, 2009 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
nfaustin Posted August 29, 2009 Share Posted August 29, 2009 You said characters/numbers in it?  The question should be "check if inputbox/variable is empty or not?" BTW, Based on my understanding on your original question,I used this to check if the inputbox/variable has characters/numbers in it. MsgBox(0,'',GUICtrlRead(StringIsInt($userinput))) [font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font] Link to comment Share on other sites More sharing options...
gandaria700 Posted August 31, 2009 Share Posted August 31, 2009 (edited) A colleague of mine who is not very javascript or for that matter jQuery aware asked me to help him to do a little trick with jQuery. He needed to select the contents of the input box when user selects it (when onfocus event is fired basically). Edited August 31, 2009 by Valik Link to comment Share on other sites More sharing options...
Manjish Posted September 1, 2009 Share Posted September 1, 2009 A colleague of mine who is not very javascript or for that matter jQuery aware asked me to help him to do a little trick with jQuery. He needed to select the contents of the input box when user selects it (when onfocus event is fired basically).Ok!! So what has this got to do with this thread or with this forum or with AutoIT? [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Nutster Posted September 1, 2009 Share Posted September 1, 2009 (edited) Ok!! So what has this got to do with this thread or with this forum or with AutoIT?Notice that this jerk has been blocked. It is because he was off-topic (and more) on all his posts. Valik trimmed down his posts so they were only off-topic. Ignore him. Edited September 3, 2009 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now