|
You last visited: Today at 06:16
Advertisement
ExitLoop bricht schleife ab
Discussion on ExitLoop bricht schleife ab within the AutoIt forum part of the Coders Den category.
04/01/2016, 22:10
|
#1
|
elite*gold: 7
Join Date: Jul 2013
Posts: 440
Received Thanks: 166
|
ExitLoop bricht schleife ab
Hi jungs ich hab da ein Problem soweit Funktioniert mein Tool hier mal der Code
PHP Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Farm Bot", 452, 104, 192, 124)
$Button1 = GUICtrlCreateButton("Start", 20, 8, 127, 41)
$Button2 = GUICtrlCreateButton("Stop", 160, 8, 127, 41)
$Button3 = GUICtrlCreateButton("Beenden", 300, 8, 127, 41)
$Label1 = GUICtrlCreateLabel("Farm Bot by Siverbot", 80, 64, 304, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
while 1
Send("{LWIN}")
sleep(2000)
If $Button2 Then ExitLoop
If $Button3 Then ExitLoop
WEnd
Case $Button2
While 2
sleep(100)
If $Button1 Then ExitLoop
If $Button3 Then ExitLoop
WEnd
Case $Button3
Exit 0
EndSwitch
WEnd
Was soll es Tuen ?
Wenn ich Start drücke soll er alle 2 Sekunden die Windows Taste Drücken.
Wenn ich Stop Drücke soll er aufhören die Windows Taste zu Tätigen.
Wenn ich auf Beenden Klicke soll sich das Programm schließen.
soweit so gut an sich Funktioniert es auch nur Funktionieren die Schleifen nicht heißt er drückt nur einmal die Windows Taste und bricht dann ab.
Jemand eine Idee ?
|
|
|
04/01/2016, 23:26
|
#2
|
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
|
Use a flag instead
Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Farm Bot", 452, 104, 192, 124)
$Button1 = GUICtrlCreateButton("Start", 20, 8, 127, 41)
$Button2 = GUICtrlCreateButton("Stop", 160, 8, 127, 41)
$Button3 = GUICtrlCreateButton("Beenden", 300, 8, 127, 41)
$Label1 = GUICtrlCreateLabel("Farm Bot by Siverbot", 80, 64, 304, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
global $Started = false
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$start = true
tooltip("Started",0,0)
Case $Button2
$start = false
tooltip("Stoped",0,0)
Case $Button3
Exit 0
EndSwitch
if $start then
Send("{LWIN}")
sleep(2000)
endif
WEnd
|
|
|
04/01/2016, 23:55
|
#3
|
elite*gold: 0
Join Date: Mar 2016
Posts: 104
Received Thanks: 34
|
@elmarcia bec i tested ur script and it gived me a error i overwritet it a bit ;P
PS. u need to click 2 times on stop ...
Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $start
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Farm Bot", 452, 104, 192, 124)
$Button1 = GUICtrlCreateButton("Start", 20, 8, 127, 41)
$Button2 = GUICtrlCreateButton("Stop", 160, 8, 127, 41)
$Button3 = GUICtrlCreateButton("Beenden", 300, 8, 127, 41)
$Label1 = GUICtrlCreateLabel("Farm Bot by Siverbot", 80, 64, 304, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
global $Started = false
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$start = 1
Case $Button2
$start = 0
Case $Button3
Exit 0
EndSwitch
if $start = 1 then
Send("{LWIN}")
sleep(2000)
endif
WEnd
If $start = 0 Then
While 1
Sleep(100)
Wend
EndIf
|
|
|
04/02/2016, 02:00
|
#4
|
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
|
Yeah haven't tested i forgot i named it started, and since the sleep time is 2 secs then pressing stop should fail because it's sleeping not registering messages
|
|
|
04/02/2016, 18:52
|
#5
|
elite*gold: 138
Join Date: Apr 2012
Posts: 3,494
Received Thanks: 1,769
|
PHP Code:
If $Button2 Then ExitLoop
Button2 liefert kein boolschen Wert zurück sondern eine ControlID. Du musst, wie in der äußeren Schleife mit GUIGetMsg() = $Button2 abfragen. Da du aber einen Sleep in der Schleife hast, weiß ich nicht wie genau wie AutoIt das behandelt. Alternativen dazu wären HotKeys oder
|
|
|
 |
Similar Threads
|
schleife in einer schleife laufen lassen
01/17/2016 - AutoIt - 2 Replies
wollte mal fragen wie ich eine 2. schleife in einer while schleifen laufen lassen kann ohne das die 1. unterbrochen wird #include <ImageSearch.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FastFind.au3>
HotKeySet ("{ESC}", "_Exit")
HotKeySet ("{f3}", "pause")
Dim $myPics
|
ExitLoop in If-Abfrage
10/22/2014 - AutoIt - 9 Replies
Edit real problem:
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $CheckboxOnOff
$On = True
Case $GUI_EVENT_CLOSE
Exit
Case $AA = 0
|
Fehler suche (Anfangsprogramm) If schleife in einer If-Schleife
10/16/2013 - .NET Languages - 8 Replies
Wie mache ich eine If-Schleife in einer if-schleife?
Danke^^
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
|
Exitloop Problem mit mehreren Schleifen
10/21/2009 - AutoIt - 5 Replies
Abend !
und zwar sieht mein Problem wie folgt aus:
While 1=1
(das script)
If...Then
-hier ist das problem: ich möchte das das programm die while schleife sozusagen pausiert
-dann das was gemacht werden soll
|
All times are GMT +1. The time now is 06:16.
|
|