Jump to content

Key "Bot"


Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Whats a loap?

[u]Helpful tips:[/u]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.[u]Useful links:[/u]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[quote]<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[/quote]

Link to comment
Share on other sites

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

[u]Helpful tips:[/u]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.[u]Useful links:[/u]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[quote]<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[/quote]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...