ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Variable-speed repeated button press

(1/1)

nkormanik:
Imagine repeatedly pressing the Page-Down key.  It can get old fast.  Poor index finger.

Suppose we have a Page-Down that automatically repeats.  Once every 5 seconds (the 'default').  For 100 rounds.

How cool would that be??!!

Here's the huge challenge:  Create the above.  With the following addition....

If user presses the Ctrl-Minus key, we multiply the 5 seconds by 1.05, and use that value in between each round.

If user presses the Ctrl-Plus key, we multiply the 5 seconds by 0.95, and use that value in between each round.

The idea is to get a 'variable-speed' repeated button press.

Here is some of the logic, as I see it:

There is a 'default' amount of time between button presses.  Say, 5 seconds.  There is some variable somewhere holding this value.  Let's call the variable "Rest."

Every time the user hits Ctrl-Minus, the little program looks for the variable "Rest," multiplies it by 1.05, and writes that result back to the variable location.  So, "Rest" is now 5.25.

If user hits Ctrl-Minus another time, current value of "Rest" is multiplied by 1.05, with the result then written to the variable.  "Rest" then becomes 5.51.  Etc.  Etc.

Hitting Ctrl-Plus has the opposite effect.  "Rest" value is multiplied by 0.95.

So, the 'loop' for each round looks something like this:

1.  Check value of "Rest."
2.  Wait that long.
3.  Press the Page-Down key.

Any thoughts greatly appreciated.  If you were to write such a program, what programming language would you use?

Nicholas Kormanik



Navigation

[0] Message Index

Go to full version