Jump to content

Bunch of "Send()" Questions


Recommended Posts

I just finished the GUI of my script and now its time to finish the script. If anyone can answer some of them it would be great.

1) How do you hold down a key for a certain length in milliseconds.

2) How do you pause between Send()s commands.

3) How do you send combined keystrokes, Left Arrow + Alt.

Haha I thought I had more questions, I guess not. Thanks in advance.

\

Link to comment
Share on other sites

1) like that send("{key down}")

2) sleep(1000); 1 sec pause

3)like that send("!{left}")

So ! = Alt? Does anyone know the symbol for CTRL. Also what do you mean by key down, any key? Like Right Arrow, You'd just put Send({Right}) and it would hold it? How do you control how long it holds it down for.

\

Link to comment
Share on other sites

Read up here, Send, and this extremely important section of the Help file will most probably answer everything you need to know about Send and were about to ask.. :blink: More questions will arise I'm sure, but the Help file covers just about everything.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Thanks it helped tons. However, how do I send a key for a certain amount of time.

I want to send CTRL for $Variable amount of time, how would I get that to work. I don't want it held down, I want to continuously press it for a certain amount of time.

Edited by riceking

\

Link to comment
Share on other sites

#include <Timers.au3>
$Variable = 5
$timestart = _Timer_Init()
Do
    Send("{RIGHT}")
    Sleep(250)
Until _Timer_Diff($timestart) >= $Variable * 1000

Just a note.. This isn't extremely accurate, but it does work..

Thanks, is it okay if I remove the sleep or put it to a really low number such as 1. Can anyone elaborate more on _Timer_Diff and _Timer_Init()

\

Link to comment
Share on other sites

#include <Timers.au3>
$Variable = 5
$timestart = _Timer_Init()
Do
    Send("{RIGHT}")
    Sleep(250)
Until _Timer_Diff($timestart) >= $Variable * 1000

Just a note.. This isn't extremely accurate, but it does work..

Doesn't seem to work, goes on endlessly, it doesn't stop after 5 seconds. I looked at that page and it seems quite complex action for a simple repeatly press for 5 seconds. Also it's okay not to put any sleep correct?

\

Link to comment
Share on other sites

Hmm. This works Ok for me. I wouldn't go lower than 100 for a Sleep value, and I would put some Sleep in that loop, but that's me..

#include <Timers.au3>
$Variable = 5
$timestart = _Timer_Init()
Do
    ConsoleWrite("RightArrow" & @LF)
    Sleep(100)
Until _Timer_Diff($timestart) >= $Variable * 1000

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

  • Developers

Alright thanks for the help :blink: @LF is line feed, what does that do. Also If I want to hold multiple arrow keys down would it be Send("{LEFT down}{UP down}")?

Do you even try to find an answer on any of your questions or are you simply dumping them all here to get them answered?

Just locked one of your topics as it is a forbidden subject and my guess is that this is just more of the same..... right?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I'm not talking about any forbidden games, I'm just asking questions in general. Sorry for any misunderstanding, I'm finding out on my own, experimenting, and posting questions to finish the script ASAP. Sorry for my troubles.

Edited by riceking

\

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