[Frage] AutoIt Spambot

04/17/2010 09:01 Sir Ryuuzaki#1
Hallöle,

soooo, das hab ich schonmal:

Quote:
#include <GUIConstantsEx.au3>

GUICreate("name", 335, 100)

GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()

Select

Case $msg = $startbutton
$send1 = GUICtrlRead($key1)
$sleep1 = GUICtrlRead($time1)
While 1
Send($send1)
Sleep($sleep1)
WEnd

Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
ExitLoop

EndSelect

WEnd

Ich will aber noch einen "Stop" Button einsetzten:

Quote:
#include <GUIConstantsEx.au3>

GUICreate("name", 335, 100)

GUICtrlCreateLabel("Key", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 8, 120)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 35, 40, 120)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)
$stopbutton = GUICtrlCreateButton ("Stop", 190, 40, 60)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()

Select

Case $msg = $startbutton
$send1 = GUICtrlRead($key1)
$sleep1 = GUICtrlRead($time1)
While 1
Send($send1)
Sleep($sleep1)
WEnd

Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
ExitLoop

EndSelect

WEnd



Wie mach ich das jetzt das er, wenn man den Stop Button klickt, aufhört zu schreiben?

Dankee schonmal
04/17/2010 09:59 FrEakY.#2
würde es dir denn nicht reichen einen shortcut fürs stoppen zu haben ?

Hier ist mal ein einigermasen gutes Script mit Shortcut
04/17/2010 10:20 .nAno#3
PHP Code:
...

Case 
$msg $startbutton
$send1 
GUICtrlRead($key1)
$sleep1 GUICtrlRead($time1)

$running True

While $running 
Send
($send1)
$Timestamp TimerInit()
     Do
           Switch 
GuiGetMsg()
            Case 
$stopbutton
             $running 
False
            
Case $GUI_EVENT_CLOSE
             
Exit
           EndSwitch
     
     
Until Timerdiff $timestamp ) >= $sleep1

WEnd

... 
Das Tauschen von Sleep mit Timer und Do/Until dient dazu, dass der Button/Exitbutton auch während der Pause funktionieren ;)
04/18/2010 16:57 Sir Ryuuzaki#4
Quote:
Originally Posted by .nAno View Post
PHP Code:
...

Case 
$msg $startbutton
$send1 
GUICtrlRead($key1)
$sleep1 GUICtrlRead($time1)

$running True

While $running 
Send
($send1)
$Timestamp TimerInit()
     Do
           Switch 
GuiGetMsg()
            Case 
$stopbutton
             $running 
False
            
Case $GUI_EVENT_CLOSE
             
Exit
           EndSwitch
     
     
Until Timerdiff $timestamp ) >= $sleep1

WEnd

... 
Das Tauschen von Sleep mit Timer und Do/Until dient dazu, dass der Button/Exitbutton auch während der Pause funktionieren ;)
Stimmt, das war auch noch ein Problem :facepalm:


Aber ich hätte ihn doch gerne dabei, besser wärs noch wenn sich das programm nicht ganz schließt sondern nur pausiert!?

any idea?
04/19/2010 17:14 .nAno#5
jap, tausch einfache Exit gegen die neue Deklarartion von $running aus ;)

Der "Schlißen" Button (--> das Kreuz oben rechts) wird eig. auch wie eben ein ganz normaler Button behandelt, nur das er immer eine bestimmte ControlID hat.
$GUI_EVENT_CLOSE ist nur eine Konstante die diesen immer gleichen Wert beinhaltet