Jump to content
Sign in to follow this  
Chito

Looping

Recommended Posts

Chito

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

Share this post


Link to post
Share on other sites
Chito

hi,

it is good and it useful

regards,

phe9oxis,

http://www.guidebuddha.com

...?

the stop button doesnt work

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.