Auto keystroke script

Exwizz

Legend
Legendary
Feb 1, 2010
3,206
62
175
Newcastle
ive downloaded a program and made sense of launching a program but i cant seem to grasp how to make it press a number key ever 20mins :S
Keystrokes are sent to the active (foremost) window by using the Send command. In the following example, Control+Alt+S becomes a hotkey to type a signature (ensure that a window such as an editor or draft e-mail message is active before pressing Win+S):
^!s:: Send Sincerely,{Enter}John Smith return In the above example, all characters are sent literally except {Enter}, which simulates a press of the Enter key. The next example illustrates some of the other commonly used special characters:
Send ^c!{tab}pasted:^v The line above sends a Control+C followed by an Alt+Tab followed by the string "pasted:" followed by a Control+V. See the Send command for a complete list of special characters and keys.
Finally, keystrokes can also be sent in response to abbreviations you type, which are known as hotstrings. For example, whenever you type Btw followed by a space or comma, the following line will replace it with "By the way":

any ideas or is anyone actually willing to make the script for me?

thanks
 

JealY

LOMCN VIP
VIP
Nov 28, 2004
5,354
52
305
England
Ah yeah that's the one... well if you want something to just press one key then just download "Key Presser".
 

Pottsy

Legend
Legendary
Feb 26, 2004
3,275
252
329
Or better still, buy one of the Macro keyboards from Logitech :P get a new keyboards at the same time as being able to do that sort of stuff
 

Exwizz

Legend
Legendary
Feb 1, 2010
3,206
62
175
Newcastle
Yeh, ive tryed a few and it appears i have a virus fking my pc up lol...

cant keep a wepage, game, movie up without it minimizing or clicking off with.. weird downloads appearing from nowhere... messages poping up from my web browser when im not even on the web lol

and to top it off my anti virus wont pick up the virus...
 

Hazuki

VIP
VIP
Apr 14, 2004
3,459
38
285
United Kingdom
Code:
#SingleInstance, Force
#Persistent
#NoEnv

[B][COLOR="red"]^1[/COLOR][/B]::WinGet, active_id, PID, A

[COLOR="red"][B]PgDn[/B][/COLOR]::
loop
{
ControlSend, , {[B][COLOR="red"]2[/COLOR][/B]}, ahk_pid %active_id%
Sleep [COLOR="red"][B]1000[/B][/COLOR]
}

^1: ^ = Ctrl. Press Ctrl + 1 on the active window.
PgDn: PgDn to start the loop.
2: Key that is pressed on the keyboard
1000: Time in ms.

Click here for a reference list.

Save this as filename.ahk and run. With the window selected you want the 2 key to be press on hold Ctrl + 1 to activate the window. Then press page down to activate the loop. To stop the loop pause or close AHK.
 

Exwizz

Legend
Legendary
Feb 1, 2010
3,206
62
175
Newcastle
Code:
#SingleInstance, Force
#Persistent
#NoEnv

[B][COLOR="red"]^1[/COLOR][/B]::WinGet, active_id, PID, A

[COLOR="red"][B]PgDn[/B][/COLOR]::
loop
{
ControlSend, , {[B][COLOR="red"]2[/COLOR][/B]}, ahk_pid %active_id%
Sleep [COLOR="red"][B]1000[/B][/COLOR]
}

^1: ^ = Ctrl. Press Ctrl + 1 on the active window.
PgDn: PgDn to start the loop.
2: Key that is pressed on the keyboard
1000: Time in ms.

Click here for a reference list.

Save this as filename.ahk and run. With the window selected you want the 2 key to be press on hold Ctrl + 1 to activate the window. Then press page down to activate the loop. To stop the loop pause or close AHK.

You legend.
 

Jamie

LOMCN Developer
Developer
Mar 29, 2003
4,797
299
370
United Kingdom
Code:
#SingleInstance, Force
#Persistent
#NoEnv

[B][COLOR="red"]^1[/COLOR][/B]::WinGet, active_id, PID, A

[COLOR="red"][B]PgDn[/B][/COLOR]::
loop
{
ControlSend, , {[B][COLOR="red"]2[/COLOR][/B]}, ahk_pid %active_id%
Sleep [COLOR="red"][B]1000[/B][/COLOR]
}

^1: ^ = Ctrl. Press Ctrl + 1 on the active window.
PgDn: PgDn to start the loop.
2: Key that is pressed on the keyboard
1000: Time in ms.

Click here for a reference list.

Save this as filename.ahk and run. With the window selected you want the 2 key to be press on hold Ctrl + 1 to activate the window. Then press page down to activate the loop. To stop the loop pause or close AHK.

If you were to select another window, I assume that it would send the keys to the window you set?