|
You last visited: Today at 21:48
Advertisement
How to exit loop with the same button?
Discussion on How to exit loop with the same button? within the AutoIt forum part of the Coders Den category.
01/31/2015, 20:09
|
#1
|
elite*gold: 0
Join Date: Jan 2012
Posts: 81
Received Thanks: 7
|
How to exit loop with the same button?
Okay, so i will skip the gui code
Here is my main code
Quote:
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Ready()
Case $Checkbox1
_Hack()
EndSwitch
WEnd
Func _Ready()
While 1
ControlSend(title, "", "", "{5}")
WEnd
EndFunc
|
and i want to exit the loop, how to do it ?
with the same button and the separate button
|
|
|
01/31/2015, 21:39
|
#2
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
If you want to exit the loop simple add ExitLoop after a Button-Case to do so.
|
|
|
02/01/2015, 05:00
|
#3
|
elite*gold: 0
Join Date: Jan 2012
Posts: 81
Received Thanks: 7
|
Quote:
Originally Posted by alpines
If you want to exit the loop simple add ExitLoop after a Button-Case to do so.
|
can't, i tried exitloop a few times but it still run the loop
i tried
Quote:
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Ready()
Case $Button2
ExitLoop
Case $Checkbox1
_Hack()
EndSwitch
WEnd
Func _Ready()
While 1
ControlSend(title, "", "", "{5}")
WEnd
EndFunc
|
|
|
|
02/01/2015, 13:11
|
#4
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
Which loop do you want to exit. The GUI-loop or the While 1 - ControlSend - WEnd Loop?
If you want to exit the ControlSend loop you have to enable GUIOnEventMode and transfer the event of $Button2 into a function where you set a variable true / false which gets checked every time in the ControlSend loop.
|
|
|
02/05/2015, 02:31
|
#5
|
elite*gold: 0
Join Date: Feb 2008
Posts: 225
Received Thanks: 22
|
check this link out (might get you started)
|
|
|
02/26/2015, 14:48
|
#6
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,540
Received Thanks: 935
|
Bin neu in AutoIt aber so würe ich es probieren.
Pseudo Code:
Erzeuge einen Button o.ä.
Button Event:
Code:
Local $isRunning = False
If ($isRunning == False)
{
isRunning = true;
}else {
isRunning = false;
}
while (isRunning == true)
{
; Hier den Codeinhalt
}
|
|
|
03/01/2015, 19:54
|
#7
|
elite*gold: 0
Join Date: Jan 2008
Posts: 32
Received Thanks: 7
|
Do it like alpines said or get a condition from a variable instead of 1. Like
PHP Code:
Func _Ready() While $running = True ControlSend(title, "", "", "{5}") WEnd EndFunc
|
|
|
03/02/2015, 17:37
|
#8
|
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,149
|
Do not use a second loop.
Code:
Global $sendKey = False
While Sleep(10)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$sendKey = Not $sendKey
Case $Checkbox1
_Hack()
EndSwitch
If $sendKey Then
ControlSend("title", "", "", "{5}")
EndIf
WEnd
|
|
|
10/25/2015, 13:34
|
#9
|
elite*gold: 0
Join Date: Mar 2014
Posts: 5
Received Thanks: 0
|
halpppp
Quote:
Originally Posted by KDeluxe
Do not use a second loop.
Code:
Global $sendKey = False
While Sleep(10)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$sendKey = Not $sendKey
Case $Checkbox1
_Hack()
EndSwitch
If $sendKey Then
ControlSend("title", "", "", "{5}")
EndIf
WEnd
|
I was just wondering if there is a program that i can make a bot for 4story because none of these auto click or auto keyboard (autoit included) working during in the game windows.You are a wise guy lol if you have a second to spare for an answer i would be appreciate.
|
|
|
 |
Similar Threads
|
"alles Exit Button" Frage!
06/11/2011 - General Coding - 7 Replies
Hey Leute ,
ich hatte letztens die Idee ein Tool zu schreiben mit dem man alle Programme beendet und dann den PC runter fährt.
Ich weiß leider keine Programmiersprache in der man das verwirklichen könnte.
Wisst ihr wie man das macht?
|
[Help] ShopSale Exit Button
01/30/2010 - CO2 Private Server - 5 Replies
Please...
I've maked the sales working fully... but the exit button don't appears..... what should i do to make it work?? i've tryied many things : X
|
Agbot loop dosnt loop
10/18/2008 - Silkroad Online - 1 Replies
my agbot after i tele will go through the 20 sec wait then says in bot concle feature not available yet
feature not available yet
idk whats wrong
|
Exit sometimes... Didnt write anithing just exit... PLS HELP
11/23/2007 - Silkroad Online - 1 Replies
The problem is :
I can play for a few minutes and after just exit Didnt write out anithnig...
What can i do?
What will be the problem ?
Pls help For me!
TY
|
All times are GMT +1. The time now is 21:50.
|
|