Balug Posted October 15, 2008 Share Posted October 15, 2008 Hey guys, i got a question. I wanna create a bot then when you press F10 that he will press press enter and then re-press enter untill u press F11 to stop it. I allready got this: #Include <Misc.Au3> Hotkeyset("{F10}", "Start") HotKeySet("{F11}", "Stop") GUICtrlCreateLabel("Press F10 to Start The bot!") GUICtrlCreateLabel("Press F11 to Stop The bot!") but now i dono how to continue. could you explain to me how to continue? Thanks ~B Link to comment Share on other sites More sharing options...
SoulA Posted October 15, 2008 Share Posted October 15, 2008 #Include <Misc.Au3> Hotkeyset("{F10}", "Start") HotKeySet("{F11}", "Stop") MsgBox(0,"Hello", "Press F10 to Start The bot!" & @CRLF & "Press F11 to Stop The bot!") While 1 sleep(50) WEnd Func Start() MsgBox(0,"Test", "F10 was pressed!") EndFunc Func Stop() MsgBox(0,"Test", "F11 was pressed!") EndFunc Link to comment Share on other sites More sharing options...
Andreik Posted October 15, 2008 Share Posted October 15, 2008 (edited) Hey guys, i got a question. I wanna create a bot then when you press F10 that he will press press enter and then re-press enter untill u press F11 to stop it. I allready got this: #Include <Misc.Au3> Hotkeyset("{F10}", "Start") HotKeySet("{F11}", "Stop") GUICtrlCreateLabel("Press F10 to Start The bot!") GUICtrlCreateLabel("Press F11 to Stop The bot!") but now i dono how to continue. could you explain to me how to continue? Thanks ~BThis should work (not tested): HotKeySet("{F10}","SendEnter") HotKeySet("{F11}","StopSend") Global $STATE While 1 Sleep(50) WEnd Func SendEnter() $STATE = 0 Do Send("{ENTER}") Until $STATE = 1 EndFunc Func StopSend() $STATE = 1 EndFunc Edited October 15, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Balug Posted October 15, 2008 Author Share Posted October 15, 2008 (edited) Could you explain more please cause i wanna learn from it to! And thanx:) btw: i want him to press {ENTER} Each 500 ms. not that when u press F10 that he Once Press {ENTER} Edited October 15, 2008 by Balug Link to comment Share on other sites More sharing options...
DexterMorgan Posted October 15, 2008 Share Posted October 15, 2008 (edited) ;#Include <Misc.Au3> No need for this Hotkeyset("{F10}", "Start") HotKeySet("{F11}", "Stop") ;GUICtrlCreateLabel("Press F10 to Start The bot!") No need for this (You have no GUI) ;GUICtrlCreateLabel("Press F11 to Stop The bot!") No need for this (You have no GUI) MsgBox(0,"Instructions", "Press F10 to Start, F11 to Stop") ; Tell the user how this works with a message box $x = 1 ; random variable While 1 ; Start an infinite loop if $x = 1 then ; Checks if $x = 1 if it is it will sleep sleep(10) ; This will keep the script running ,but will do nothing Endif If $x = 0 ; Checks if $x = 0 if it is then it will press enter send('{Enter}') ; Sends enter sleep(500) ; sleeps for 500 ms Endif WEnd Func start(); if you press F10 this will happen $x = 0 ; Change $x to equal 0 Endfunc Func stop(); if you press F11 this will happen $x = 1; Change $x to equal 0 Endfunc I think that will work Edited October 15, 2008 by DexterMorgan code Link to comment Share on other sites More sharing options...
andybiochem Posted October 15, 2008 Share Posted October 15, 2008 This should work (not tested): HotKeySet("{F10}","SendEnter") HotKeySet("{F11}","StopSend") Global $STATE Func SendEnter() $STATE = 0 Do Send("{ENTER}") Until $STATE = 1 EndFunc Func StopSend() $STATE = 1 EndFunc Heh! whooOOooosh!! Wanna put a loop in there Andreik? Here's another way with an explanation: ;----- This include holds the variables/functions for _IsPressed ----- #include <Misc.au3> ;----- we're going to be using _IsPressed a lot so we open up the dll ----- $dll = DllOpen("user32.dll") ;----- while 1 = 1 ....i.e. ALWAYS! ----- While 1 = 1 ;----- sleep for 100 ms ----- Sleep(100) ;----- if F10 is pressed... (79 = F10 in hex) ----- If _IsPressed("79", $dll) = 1 Then ;----- do the follwing ----- Do ;----- send ENTER keypress ----- Send("{ENTER}") ;----- sleep for 500 ms ----- Sleep(500) ;----- until F11 is pressed (7A = F11 in hex) ----- Until _IsPressed("7A", $dll) = 1 ;----- complete the 'IF' syntax ----- EndIf ;----- complete the 'while' syntax ----- WEnd Be careful with this script, if you run it when you don't need it you'll find windows opening all over the place! Best to put in conditions eg make sure WinExists = 1, so you can target the correct window. - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
Balug Posted October 15, 2008 Author Share Posted October 15, 2008 Heh! whooOOooosh!! Wanna put a loop in there Andreik? Here's another way with an explanation: ;----- This include holds the variables/functions for _IsPressed ----- #include <Misc.au3> ;----- we're going to be using _IsPressed a lot so we open up the dll ----- $dll = DllOpen("user32.dll") ;----- while 1 = 1 ....i.e. ALWAYS! ----- While 1 = 1 ;----- sleep for 100 ms ----- Sleep(100) ;----- if F10 is pressed... (79 = F10 in hex) ----- If _IsPressed("79", $dll) = 1 Then ;----- do the follwing ----- Do ;----- send ENTER keypress ----- Send("{ENTER}") ;----- sleep for 500 ms ----- Sleep(500) ;----- until F11 is pressed (7A = F11 in hex) ----- Until _IsPressed("7A", $dll) = 1 ;----- complete the 'IF' syntax ----- EndIf ;----- complete the 'while' syntax ----- WEnd Be careful with this script, if you run it when you don't need it you'll find windows opening all over the place! Best to put in conditions eg make sure WinExists = 1, so you can target the correct window.Nice i think that was what i was looking for will check atm Thanks for the Explain with it. Thanks for the Other fast reply's to! Link to comment Share on other sites More sharing options...
Andreik Posted October 15, 2008 Share Posted October 15, 2008 Heh! whooOOooosh!! Wanna put a loop in there Andreik? Here's another way with an explanation: ;----- This include holds the variables/functions for _IsPressed ----- #include <Misc.au3> ;----- we're going to be using _IsPressed a lot so we open up the dll ----- $dll = DllOpen("user32.dll") ;----- while 1 = 1 ....i.e. ALWAYS! ----- While 1 = 1 ;----- sleep for 100 ms ----- Sleep(100) ;----- if F10 is pressed... (79 = F10 in hex) ----- If _IsPressed("79", $dll) = 1 Then ;----- do the follwing ----- Do ;----- send ENTER keypress ----- Send("{ENTER}") ;----- sleep for 500 ms ----- Sleep(500) ;----- until F11 is pressed (7A = F11 in hex) ----- Until _IsPressed("7A", $dll) = 1 ;----- complete the 'IF' syntax ----- EndIf ;----- complete the 'while' syntax ----- WEnd Be careful with this script, if you run it when you don't need it you'll find windows opening all over the place! Best to put in conditions eg make sure WinExists = 1, so you can target the correct window. I have a do loop. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
DexterMorgan Posted October 15, 2008 Share Posted October 15, 2008 I personally think my example was best LOL code Link to comment Share on other sites More sharing options...
andybiochem Posted October 15, 2008 Share Posted October 15, 2008 I have a do loop.lol, ok then. Your script seems to terminate awfully fast!Respect - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
Andreik Posted October 15, 2008 Share Posted October 15, 2008 lol, ok then. Your script seems to terminate awfully fast!Respect You are right.I don't have a main loop. I thought not send the ENTER key repeatedly.Thanks for observation. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Balug Posted October 15, 2008 Author Share Posted October 15, 2008 (edited) i just put WinExists = 1 between the source cause without it wont work ---------------------------------------------- wont work with WinExists = 1 either. I think its just because of the game or programm Edited October 15, 2008 by Balug Link to comment Share on other sites More sharing options...
andybiochem Posted October 15, 2008 Share Posted October 15, 2008 (edited) i just put WinExists = 1 between the source cause without it wont work ----------------------------------------------wont work with WinExists = 1 either.I think its just because of the game or programmNo, sorry, I didn't mean to use that literally - I was being pragmatic, it will need to look something like:If WinActive("Name of your game/window goes here") = 1 Then Send("{ENTER}")...but you'll need to find the name of the window you're targetting. Edited October 15, 2008 by andybiochem - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
AlmarM Posted October 15, 2008 Share Posted October 15, 2008 (edited) What about this HotKeySet("{F10}", "_DoFunc") Global $State = 0 While 1 Sleep(1000) WEnd Func _DoFunc() $State = Not $State While $State = 1 Send("{ENTER}") WEnd EndFunc AlmarM Edited October 15, 2008 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. 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