Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Simple hotkey... hotkeyset, or _IsPressed? neither working

$
0
0
Hello everyone, if someone could please help me with this, I would really appreciate it. I am trying to write a very, very simply script, but having trouble figuring out what I'm doing wrong. I imagine I could figure it out... eventually, but searching the forums and trying different example is cumbersome.

All I want to do is make a script that gives me a simple, custom mapped hotkey. Here is what I want the script to do...

1. Run script
2. Run indefinitely and do nothing unless hotkey is pressed
3. Click a location on the screen when hotkey is pressed
4. Continue to run, and respond to the hotkey

Really simple right? I would have thought so.

Here is the state of the code as it is now, please forgive how rough and simple it is, I am a TOTAL noob at AutoIt.

#include <Misc.au3>
HotKeySet ( "{ESC}", Terminate() )
HotKeySet ( "{Space}" , doubleclick() )

While 1
  
   If
  
WEnd
 
 
Func doubleclick()  
	  Mouseclick ( "left" , 885, 528 , 2 )
  
EndFunc
Func Terminate()
	Exit 0
EndFunc 


So the results I've had so far...

At first, I had the doubleclick() function inside the While loop, and that caused an infinite loop of my mouse being stuck at the coordinate, double clicking, and forcing me to log out to stop the script.
Also, I never pressed the "Space" button, which I thought is the hotkey that I specified to call the doubleclick() fuction. The doubleclick() the runs as soon as I start the script, never waiting or responding to the hotkey.

What am I doing wrong here?

I tried to go and mess around with IsPressed, but the code doesn't seem to exist in my library. Typing _ispressed, does nothing and shows up as black, plain text.

Anyone help?

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>