Sign in to follow this  
Followers 0
jpdeadly

Help with keypressing

6 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Edited by Jayson

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

The same idea behind both projects i know but i really don't wanna have the disrespect of the community right from the bat haha, i just wanna learn hotkeying and inputs right now then im going for mouse automation

Share this post


Link to post
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
Sign in to follow this  
Followers 0