Sign in to follow this  
Followers 0
riceking

Random + KeyDown

10 posts in this topic

$Random = Random(25, 100, 1)
Send("{Right down}")
Sleep($Random)
Send("{Right up}")

It only sends right once then stops. Help please.


\

Share this post


Link to post
Share on other sites



riceking,

It only sends right once then stops

Which is exactly what I would expect it to do. :

You are asking AutoIt to press the key, wait for 25 to 100 milliseconds, and then release the key. Typical typematic delays are of the order of 200-500 ms, so there is little chance of that intervening to pump out multiple ketstrokes. You asked for one keystroke, and one keystroke you got. ;)

Help please

To do what? :blink: Please try and formulate sensible questions or we cannot offer any advice. :P

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

O, I'm sorry, then shall I refrase?

How do I hold down a key and have it send the key value for a certain time without send("{right}") and looping it. Like the average computer when you hold the key it would send more then one. Holding it down is different then spamming the key, as spamming the key is has a different purpose, I just want to have it held down and send continuous keys for a random time then stop sending. I hope I made sense >.<

Edit:

So should I increase the range for random?

Edited by riceking

\

Share this post


Link to post
Share on other sites

riceking,

I now understand what you want, although I do not understand why you want it! ;)

As I mentioned above, you need to keep the key held down long enough to get the typematic repeats started. As the shortest typematic delay is usually about 200ms (any lower and you tend to get "key bounce" problems) I would suggest changing your Sleep statement to read:

Sleep(200 + $Random)

Now you stand a fair chance of getting the typematic repeats triggering and thus producing a stream of keystrokes until you release the key.

Would you mind explaining why you want to do this? :blink:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Just a view count script on my photobucket :blink: almost like youtube but different. If you double right arrow it moves to another picture, if you hold it scrolls through your own album = more hits/views

Edit:

I've tested it, only sends 1 right the stops. I've tried extending the sleep time but it still doesn't work ;)

Edited by riceking

\

Share this post


Link to post
Share on other sites

I've said multiple sends don't function as a send and hold down.


\

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