Jump to content

Looping


Chito
 Share

Recommended Posts

hello ;)

i was bored so i thought that i would learn some autoit :blink:

i was working on a sample script when i fell into some problems.

the key sending works but its when i want to stop is the problem.

any help would be wonderful.

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
;#NoTrayIcon

GUICreate("Enter", 160, 120)
$button1 = GUICtrlCreateButton("Enter Press On", 10, 10, 90, 50) 
$button2 = GUICtrlCreateButton("Enter Press Off", 10, 60, 90, 50)
$enter = 0
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        $msg = GUIGetMsg()
    Case - 3
        ExitLoop
        Exit
    case $button1
        $enter = 1
    Case $button2
        $enter = 0
    EndSwitch
    If $enter = 1 Then
        Do
                if winactive("[CLASS:Notepad]") = 1 Then
        send("{K}")
        Else
            controlsend("[CLASS:Notepad]","","","{K}")
        EndIf
        Sleep(3000)
        Until $enter = 0
    EndIf 
WEnd
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...