Simple repeating script help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
HerrTrigger

Simple repeating script help  Topic is solved

13 Jul 2018, 18:14

Can someone please help me. I need a script to hold down “w” and “shift” and repeatedly press “c” about once or twice a second.
MannyKSoSo
Posts: 440
Joined: 28 Apr 2018, 21:59

Re: Simple repeating script help

13 Jul 2018, 20:30

First we will start off with the Shift and W key which can be found with sendinput here https://autohotkey.com/docs/commands/Se ... nputDetail
Since we want them held down use the specific name of "Down" and "Up" to specify that its being held
Next since you want a random number we can get it using Random found here https://autohotkey.com/docs/commands/Random.htm
This function uses the Mersenne Twister random number generator, MT19937, written by Takuji Nishimura and Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada.

The Mersenne Twister is an algorithm for generating random numbers. It was designed with consideration of the flaws in various other generators. The period, 219937-1, and the order of equidistribution, 623 dimensions, are far greater. The generator is also fast; it avoids multiplication and division, and it benefits from caches and pipelines. For more information see the inventors' web page at www.math.keio.ac.jp/~matumoto/emt.html

Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Do NOT use for CRYPTOGRAPHY without securely hashing several returned values together, otherwise the generator state can be learned after reading 624 consecutive values.

When you use this, send an email to: [email protected] with an appropriate reference to your work. It would be nice to CC: [email protected] and [email protected] when you write.

This above has been already been done for AutoHotkey, but if you use the Random command in a publicly distributed application, consider sending an e-mail to the above people to thank them.
Now that its completed we will add a toggle (don't know about you but I don't want to have it running forever unless I stop the script).
For that you can read up on in the main documentation https://autohotkey.com/docs/AutoHotkey.htm

Once you have all of that TADA! You have a working code!

Full Code with Toggle
Spoiler

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 305 guests