Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Close Window


  • Please log in to reply
6 replies to this topic

#1 PcExpert

PcExpert

    AutoIT Scripter

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 07 June 2006 - 12:42 PM

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.







#2 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,858 posts

Posted 07 June 2006 - 12:44 PM

HI,

may you show the script code?

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files *new

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


#3 PcExpert

PcExpert

    AutoIT Scripter

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 07 June 2006 - 01:19 PM

OK, here it is:

Plain Text         
#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


#4 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 07 June 2006 - 01:52 PM

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 :

AutoIt         
... $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 :D

Edited by Gyzmok, 07 June 2006 - 01:56 PM.

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

#5 PcExpert

PcExpert

    AutoIT Scripter

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 07 June 2006 - 02:11 PM

NL:

bedankt Gyzmok!

EN:

Thanks Gyzmok!

#6 PcExpert

PcExpert

    AutoIT Scripter

  • Active Members
  • PipPipPipPipPipPip
  • 667 posts

Posted 07 June 2006 - 03:53 PM

I tried it, but it doesn't work. Althought not for more then one time. This is the whole script:

Plain Text         
#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?

#7 Gyzmok

Gyzmok

    Adventurer

  • Active Members
  • PipPip
  • 101 posts

Posted 07 June 2006 - 05:19 PM

Hmm I see...

Your problem is :
You never get out of the first While 1 ... Wend loop
In each case you need an Exitloop

Using 10 times the same code should be in a loop like this :
for $i = 1 to 10 step 1
...
next


example : try something like this

AutoIt         
... 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 ! :D
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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users