Jump to content

Interrupting a Hotkey or reading _IsPressed only one time


Dryden
 Share

Recommended Posts

Hi again.

I have a script that uses 5 hotkeys, but the problem is that some of them need to be sent back with send(), the problem is that when i have a hotkey, if i send it back the script enters in an endless loop. and if i use _IsPressed then the key is sent back only once (the time that it was pressed) but the function gets executed too many times (i think it doesn't get executed once but again and again until the key is released).

So what I'm looking for is either for a way to ignore a Hotkey while sending the same key or a way to run my funclion only once when i press the key once using _IsPressed

thx

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

Link to comment
Share on other sites

Hi again.

I have a script that uses 5 hotkeys, but the problem is that some of them need to be sent back with send(), the problem is that when i have a hotkey, if i send it back the script enters in an endless loop. and if i use _IsPressed then the key is sent back only once (the time that it was pressed) but the function gets executed too many times (i think it doesn't get executed once but again and again until the key is released).

So what I'm looking for is either for a way to ignore a Hotkey while sending the same key or a way to run my funclion only once when i press the key once using _IsPressed

thx

Use HotKeySet("KEY") without function parameter.

When the words fail... music speaks.

Link to comment
Share on other sites

Use HotKeySet("KEY") without function parameter.

I don't get it...

without function parameter how is my function going to be called?

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

Link to comment
Share on other sites

I think that maybe I'm not explaining myself properly:

Imagine this:

I have a hotkey that is H

and when the user presses that hotkey I want my program to send it ant then do a couple of commands that i have set in a function.

the problem is that if i send H my script goes berzek, cos i'm sending H and he has a hotkey that it's the same and detects it's own send as a hotkey itself...

so in another approach i tried to use _IsPressed. knowing that H is #48 key, i used ispressed so whenever the script detected that key #48 is pressed it would run my function, but the I got another problem... The function runs over and over again cos _ispressed run again and again until the key is released, and I want the function to run only once every time u press H.

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

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...