Sign in to follow this  
Followers 0
asm

HotKeySet()

19 posts in this topic

I am using the HotKeySet() function to start, pause, and exit my script on certain keypresses.

Although it works flawlessly for the most part, when I load up the app I wish to use it with, the script does not receive the keystrokes.

Posted Image

A forum search has revealed that I am not the only one to have had this problem, but the suggested solutions I have seen on previous topics do not rectify this. If there is an alternative function or a setting I can tweak to rectify the issue, please let me know.

Regards

Share this post


Link to post
Share on other sites



Any possible workarounds or theories that might solve the problem would be appreciated.

Regards

Share this post


Link to post
Share on other sites

Actually, I literally just had this problem today. I am making a bot for the game Morrowind, but for some reason hotkeys do not work... I tried every possible way of doing it, but for some reason the program won't allow hotkeys. That might be your problem also, best of luck with your problem.

Share this post


Link to post
Share on other sites

I am using the HotKeySet() function to start, pause, and exit my script on certain keypresses.

Although it works flawlessly for the most part, when I load up the app I wish to use it with, the script does not receive the keystrokes.

Posted Image

A forum search has revealed that I am not the only one to have had this problem, but the suggested solutions I have seen on previous topics do not rectify this. If there is an alternative function or a setting I can tweak to rectify the issue, please let me know.

Regards

<{POST_SNAPBACK}>

Do you run this application using RunWait()? If so then the script doesn't recieve any keystrokes until the script continues. This is a problem that I have not yet found a solution for. You may try just running the application using the run command instead of run wait.

Hope this helps!

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

In this situation, when you cannot use hotkeys within a program, I would suggest trying to key your function off of images/text that occur when you want the function to run. So if you think you could apply this, take a look at PixelSearch and PixelGetColor.

Share this post


Link to post
Share on other sites

You may also want to keep in mind that some programs, games in particular, re-map your keyboard.


CheersNobby

Share this post


Link to post
Share on other sites

Do you run this application using RunWait()? If so then the script doesn't recieve any keystrokes until the script continues. This is a problem that I have not yet found a solution for. You may try just running the application using the run command instead of run wait.

Hope this helps!

*** Matt @ MPCS

<{POST_SNAPBACK}>

Thanks for the suggestion, but I do not use RunWait()

In this situation, when you cannot use hotkeys within a program, I would suggest trying to key your function off of images/text that occur when you want the function to run.  So if you think you could apply this, take a look at PixelSearch and PixelGetColor.

<{POST_SNAPBACK}>

I considered that, but the problem is both the text and text window are semitransparent. To make it even worse, the transparency of the text window varies like a gradient...

You may also want to keep in mind that some programs, games in particular, re-map your keyboard.

<{POST_SNAPBACK}>

Could you elaborate, please?

I have a hex editor that can open up the memory and display it for any given process, though I'm not sure how it does this....If I can find the location of what I need in there, however, is there perhaps a way/function to pull bytes/words/dwords/etc from a particular address in AutoIt?

Thanks everyone.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Some programs (games in perticular) do capture the keyboard and thus don't work with hotkeys well.

if the program logs stuff into a text file, you can have autoit read the file and fire off a macro when it reads a certain bit of text. "Bubba gump the hippogriffin says what a great day to party"

Also you might try different keys. My Printscreen button, scroll lock and pause break keys are not captured in one game of mine that all the others are, so I use variations of those. (shift+Pause, Alt+pause, Ctrl+pause, Ctrl+Alt+Pause, and of course Pause, etc.)

Oh, and I also did some work with pixel colors as well, but it is just for starting up the game. That gets really tricky if full screen.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

I tried the combinations you suggested, and the program still blocks them :/ Thanks anyways, though.

Once again, is there anyway to read the memory from AutoIt, with a plugin or some such if not directly? The program does have an echo function, but due to complications I've mentioned before, I cannot just read pixels. But, if I could access the buffer directly...

Regards

Share this post


Link to post
Share on other sites

Once again, is there anyway to read the memory from AutoIt, with a plugin or some such if not directly?

It's not possible and I doubt AutoIt will ever support this as this is very likely to get AutoIt listed as a virus/trojan/worm as it has already happened before.

Share this post


Link to post
Share on other sites

I was a away for a few weeks, so I apologize for the long delay in replying. Anyways, down to business...

I've heard, though not confirmed, that there is a way to read keyboard input in C/C++ by dumping the entire keyboard state into an array of boolean values. Is there, perhaps, a way to do this in AutoIt, so I could see the status of every key regardless of how windows dispatches messages containing key info?

Also, what about numlock, capslock, and scrolllock? Each of these toggle on and off, instead of while the key is pressed, so is there a way to read if each is on or off?

Regards

Share this post


Link to post
Share on other sites

Actually, I was looking at a bot for Maple Story written in AutoIt... What the coder did was he tested out all the different send key buttons and eventually figured out which one the game will allow... In the end, he had left and right arrows as z and x or something like that. I think the game designers messed that up to throw us off, but it didn't work!

Share this post


Link to post
Share on other sites

Thanks, but thus far I haven't discovered any keys which AutoIt will detect while it is running, num/caps/scroll lock included. However, if there is a way to simply determine if each is on or off, instead of intercepting the keystroke, I think that would work quite well. Anyone know if there is a way to do that, or an alternative?

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Did you try the

DLLCall("user32","int","GetAsyncKeyState","int",$key)

idea?

ASAIK the user32 call should be much harder to stops than Autoit way.

Check this topic for having the original Larry script that show how to quite well.

Edited by ezzetabi

Share this post


Link to post
Share on other sites

That works, thank you very very much! :)

My script is now complete :)

Now I wonder if you could use that DLLCall() to open up the memory....

Share this post


Link to post
Share on other sites

1. You are welcome.

2. mmmn... if you can program a .dll that do what you need and that uses calls that Autoit can use you should have no problems.

3. if you create that .dll of point 2. share it with the whole community. :)

Share this post


Link to post
Share on other sites

Any more information about a possible dll for memory reading? B)

Share this post


Link to post
Share on other sites

Welcome to the forums!

You're in luck -- do a forum search for 'memread'.

Share this post


Link to post
Share on other sites

Thanks, and hello B)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0