Sign in to follow this  
Followers 0
Cha0sBG

Hmm Global ?

3 posts in this topic

#Include <GuiConstantsEX.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#Include <Misc.au3>
#Include <Constants.au3>

Global $PAUSED, $Continue = False

$Main = GUICreate("Easy Write", 350, 200)
GUISetState(true)
$Input = GUICtrlCreateInput("", 5, 33, 300)
$Input2 = GUICtrlCreateInput("Input Client Name", 5, 65, 300)
$Input3 = GUICtrlCreateInput("Delay", 280, 140, 55)
$But1 = GUICtrlCreateButton("Start", 110, 160, 80)
$CH1 = GUICtrlCreateCheckbox("Check The Box If U Want To Continue Sending", 5, 140)
$Stop = GUICtrlCreateButton("Stop", 200, 160, 80)   

Local $Delay, $read, $read2
While 1
    $msg = GUIGetMsg()
    Select
        case $msg = $But1
        Continue()
    Case $MSG = $GUI_EVENT_CLOSE 
        Exit
    Case Else
       Sleep(100)
    Case $msg = $Stop Then
    Stop()
    EndSelect
WEnd

Func Continue()
    $read = GUICtrlRead($Input)
    $read2 = GUICtrlRead($Input2)
    While 1
    If GUICtrlRead($CH1, $GUI_CHECKED) Then
    $Delay = GUICtrlRead($Input3)
    WinActivate($read2)
    WinSetOnTop("Easy Write", "",1)
    Send($read)
    Send("{Enter}")
            Sleep($Delay)
    Else
    WinActivate($read2)
    Send($read)
    Send("{Enter}")
        EndIf
    WEnd

    EndFunc

hmm what whoud be the right way to make the button STOP work ? with global or ? and what was the code if i set Pause on global i forgot can someone help ?


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites



#include <GuiConstantsEX.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>
#include <Constants.au3>

Global $PAUSED, $Continue = False

$Main = GUICreate("Easy Write", 350, 200)
$Input = GUICtrlCreateInput("", 5, 33, 300)
$Input2 = GUICtrlCreateInput("Input Client Name", 5, 65, 300)
$Input3 = GUICtrlCreateInput("Delay", 280, 140, 55)
$But1 = GUICtrlCreateButton("Start", 110, 160, 80)
$CH1 = GUICtrlCreateCheckbox("Check The Box If U Want To Continue Sending", 5, 140)
$Stop = GUICtrlCreateButton("Stop", 200, 160, 80)
GUISetState(@SW_SHOW)

Local $Delay, $read, $read2

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $But1
            Continue()
;~      Case $msg = $Stop
;~          Stop()
;~      Case Else
;~          Sleep(100)
    EndSelect
WEnd

Func Continue()
    $read = GUICtrlRead($Input)
    $read2 = GUICtrlRead($Input2)
        While 1
        If GUIGetMsg() = $Stop Then ExitLoop
                If GUICtrlRead($CH1, $GUI_CHECKED) Then
            $Delay = GUICtrlRead($Input3)
            WinActivate($read2)
            WinSetOnTop("Easy Write", "", 1)
            Send($read)
            Send("{Enter}")
            Sleep($Delay)
        Else
            WinActivate($read2)
            Send($read)
            Send("{Enter}")
        EndIf
    WEnd
EndFunc   ;==>Continue

;~ Func Stop()
;~ EndFunc   ;==>Stop

Share this post


Link to post
Share on other sites

hmm what whoud be the right way to make the button STOP work ? with global or ? and what was the code if i set Pause on global i forgot can someone help ?

The reason the stop buttong isn't working has nothing to do with global/local vars or anything like that. What is happenening is when you push the start button, there is nothing listening for the GUI message... so when you push stop or try to close the gui nothing happens.

I hacked up your code a bit so I could run it, but look this over you'll get the idea...

#Include <GuiConstantsEX.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#Include <Misc.au3>
#Include <Constants.au3>

;Global $PAUSED, $Continue = False

$Main = GUICreate("Easy Write", 350, 200)
$Input = GUICtrlCreateInput("", 5, 33, 300)
$Input2 = GUICtrlCreateInput("Input Client Name", 5, 65, 300)
$Input3 = GUICtrlCreateInput("Delay", 280, 140, 55)
$But1 = GUICtrlCreateButton("Start", 110, 160, 80)
$CH1 = GUICtrlCreateCheckbox("Check The Box If U Want To Continue Sending", 5, 140)
$Stop = GUICtrlCreateButton("Stop", 200, 160, 80)   

GUISetState()

;Local $Delay, $read, $read2
While 1
    Sleep(10)
    $msg = GUIGetMsg()
    Select
        case $msg = $But1
        Continue()
    Case $MSG = $GUI_EVENT_CLOSE 
        Exit
;~   Case Else
;~      Sleep(100)
;~   Case $msg = $Stop;Then
;~   Stop()
    EndSelect
WEnd

Func Continue()
    $read = GUICtrlRead($Input)
    $read2 = GUICtrlRead($Input2)
    While 1
    $msg = GUIGetMsg()
    ToolTip("Running")
    If $msg = $Stop Then
        ToolTip("")
        Return
    EndIf
    If GUICtrlRead($CH1, $GUI_CHECKED) Then
    $Delay = GUICtrlRead($Input3)
;~   WinActivate($read2)
;~   WinSetOnTop("Easy Write", "",1)
;~   Send($read)
;~   Send("{Enter}")
            Sleep($Delay)
;~   Else
;~   WinActivate($read2)
;~   Send($read)
;~   Send("{Enter}")
    EndIf
    WEnd
EndFunc

If you have your Sleep() set to something large the GUI isn't going to respond quickly though. Test this out see how it works for you.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

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  
Followers 0