write me an autohotkey script


I'm not a programmer and don't have time tonight to learn the formatting in's and out's of autohotkey

Can one of you experts build me an autohotkey script which does this:

   1. begin a loop of 800 cycles
 a. wherever the mouse happens to be, send a normal single click
b. sleep a random amount of time between 2000ms and 4000ms
c. send a keypress of the "1" key
d. sleep a random 2-4 seconds again (a new random not the same as before)
e. send the "1" key again
f. sleep a random 2-4 seconds again (another new seed)
g. send the spacebar
h. sleep 18 to 22 seconds and repeat next increment of this loop (as long as capslock is on, else stop)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EE is not a free version of rent-a-coder.  The EE experts can help you with your scripts, but you must put in some effort.

You may want to consider contacting the top experts in the applicable zones to see if they have their Hire Me link enabled.  The most applicable zones for that search are (VBScript and Visual Basic Programming - VB6).
Joe Winograd, Fellow&MVEDeveloperCommented:
Sounds like a homework assignment to me. :)
FocISAuthor Commented:
Well, it isn't a homework assignment (i have been out of school for almost 20 years now) just an effort to get an automated task done in a short amount of time...  sort of like getting an oil change without first having to learn how to do it myself.  

Sometimes the answer to every single thing a person can need isn't to learn everything about how to do it first, sometimes it has to be ok to ask for help to just get it done in the interest of time.  I'm not a programmer, I don't write code, and I have no time or interest in perusing that skill set.  I simply have a task, and a tool; seeking help how to use the tool for this task.

I didn't realize there was a rule or requirement set on EE that says someone has to put in a sufficient level of effort which those experts determine is either good enough or not good enough.  Obviously experts can choose to help, or not help as you two have.

If someone who is already an expert in scripting (especially with AutoHotKey) would like an easy 500 points for what's probably 2 minutes of work, I'd love to see and use the script.

I understand it's not a free version of rent-a-coder, and you understand it's not always FREE either, we're on a paid subscription.  You have your subscription for free by answering questions (as you should) - we paid real money to be here.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

If you make a little effort, you will get a much more robust response from the (volunteer) experts.
Joe Winograd, Fellow&MVEDeveloperCommented:
Well, the reason I said "homework assignment" is that I can't for the life of me figure out how this is a useful program in the real world — so my gut was that it's a homework assignment in order to learn something about AutoHotkey, which, from your comments, you are obviously not interested in doing. So although I can't figure out why you want this, here's the AutoHotkey code that does exactly what you asked for:

  Send {LButton}
  Send 1
  Send 1
  Send {Space}
  If (CapsLockState="D") ; caps lock is on
  Else                   ; caps lock is off (CapsLockState="U")

Open in new window

If you want to re-seed the random number generator at any point in the code, the command is:


Here's the definition of NewSeed from the AutoHotkey help:
This mode reseeds the random number generator with NewSeed (which can be an expression). This affects all subsequently generated random numbers. NewSeed should be an integer between 0 and 4294967295 (0xFFFFFFFF). Reseeding can improve the quality/security of generated random numbers, especially when NewSeed is a genuine random number rather than one of lesser quality such as a pseudo-random number. Generally, reseeding does not need to be done more than once.

If reseeding is never done by the script, the seed starts off as the low-order 32-bits of the 64-bit value that is the number of 100-nanosecond intervals since January 1, 1601. This value travels from 0 to 4294967295 every ~7.2 minutes.
Regards, Joe

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FocISAuthor Commented:

Thanks for taking the time to write that script for me.  I totally understand your initial hesitation, I wouldn't do the work for someone who was supposed to be learning how to do it either.

Maybe one day when I have time (or increased need) I'll sit down and really page through how AHK works but for this one off thing I couldn't devote the time (between the kids fall activities and winterizing the house, work, wife, etc)

From your example alone I've learned some basics that I can apply in simple situations going forward too

This script has freed me from my keyboard, where I was previously stuck pressing that combination repeatedly - now the script can do it while I dig the storm windows out of the garage - I'll silently raise my beer in your direction when they're all up

Thanks again for taking the time, I really appreciate it
FocISAuthor Commented:
Above and beyond one of the most professional experts I've had the pleasure of interacting with on EE
Joe Winograd, Fellow&MVEDeveloperCommented:
Happy to help — and thanks for the kind words! But I still cannot understand why you would be executing this process 800 times (when caps lock is on). I've written many AutoHotkey scripts that automate repetitive keyboard tasks, often with wait times (Sleep commands), but never with random wait times. I'd love to understand (at least superficially) what this key sequence accomplishes for you, i.e., why you were previously pressing that combination repeatedly. If you don't mind, please take a brief moment to explain. Regards, Joe
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.