Jump to content

Problem With Isnumber


Recommended Posts

I'm experimenting with some of the functions in the latest version of AutoIt 3 build 101.

When I run this code I want the script to end if the value $Loop is NOT numeric and continue on if the value is numeric but all I get is error.

I've tried using

If IsNumber($Loop) Then
too but that didn't work either. Is there something wrong with my code or is there a bug with that function?

$Loop = InputBox ( "Enter loop ammount", "Please enter the number of times the mouse should move." & " A too larg ammount is not recommended." & "Click on Cancel to about this option immidiatly." , "10")
If @Error = 1 Then
    Exit
EndIf
If IsNumber($Loop) = 1 Then
    $file = FileOpen("movement.log", 1)
; Check if file opened for writing OK
    If $file = -1 Then
     MsgBox(0, "Error", "Unable to open file.")
     Exit
    EndIf
    
    $i = 0
    Do
    $i = $i + 1
  $Height = round(Random(1,@DesktopHeight), -1)
  $Width = round(Random(1,@DesktopWidth), -1)
  MouseMove($Width, $Height)
  FileWriteLine($file, "Movement number " & $i &". Mouse moved to position " & $Width & "x" & $Height & " at " & @HOUR&":"&@MIN&":"&@SEC)
    Until $i = 10
    
    FileClose($file)
Else
  MsgBox(0,"Error","The value you entered is NOT a numeric value!")
  Exit
EndIf
Link to comment
Share on other sites

I have 24/7 internet everywhere I am... Central US time you will not see me from 1 am to 8 am. Otherwise, when I am home or at work, I have a computers everywhere...

I am hoping to start doing work as a handyman and changing all that. My first love is carpentry, mechanics, and generally fixing things.... I fell into computers cause it's boringly stable...

LAr.

How long before you fix your "rent-a-boss" by taking your hammer to his head?
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...