Jump to content

Passing pressed-key to autoit


Recommended Posts

Hi, I am trying to pass a hotkey to my autoit application so that I can pause my autoit application from FFXI game.

I used the example in from autoit help.

In addition, I put a line in the pause function called:

Global $Paused

HotKeySet(")", "TogglePause")

Func TogglePause()

SoundPlay ( "chimp.wav");

$Paused = NOT $Paused

While $Paused

sleep(100)

WEnd

EndFunc

When I put a notepad on top, and when I hit ")", it does give a chimp sound that indicates the hotkey is working.

But when I load the game FFXI, and hit the same ")" key, I do NOT hear the chimp sound. It indicates that my autoit code does not get the hotkey I pressed.

Is it means that there are certain applications (FFXI in my case) can block the dispatch of pressed-key event to Windows event handler, that Windows cannot dispatch it to autoit?

This is another question:

When I replace the line SoundPlay ( "chimp.wav") with

send("some words{ENTER}"), I find that my autoit application keep on spawning itselfs. i.e. There are more and more same applications being created and ran by looking at the bottom right icons. Is this a bug of autoit? Is it means autoit will have a problem to handle send command in hotkeyset() function called? My guess is hotkeyset() function is called by ISR routine. Not sure how well send() will run in ISR routine.

Anyway, comments, partial answer, or guess is welcome.

Thanks in advance!

Link to comment
Share on other sites

  • Developers

This is another question:

When I replace the line SoundPlay ( "chimp.wav") with

send("some words{ENTER}"), I find that my autoit application keep on spawning itselfs. i.e. There are more and more same applications being created and ran by looking at the bottom right icons. Is this a bug of autoit? Is it means autoit will have a problem to handle send command in hotkeyset() function called? My guess is hotkeyset() function is called by ISR routine. Not sure how well send() will run in ISR routine.

What had the FOCUS when this happend ??

in other words ... does the ENTER start another version of your script program ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I tried it on notepad. The notepad still at front ground. The ENTER are not suposed to start another copy of my autoit program. The purpose of the send is only to print something on notepad so that I know that I did hit the "pause" key, in this case, is ")" that I programmed it to be.

Link to comment
Share on other sites

The game might be using a method of key detection that prevents it from getting picked up by your hotkey. Maybe a different hotkey works, such as a more obscure combination. You might try something like control-alt-q just to see if that works. Just a small suggestion; I'm not sure if this is the problem, or if this fix would work if it is.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...