Jump to content

Empty Check


ink
 Share

Recommended Posts

how do i check if the box is empty the i press ok?

While 1

$delay = InputBox("Question", "how much delay should there be between each mouse move?")

If $delay = Not Number($delay) Then

MsgBox(0, "Error", "that's not a number you have entered that's a character")

Else

ExitLoop

EndIf

WEnd

Link to comment
Share on other sites

While 1
$delay = InputBox("Question", "how much delay should there be between each mouse move?")
If $delay <> "" Then
    If Not IsNumber($delay) Then
        MsgBox(0, "Error", "Only numeric values are allowed")
        ContinueLoop
    EndIf
    ExitLoop
EndIf
WEnd

EDIT: Blue_Drache does your mother sew? BOOM! Get her to sew that. -Clem (Joe Dirt)

Edited by weaponx
Link to comment
Share on other sites

  • Moderators

If $delay = Not Number($delay) OR $delay = "" then

(Haha, beat you, weaponx)

<_< "Not Number"? :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I was using the same pseudo-code the OP was.

A more reliable check for a non number in a whole string is to use:

$a_delay = StringSplit($delay,"")
For $x = 1 to $a_delay(0)
   If Not Number($a_delay($x)) then
      MsgBox(0,"Error","Non-Neumeric in string!")
   EndIf
Next
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

im getting this error that i'm trying to run this and btw what should i use instead of numbers to check if its a number there's entered?

(6) : ==> Error in expression.:

If $delay = Not Number($delay) Or = "" Then

If ^ ERROR

While 1
            $delay = InputBox("Question", "how much delay should there be between each mouse move?")
If $delay = Not Number($delay) Or = ""  Then
        MsgBox(0, "Error", "that's not a number you have entered that's a character")
    Else
ExitLoop
EndIf
WEnd
Link to comment
Share on other sites

If Not Number($delay) or $delay = "" then

(see above post for more reliable check for non-neumeric in string, or better yet, Use weaponx's code)

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

  • Moderators

My turn:

While 1
    $delay = InputBox("Question", "how much delay should there be between each mouse move?")
    If StringRegExp($delay, "^\d+$") = 0 Then           
        MsgBox(0, "Error", "Only numeric values are allowed")
        ContinueLoop
    EndIf
    ExitLoop
WEnd

Edit:

Had wrong var in StringRegExp <_<

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...