Spiga

How to Make Your Computer Press a Key Every X Seconds



Have you ever needed to press a key every couple of seconds, or every few minutes? Perhaps you’re playing a video game and you’re waiting for an item, or you’ve got some other reason. Either way, here’s how to make your PC do it automatically.


You’ll need to start by downloading and installing AutoHotkey, which is a simple scripting language that allows you to create easy scripts. Once you do that, right-click anywhere and choose New –> AutoHotkey Script.


Once you’ve done that, paste the following into the script:


#Persistent
SetTimer, PressTheKey, 1800000
Return


PressTheKey:
Send, {Space}
Return



This simple script will wait every 30 minutes and press the Spacebar. You can adjust the 1800000 number above to the amount of milliseconds required. So, for example, if you wanted it to run every 2 minutes, you’d use 60 seconds * 2 minutes * 1000 milliseconds = 120000 total milliseconds.


Save the file name as whatever you’d like, and then double-click on it to run it.


You can also send another hotkey or any number of characters just by changing the Send, {Space} line to something else—you can literally type out some letters you want to send, or you can use some of the special keys on the AutoHotkey documentation page. For example, to make it send the word “lazy” and then press the Space bar, you could use:


Send,lazy{Space}



I’m not entirely certain what you’ll want to use this for, but that’s what makes scripting so much fun.


0 nhận xét:

Your IP

IP
Blogger Widgets

Copy code, paste your site:

<p><span style="text-align:center; display: block;"><a href="http://win7-vista.blogspot.com/2011/02/get-ip-address-widget-for-your-blogger.html"><img src="http://www.wieistmeineip.de/ip-address/?size=468x60" border="0" width="468" height="60" alt="IP" /></a><br /><small><a href="http://win7-vista.blogspot.com/2011/02/get-ip-address-widget-for-your-blogger.html">Blogger Widgets</a></small></span></p>