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

Key "Bot"


  • Please log in to reply
6 replies to this topic

#1 codename23

codename23

    Seeker

  • Active Members
  • 5 posts

Posted 02 February 2009 - 04:14 PM

Hello, I'm new user of AutoIT and need make easy key bot
Can any one help me pls ?

when i press key "F5" ... program start function "keyset1" keyset1 = send key "A", wait "100ms", send key "B", wait "100ms", send key "C", wait "100ms" and loap when i press key "F6" ... program start function "keyset2" keyset2 = send key "D", wait "100ms", send key "E", wait "100ms", send key "F", wait "100ms" and loap when i press key "F7" ... program stop loap of "keyset1" when i press key "F8" ... program stop loap of "keyset1" when i press key "F9" ... program start all loap when i press key "F10" ... program stop all loap


Thanks very much ... i need learn language of this program now :)

Edited by codename23, 02 February 2009 - 04:15 PM.








#2 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,587 posts

Posted 02 February 2009 - 04:17 PM

Hello, I'm new user of AutoIT and need make easy key bot
Can any one help me pls ?

when i press key "F5" ... program start function "keyset1" keyset1 = send key "A", wait "100ms", send key "B", wait "100ms", send key "C", wait "100ms" and loap when i press key "F6" ... program start function "keyset2" keyset2 = send key "D", wait "100ms", send key "E", wait "100ms", send key "F", wait "100ms" and loap when i press key "F7" ... program stop loap of "keyset1" when i press key "F8" ... program stop loap of "keyset1" when i press key "F9" ... program start all loap when i press key "F10" ... program stop all loap


Thanks very much ... i need learn language of this program now :)

Read in help file about HotKeySet(), Sleep(), Send() and something about functions.
When the words fail... music speaks

#3 codename23

codename23

    Seeker

  • Active Members
  • 5 posts

Posted 02 February 2009 - 04:26 PM

TY for reaction ... but i need for learn easy exempl of that :)

#4 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,587 posts

Posted 02 February 2009 - 04:30 PM

TY for reaction ... but i need for learn easy exempl of that :)

And in help file exist examples of this functions. You need just start learn how to use them.

Edited by Andreik, 02 February 2009 - 04:31 PM.

When the words fail... music speaks

#5 SpookMeister

SpookMeister

    Peanut Gallery

  • Active Members
  • PipPipPipPipPipPip
  • 840 posts

Posted 02 February 2009 - 04:46 PM

Whats a loap?
Helpful tips:If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.Useful links:BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE

<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers


#6 codename23

codename23

    Seeker

  • Active Members
  • 5 posts

Posted 02 February 2009 - 04:58 PM

sry ... i mean loop

#7 SpookMeister

SpookMeister

    Peanut Gallery

  • Active Members
  • PipPipPipPipPipPip
  • 840 posts

Posted 02 February 2009 - 05:16 PM

Here is an example... probably wont be as efficient as you want.. but its a place to start
CODE
;#include <Misc.au3>
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F5}", "Start1")
HotKeySet("{F6}", "Start2")
HotKeySet("{F7}", "Stop1")
HotKeySet("{F8}", "Stop2")
HotKeySet("{F9}", "StartAll")
HotKeySet("{F10}", "StopAll")

Opt("SendKeyDelay", 100) ; delay between sending keys - default 5
Opt("SendKeyDownDelay", 5) ; how long to hold down a key - default 5
Global $flag1 = 0, $flag2 = 0

While 1
Sleep(100) ; always a good idea so you dont max your cpu
If $flag1 Then Send("abc")
If $flag2 Then Send("def")
WEnd

Func Start1()
$flag1 = 1
EndFunc ;==>Start1

Func Start2()
$flag2 = 1
EndFunc ;==>Start2

Func Stop1()
$flag1 = 0
EndFunc ;==>Stop1

Func Stop2()
$flag1 = 0
EndFunc ;==>Stop2

Func StartAll()
$flag1 = 1
$flag2 = 1
EndFunc ;==>StartAll

Func StopAll()
$flag1 = 0
$flag2 = 0
EndFunc ;==>StopAll

Func Terminate()
Exit 0
EndFunc ;==>Terminate

Helpful tips:If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.Useful links:BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE

<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users