Jump to content
Sign in to follow this  
riceking

Bunch of "Send()" Questions

Recommended Posts

riceking

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.


\

Share this post


Link to post
Share on other sites
E1M1

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

2) sleep(1000); 1 sec pause

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


edited

Share this post


Link to post
Share on other sites
riceking

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.


\

Share this post


Link to post
Share on other sites
somdcomputerguy

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.

Share this post


Link to post
Share on other sites
riceking

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

\

Share this post


Link to post
Share on other sites
riceking

Loops are quite new to me, can you give me an example.


\

Share this post


Link to post
Share on other sites
riceking

How would I do a limited time loop instead of the infinite loop.


\

Share this post


Link to post
Share on other sites
Richard Robertson

You don't want a loop. I don't know why JohnOne suggested that.

Send("{Right down}")
Sleep($milliseconds)
Send("{Right up}")

Share this post


Link to post
Share on other sites
somdcomputerguy

Alot depends on what $Variable is. One way could be like this..

For $Variable = 1 To 25
 Send("{RIGHT}")
 Sleep(250)
Next
Edited by somdcomputerguy

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

Share this post


Link to post
Share on other sites
riceking

Loop because I don't want to hold it, I want to press it repeatedly for $Variable time length. $Variable could be 5 seconds.


\

Share this post


Link to post
Share on other sites
somdcomputerguy

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


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

Share this post


Link to post
Share on other sites
riceking

#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()

\

Share this post


Link to post
Share on other sites
somdcomputerguy

Without more code, Sleep's lowest effective value is 10.

Click here, Timers Management, or read this section in the local Help file.

Edited by somdcomputerguy

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

Share this post


Link to post
Share on other sites
riceking

#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?


\

Share this post


Link to post
Share on other sites
somdcomputerguy

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.

Share this post


Link to post
Share on other sites
riceking

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}")?


\

Share this post


Link to post
Share on other sites
Jos

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?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
riceking

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

\

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.