# Hold key macro function



## aleximila

I need to find a macro program that enables me to set the instruction to hold a key down for a set period of time and then release it. For instance, i wish to have a macro that holds the spacebar down for x seconds.

Does anyone know how to do this or if its even possible.

Thanks in advance.


----------



## Lorand

It's possible, since key-press and key-release are two different events.
So theoretically it's very simple: write a program that simulates a key-press, wait for x seconds then simulate a key-release.
Unfortunately I don't know any macro program that can do that, but I found a source that can be modified to do what you want: http://www.bsdg.org/SWAG/DELPHI/0168.PAS.html


----------



## aleximila

Thanks Lorand....i'm not entirely sure how useful that will be as the only experience i have with macro writing is fairly limited. Ill just have to learn a little more.


----------



## Lorand

Try this one: http://www.hiddensoft.com/autoit3/, I think it can do the job.
And it's free!


----------



## aleximila

That looks like it should do the job....many thanks Lorand.


----------



## Lorand

Wow, it's very simple with that program:

Send("{SPACE down}")
Sleep(X)
Send("{SPACE up}")


----------



## Nanobyte

AutoIt is not the most user-friendly program although it can do a lot of things. Scripts can be compiled into an exe for use on any PC.  I use it plus Macro Express Pro (payware).  MEPro is a lot more user-friendly, quicker to get up to speed with.  Mostly programming via dialogs.

You can save huge numbers of keystrokes for routine tasks with these utilities.  Virtually anything you can do manually you can duplicate automatically.  The simple example in this thread could save hours of finger pressing!


----------

