Jump to content

Recommended Posts

Posted (edited)

I am no programmer so I hate to jump to a conclusion of a bug so I thought I would ask for a some help to see if this is a bug or a problem with my script.

So here is the snippet I am having trouble with.

#include <GUIConstantsEx.au3>

Global $MOUSE_CLICK_LEFT
Local $Filtemp = 0.1
Local $Fil = 20
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send ("test")

FilSend()

Func FilSend()
   Do
   WinWait ("Untitled - Notepad", "", 10)
    WinActivate("Untitled - Notepad", "")
    Local $WinPos = WinGetPos("Untitled - Notepad", "")
    If $Filtemp < $Fil Then
         WinActivate("Untitled - Notepad", "")

        Do
         Sleep(100)
         ControlSend ("Untitled - Notepad", "", 15, "^a{BACKSPACE}")
         ControlSend ("Untitled - Notepad", "", 15, $Filtemp) ; \ Fil

        Until $Filtemp = ControlGetText ("Untitled - Notepad", "", 15)

         ControlClick ("Untitled - Notepad", "", 15)
         ControlSend("Untitled - Notepad", "", 15, "{ENTER}") ;Hit ENTER if value is correct
         Sleep(200)
         $Filtemp = $Filtemp + 0.1
         Sleep (1000)
    EndIf
    Until $Filtemp = $Fil
EndFunc

This script should just count up in notepad changing once per second in 0.1 steps.

When I do this it stops at 0.3 and hangs.  If I change $Filtemp to 0.3 to start with it will count to 0.8 and hang.  If I start at 0.8 it will go to 1.2 and hang.

If I switch $Filtemp to 1 and change the steps to 1 instead of 0.1 it seems to work just fine.

Can this be repeated by someone other than me?

Sorry for some of the excess in the code but this is for the main script I am working on.

 

 

 

Oh BTW Windows 10 Home 64bit and AutoIt V3.3.14.5

Edited by rawkhopper
added info
Posted (edited)

Ok awesome this works!

I have a question though I originally had the until statement as a while like this:

While $Filtemp <> ControlGetText("Untitled - Notepad", "", 15)

Is there an equivalent to == in the until statement to fix this?

Edited by rawkhopper
entered too earlier
Posted

Like this

#include <GUIConstantsEx.au3>

Global $MOUSE_CLICK_LEFT
Local $Filtemp = 0.3
Local $Fil = 20
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send ("test")

FilSend()

Func FilSend()
   Do
   WinWait ("Untitled - Notepad", "", 10)
    WinActivate("Untitled - Notepad", "")
    Local $WinPos = WinGetPos("Untitled - Notepad", "")
    If $Filtemp < $Fil Then
         WinActivate("Untitled - Notepad", "")

        While $Filtemp <> ControlGetText("Untitled - Notepad", "", 15) 
         Sleep(100)
         ControlSend ("Untitled - Notepad", "", 15, "^a{BACKSPACE}")
         ControlSend ("Untitled - Notepad", "", 15, $Filtemp) ; \ Fil

        WEnd

         ControlClick ("Untitled - Notepad", "", 15)
         ControlSend("Untitled - Notepad", "", 15, "{ENTER}") ;Hit ENTER if value is correct
         Sleep(200)
         $Filtemp = $Filtemp + 0.1
         Sleep (1000)
    EndIf
    Until $Filtemp = $Fil
EndFunc

 

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
×
×
  • Create New...