Jump to content

Help with keypressing


Recommended Posts

Hello there I'm very new to AutoIT, today is the first day i started messing with it a few hours ago and i have a little learning project I'm doing.

I need a script to open 5 input boxes with user information typed in those boxes, each input for each box will then be hot keyed from key 1 - 5 doing the command they type in. here is what i go so far with it working 100% "only with two inputs will it not loop and screw up."

What im looking for is to add 3 more options of input without it looping out and messing up, any help or incite would be awesome

$a = InputBox(" AutoSpawn","Please Enter Item Command First Item")
$b = InputBox(" AutoSpawn","Please Enter Item Command Second Item")


Opt('SendKeyDelay', 5)
Opt('SendKeyDownDelay', 5)

HotKeySet("{1}", "Item1")
HotKeySet("{2}", "Item2")


While 1
    Sleep(1000) ; I put a sleep here so our program doesn't use 100% of the CPU.
WEnd


Func Item1()
    send("T")
    sleep(100)
    send($a)
    send("{ENTER}")
EndFunc

Func Item2()
   send("T")
   sleep(100)
   send($b)
   send("{ENTER}")
EndFunc
Link to comment
Share on other sites

it seems to just keep typing and not hitting enter after the commands given from user

Hello there I'm very new to AutoIT, today is the first day i started messing with it a few hours ago and i have a little learning project I'm doing.

I need a script to open 5 input boxes with user information typed in those boxes, each input for each box will then be hot keyed from key 1 - 5 doing the command they type in. here is what i go so far with it working 100% "only with two inputs will it not loop and screw up."

What im looking for is to add 3 more options of input without it looping out and messing up, any help or incite would be awesome

$a = InputBox(" AutoSpawn","Please Enter Item Command First Item")
$b = InputBox(" AutoSpawn","Please Enter Item Command Second Item")


Opt('SendKeyDelay', 5)
Opt('SendKeyDownDelay', 5)

HotKeySet("{1}", "Item1")
HotKeySet("{2}", "Item2")


While 1
    Sleep(1000) ; I put a sleep here so our program doesn't use 100% of the CPU.
WEnd


Func Item1()
    send("T")
    sleep(100)
    send($a)
    send("{ENTER}")
EndFunc

Func Item2()
   send("T")
   sleep(100)
   send($b)
   send("{ENTER}")
EndFunc

Edited by jpdeadly
Link to comment
Share on other sites

EDIT it seems that the "/" Char is what is screwing up the functions of the hot key. if i type all letters then all 4 of my input boxes will type what was put in them. but if i put "/roggger 3 64" in the boxes it will loop out on the first hot key press. whats most important is that i will need the "/" Char as the first thing they type in

"Ex = /give jim 3 64 apples"

every input box WILL have the slash in front of it

Link to comment
Share on other sites

Is this for MineCraft since your first post was related to this today.

Since its not allowed i scrapped the idea on that, this is just for learning purposes. Can i say ill never use AutoIT for games and other programs i use no but i'm nowhere near good enough to start anything like that now. what this is for is an addition to a VB.NET program I'm writing / relearning how to code as well.

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...