NELyon Posted June 4, 2006 Share Posted June 4, 2006 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 More sharing options...
SlimShady Posted June 4, 2006 Share Posted June 4, 2006 One way is: Change... Case $msg = $Button_2 exitoÝ÷ ÚÚºÚ"µÍØÙH ÌÍÛÙÈH ÌÍÐ]ÛÌ ÌÍÞHB^] Link to comment Share on other sites More sharing options...
314 Posted June 4, 2006 Share Posted June 4, 2006 (edited) 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 June 4, 2006 by 314 Link to comment Share on other sites More sharing options...
exodius Posted June 4, 2006 Share Posted June 4, 2006 (edited) 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 June 4, 2006 by exodius Link to comment Share on other sites More sharing options...
314 Posted June 4, 2006 Share Posted June 4, 2006 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 More sharing options...
exodius Posted June 4, 2006 Share Posted June 4, 2006 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 More sharing options...
314 Posted June 4, 2006 Share Posted June 4, 2006 which is what hes probly going to do is loop it add a hotkey and take out the buttons that way they will have a harder time stoping it Link to comment Share on other sites More sharing options...
ChrisL Posted June 4, 2006 Share Posted June 4, 2006 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 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
NELyon Posted June 4, 2006 Author Share Posted June 4, 2006 (edited) 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 June 4, 2006 by codemyster Link to comment Share on other sites More sharing options...
314 Posted June 4, 2006 Share Posted June 4, 2006 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 More sharing options...
NELyon Posted June 4, 2006 Author Share Posted June 4, 2006 give it a 3 finger salutwell, 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 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 More sharing options...
ChrisL Posted June 4, 2006 Share Posted June 4, 2006 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 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 itThen 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.htmlWhile 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 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
exodius Posted June 4, 2006 Share Posted June 4, 2006 And if you're not already, use FireFox... http://www.mozilla.com Link to comment Share on other sites More sharing options...
Simucal Posted June 4, 2006 Share Posted June 4, 2006 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 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 More sharing options...
exodius Posted June 4, 2006 Share Posted June 4, 2006 This is like patching a hatchet wound Link to comment Share on other sites More sharing options...
314 Posted June 4, 2006 Share Posted June 4, 2006 (edited) 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 emenclyhttp://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 June 4, 2006 by 314 Link to comment Share on other sites More sharing options...
Uten Posted June 5, 2006 Share Posted June 5, 2006 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 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 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 Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now