Sign in to follow this  
Followers 0
Misha

How The Hell Do I Make It Exit.

6 posts in this topic

#include <GUIConstants.au3>

GUICreate("Space Presser" ,120 ,50)

$n2=GUICtrlCreateButton ("Space it",10 ,20)

GUICtrlSetState(-1,$GUI_FOCUS)

$n3=GuiCtrlCreateButton ("Exit it",70 ,20)

GUISetState ()

Do

$msg = GUIGetMsg()

if $msg = $n2 then

while $msg <> $n3

GuiGetMsg()

send ( " " , 1)

WEnd

endif

Until $msg = $n3

I press exit it wont exit please assist

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <GUIConstants.au3>

GUICreate("Space Presser", 120, 50)

$n2 = GUICtrlCreateButton("Space it", 10, 20)
GUICtrlSetState(-1, $GUI_FOCUS)
$n3 = GUICtrlCreateButton("Exit it", 70, 20)
GUISetState()

While 1

    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Or $msg = $n3 Then Exit

    If $msg = $n2 Then Send(" ", 1)


WEnd

8)

BTW

Welcome to the forums

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks mate works :)

Ill be staying here and learning

EDIT:

Space it doesnt seem to work.

Edited by Misha

Share this post


Link to post
Share on other sites

Problem: your GUI has focus, and so recieves the space intead of the target program

Solution: make your GUI lose focus by minimising it, then restoring it after space is sent

#include <GUIConstants.au3>

$GUI = GUICreate("Space Presser", 120, 50)

$n2 = GUICtrlCreateButton("Space it", 10, 20)
GUICtrlSetState(-1, $GUI_FOCUS)
$n3 = GUICtrlCreateButton("Exit it", 70, 20)
GUISetState()

While 1

    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Or $msg = $n3 Then 
        Exit
    EndIf

    If $msg = $n2 Then 
        WinSetState($GUI, "", @SW_MINIMIZE)
        Send(" ", 1)
        WinSetState($GUI, "", @SW_RESTORE)
    EndIf


WEnd

Not Tested.

#)

Share this post


Link to post
Share on other sites

fixed needed a while around the send and not needed that minimizer thingy..

Share this post


Link to post
Share on other sites

where did you want to "send" to???

8)


NEWHeader1.png

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