Jump to content

Exit...Exit... I WANT TO EXIT


Recommended Posts

Heres the problem. I have a mini app and i tried to make an "exit" button. I made the code, the start button starts it, but the exit button doesen't exit it.

#include <GUIConstants.au3>

GUICreate("StandByeBlock 2.0")

Opt("GUICoordMode",2)
$Button_1 = GUICtrlCreateButton ("Run StandByBlock",  10, 30, 100)
$Button_2 = GUICtrlCreateButton ( "Exit",  0, -1)
GUISetState () 

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
           $x = 0
Do
Sleep(100)
MouseMove(904,51)
Sleep(1500)
mousemove(988,145)
Until $x = 1
        Case $msg = $Button_2
            exit
    EndSelect
Wend

any idea whats wrong?

Link to comment
Share on other sites

Heres the problem. I have a mini app and i tried to make an "exit" button. I made the code, the start button starts it, but the exit button doesen't exit it.

#include <GUIConstants.au3>

GUICreate("StandByeBlock 2.0")

Opt("GUICoordMode",2)
$Button_1 = GUICtrlCreateButton ("Run StandByBlock",  10, 30, 100)
$Button_2 = GUICtrlCreateButton ( "Exit",  0, -1)
GUISetState () 

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
           $x = 0
Do
Sleep(100)
MouseMove(904,51)
Sleep(1500)
mousemove(988,145)
Until $x = 1
        Case $msg = $Button_2
            exit
    EndSelect
Wend

any idea whats wrong?

or this way

#include <GUIConstants.au3>

GUICreate("StandByeBlock 2.0")

Opt("GUICoordMode",2)
$Button_1 = GUICtrlCreateButton ("Run StandByBlock",  10, 30, 100)
$Button_2 = GUICtrlCreateButton ( "Exit",  0, -1)
GUISetState ()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
    ; Change the  $x = 0 to $x = 1  
               [b] $x = 1[/b]
Do
Sleep(100)
MouseMove(904,51)
Sleep(1500)
mousemove(988,145)
Until $x = 1
        Case $msg = $Button_2
            exit
    EndSelect
Wend
Edited by 314
Link to comment
Share on other sites

Do you mean the Exit button doesn't work after you've pressed the start button? It worked for me before pressing the Start button, you should look into HotKeySet for a way to break out of that loop, because that's what's keeping you in that Case and since your stuck in that Case you GUIGetMsg is still on $Button_1.

Edited by exodius
Link to comment
Share on other sites

Do you mean the Exit button doesn't work after you've pressed the start button? It worked for me before pressing the Start button, you should look into HotKeySet for a way to break out of that loop, because that's what's keeping you in that Case and since your stuck in that Case you GUIGetMsg is still on $Button_1.

no he stated that $x = 0 but farther down to break it he stated that $x = 1 so he has to change $x = 0 to $x = 1
Link to comment
Share on other sites

no he stated that $x = 0 but farther down to break it he stated that $x = 1 so he has to change $x = 0 to $x = 1

if he was going to do something like

$x = 1
Do
Code
Code
Code
Until $x = 1

Why would he use a loop at all because it's only going to execute the loop once? I guess it just depends on whether he wants that to loop or not.

Link to comment
Share on other sites

Are you going to do anything else with this or is it just to stop the PC going in to standby?

If just preventing standby then you can use this if you like

#include <GuiConstants.au3>
opt ("GuiOnEventmode",1)

GuiCreate("Staying Alive", 232, 95,-1, -1 , BitOR($DS_MODALFRAME, $WS_CAPTION ))

$Button_1 = GuiCtrlCreateButton("Quit Mouse Mover", 20, 10, 190, 70)
GUICtrlSetOnEvent(-1, "_exit")

GuiSetState()
WinSetOnTop ( "Staying Alive", "", 1 )
HotKeySet("x", "_exit")

While 1

Sleep(30000)
WinSetOnTop ( "Staying Alive", "", 1 )
$pos = WinGetPos ( "Staying Alive" )
$newX = Random ( 5, (@DesktopWidth - $pos[2]) - 5)
$newY = Random ( 5, (@DesktopHeight - $pos[3]) -5) 
MouseClickDrag ( "Left", $pos[0]+ 5, $pos[1] + 5, $newX , $newY )
MouseMove ($newX + 115, $newY + 80)
WEnd

Func _exit()
Exit 1
EndFunc
Link to comment
Share on other sites

all i am trying to do is make the mouse move back&forth so it won't go into standby. It is working fine but i just don't want to make an episode of trying to close it out from the taskbar. The problem is that after it has started, the exit button won't make it stop, close it out, or anything. none of the above things work (except chrisL's)

EDIT: yes, i do want it to loop.

Edited by codemyster
Link to comment
Share on other sites

then do this it isn't a code fix but it works

give it a 3 finger salut

either ctrl+shift+esc or alt+ctrl+del

or depending on what system dissable the suspend function

by going to control panel power options click on the hibernate/suspend tab or look through the tabs and find how to turn it off

or go to the windows help file and search for suspend

Link to comment
Share on other sites

give it a 3 finger salut

well, the whole point of me making a "stop StandBy mode" program was because my computer has so much spy/adware that it has disabled task manager, and restarts computer once in standby mode. so not much help there :D

I am trying the 2nd idea... wonder if it will work. If so, on to my next project... whatever it may be.

Link to comment
Share on other sites

well, the whole point of me making a "stop StandBy mode" program was because my computer has so much spy/adware that it has disabled task manager, and restarts computer once in standby mode. so not much help there :D

I am trying the 2nd idea... wonder if it will work. If so, on to my next project... whatever it may be.

go to http://vil.nai.com/vil/stinger/ and download the stinger and run it

Then get AVG anti virus from www.grisoft.com look for the free personal edition or Avast Free edition http://www.avast.com/eng/avast_4_home.html

While your at it get Spybot search and destroy http://www.safer-networking.org/en/download/index.html install, update run a scan then imunize.

Ad-Aware is also another spyware scanner http://www.lavasoftusa.com/software/adaware/

Get yourself a firewall http://www.zonelabs.com/store/content/home.jsp maybe

Link to comment
Share on other sites

well, the whole point of me making a "stop StandBy mode" program was because my computer has so much spy/adware that it has disabled task manager, and restarts computer once in standby mode. so not much help there :D

I am trying the 2nd idea... wonder if it will work. If so, on to my next project... whatever it may be.

This is like patching a hatchet wound with a bandaid. Rather than fix your computer your simply find a way to work with the viruses/spyware.

Reformat, dont use IE, get the updates, and dont be dumb about what you click on.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

This is like patching a hatchet wound with a bandaid. Rather than fix your computer your simply find a way to work with the viruses/spyware.

Reformat, dont use IE, get the updates, and dont be dumb about what you click on.

spybot and adaware works but use in conjunction with ewido anti spy and it will help u emencly

http://ewido.net install but run in safe mode it took like 8 hours but it depends on the size and speed of your computer mine is older with 300 gb hd so took long time

Edited by 314
Link to comment
Share on other sites

well, the whole point of me making a "stop StandBy mode" program was because my computer has so much spy/adware that it has disabled task manager, and restarts computer once in standby mode. so not much help there :D

I am trying the 2nd idea... wonder if it will work. If so, on to my next project... whatever it may be.

So you have one of those computers sending me all that spam :D

The problem with your code is that you never will get out of the do loop.

#include <GUIConstants.au3>

GUICreate("StandByeBlock 2.0")

Opt("GUICoordMode",2)
$Button_1 = GUICtrlCreateButton ("Run StandByBlock",  10, 30, 100)
$Button_2 = GUICtrlCreateButton ( "Exit",  0, -1)
GUISetState ()
$timer = 0
$doWatch = 0
While 1
    $msg = GUIGetMsg()
    Switch $msg
      case 0
         ; A sleep longer that 250 will result in lost messages
         if $doWatch = 1 Then 
            if $timer = 0 then 
               $timer = TimerInit()
               MouseMove(904,51)
            Elseif TimerDiff($timer) > 1500
               mousemove(988,145)     
               $timer = 0
            Else
               Sleep(200)
            Endif
         Else
            sleep(200)
         Endif
      Case $GUI_EVENT_CLOSE, $Button_2
         ExitLoop
      Case $Button_1
                 ; Toggel mouse blocking moves
         $doWatch = NOT $doWatch
    EndSelect
Wend

I have not tried it so it might fail :P

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...