PcExpert Posted June 7, 2006 Share Posted June 7, 2006 Hello, I made a program that automates some Windows tasks. I let a windows appear and then the user can take the right action. If they click a button the right action starts. But When the right action is done, then the windows still exists. So it doesn't close. I already tried WinKill and ExitLoop. Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 7, 2006 Share Posted June 7, 2006 HI, may you show the script code? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
PcExpert Posted June 7, 2006 Author Share Posted June 7, 2006 OK, here it is: expandcollapse popup#include <GUIConstants.au3> HotKeySet("{F2}", "Terminate") WinWaitActive("Habbo ~ Habbo Hotel - ") Sleep(5000) Send("Hey, welkom bij de Quiz-O-Matic {ENTER}") Sleep(5000) Send("Het spel gaat over een paar seconden beginnen {ENTER}") Sleep(3500) Send("Zit iedereen? Dan gaan we beginnen {ENTER}") Sleep(1000) MouseClick("left", 619, 419, 2) MouseClick("left", 699, 532, 1) Sleep(3800) MouseClick("left", 620, 406, 2) Sleep(4000) ;tellers MouseClick("left", 681, 499, 2) MouseClick("left", 716, 528, 1) MouseClick("left", 730, 475, 2) MouseClick("left", 700, 535, 2) Sleep(1000) ;vragen Get_Line() Sleep(10000) GUICreate("Winnaar", 170, 40) ; will create a dialog box that when displayed is centered $left = GUICtrlCreateButton("links", 10, 10) $cnt = GUICtrlCreateButton("niemand", 60, 10) $right = GUICtrlCreateButton("rechts", 120, 10) GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $left MouseClick("left", 701, 533, 1) Sleep(1000) MouseClick("left", 685, 544, 1) Winkill("Winnaar") Case $msg = $right MouseClick("left", 718, 528, 1) Sleep(1000) MouseClick("left", 733, 519, 1) Winkill("Winnaar") Case $msg = $cnt Winkill("Winnaar") If $msg = $GUI_EVENT_CLOSE Then ExitLoop endselect Wend Link to comment Share on other sites More sharing options...
Gyzmok Posted June 7, 2006 Share Posted June 7, 2006 (edited) Try something like this.For the creation of the little GUI :$winnaar = GUICreate("Winnaar", 170, 60,-1,-1, $WS_DLGFRAME, $WS_EX_TOPMOST)and when it has to diseappear :GUIDelete($winnaar)looks like this :... $winnaar = GUICreate("Winnaar", 170, 60,-1,-1, $WS_DLGFRAME, $WS_EX_TOPMOST) ; will create a dialog box that when displayed is centered $left = GUICtrlCreateButton("links", 10, 10) $cnt = GUICtrlCreateButton("niemand", 60, 10) $right = GUICtrlCreateButton("rechts", 120, 10) GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $left MouseClick("left", 701, 533, 1) Sleep(1000) MouseClick("left", 685, 544, 1) GUIDelete($winnaar) ;Winkill("Winnaar") Case $msg = $right MouseClick("left", 718, 528, 1) Sleep(1000) MouseClick("left", 733, 519, 1) GUIDelete($winnaar) ;Winkill("Winnaar") Case $msg = $cnt GUIDelete($winnaar) ;Winkill("Winnaar") endselect Wend ...Veel succes ermee Edited June 7, 2006 by Gyzmok D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper Link to comment Share on other sites More sharing options...
PcExpert Posted June 7, 2006 Author Share Posted June 7, 2006 NL: bedankt Gyzmok! EN: Thanks Gyzmok! Link to comment Share on other sites More sharing options...
PcExpert Posted June 7, 2006 Author Share Posted June 7, 2006 I tried it, but it doesn't work. Althought not for more then one time. This is the whole script: expandcollapse popup#include <GUIConstants.au3> HotKeySet("{F2}", "Terminate") WinWaitActive("Habbo ~ Habbo Hotel - ") Sleep(5000) Send("Hey, welkom bij de Quiz-O-Matic {ENTER}") Sleep(5000) Send("Het spel gaat over een paar seconden beginnen {ENTER}") Sleep(3500) Send("Zit iedereen? Dan gaan we beginnen {ENTER}") Sleep(1000) MouseClick("left", 619, 419, 2) MouseClick("left", 699, 532, 1) Sleep(3800) MouseClick("left", 620, 406, 2) Sleep(4000) ;tellers MouseClick("left", 681, 499, 2) MouseClick("left", 716, 528, 1) MouseClick("left", 730, 475, 2) MouseClick("left", 700, 535, 2) Sleep(1000) ;vragen ;/;/;/;/;/;/;/;/;/;/ Get_Line() Sleep(10000) $winnaar = GUICreate("Winnaar", 170, 60,-1,-1, $WS_DLGFRAME, $WS_EX_TOPMOST) $left = GUICtrlCreateButton("links", 10, 10) $cnt = GUICtrlCreateButton("niemand", 60, 10) $right = GUICtrlCreateButton("rechts", 120, 10) GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $left MouseClick("left", 701, 533, 1) Sleep(1000) MouseClick("left", 685, 544, 1) GUIDelete($winnaar) Case $msg = $right MouseClick("left", 718, 528, 1) Sleep(1000) MouseClick("left", 733, 519, 1) GUIDelete($winnaar) Case $msg = $cnt GUIDelete($winnaar) If $msg = $GUI_EVENT_CLOSE Then ExitLoop endselect Wend Get_Line() Sleep(10000) $winnaar = GUICreate("Winnaar", 170, 60,-1,-1, $WS_DLGFRAME, $WS_EX_TOPMOST) $left = GUICtrlCreateButton("links", 10, 10) $cnt = GUICtrlCreateButton("niemand", 60, 10) $right = GUICtrlCreateButton("rechts", 120, 10) GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $left MouseClick("left", 701, 533, 1) Sleep(1000) MouseClick("left", 685, 544, 1) GUIDelete($winnaar) Case $msg = $right MouseClick("left", 718, 528, 1) Sleep(1000) MouseClick("left", 733, 519, 1) GUIDelete($winnaar) Case $msg = $cnt GUIDelete($winnaar) If $msg = $GUI_EVENT_CLOSE Then ExitLoop endselect Wend ;/;/;/;/;/;/;/;/;/;/ FileDelete(@TempDir & "\temp.ini") While 1 ToolTip("Druk op F2 om de HABBO Quiz Bot te stoppen") WEnd Func Get_Line() If Not FileExists(@TempDir & "\temp.ini") Then FileCopy(@ScriptDir & "\text.ini", @TempDir & "\temp.ini", 1) $last = "used" $count = 0 While $last = "used" $count = $count + 1 If $count = 20 Then ExitLoop $rand = Random(1, 20, 1) $last = IniRead(@TempDir & "\temp.ini", "text", $rand, "") Sleep(10) WEnd IniWrite(@TempDir & "\temp.ini", "text", $rand, "used") Send($last) EndFunc ;==>Get_Line FileDelete(@TempDir & "\temp.ini") Func Terminate() FileDelete(@TempDir & "\temp.ini") Exit 0 EndFunc The code that's between the ;/;/;/;/;/;/;/;/;/;/ signs must be repeated 10 times. But the current code won't allow me to run it more then one time. I don't know what's wrong? Link to comment Share on other sites More sharing options...
Gyzmok Posted June 7, 2006 Share Posted June 7, 2006 Hmm I see...Your problem is :You never get out of the first While 1 ... Wend loopIn each case you need an ExitloopUsing 10 times the same code should be in a loop like this :for $i = 1 to 10 step 1...nextexample : try something like this... for $i = 1 to 10 step 1 Get_Line() Sleep(10000) $winnaar = GUICreate("Winnaar", 170, 60,-1,-1, $WS_DLGFRAME, $WS_EX_TOPMOST) ; will create a dialog box that when displayed is centered $left = GUICtrlCreateButton("links", 10, 10) $cnt = GUICtrlCreateButton("niemand", 60, 10) $right = GUICtrlCreateButton("rechts", 120, 10) GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $left MouseClick("left", 701, 533, 1) Sleep(1000) MouseClick("left", 685, 544, 1) GUIDelete($winnaar) ExitLoop Case $msg = $right MouseClick("left", 718, 528, 1) Sleep(1000) MouseClick("left", 733, 519, 1) GUIDelete($winnaar) ExitLoop Case $msg = $cnt GUIDelete($winnaar) ExitLoop endselect Wend Next ...Ik hoop dat dit terug een stap in de goede richting is ...Niet opgeven ! D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper 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