Jump to content

HotKeySet question


Xink
 Share

Recommended Posts

Hi,

I use HotKeySet with the ENTER button to do an action in my script.

But when this script is not active, i still want to use the ENTER key in windows.

It looks like the enter key is reserved for this script only and i cannot use ENTER key anymore when this script is still running.

regards,

Xink

Edited by Xink
Link to comment
Share on other sites

This is correct, when a key is bound to a function with hotkeyset, it loses it previous function. A good work around for this would be to use _IsPressed().

Another way would be to add these 2 lines at the start of your script

Global $hkSet = false;

AdlibEnabled("sethotkey",500);

Remove the HotKetSet you have at the moment

and then add this function

Func sethotKey()
if WinActive("My App Title") and $hkSet = false then
  Hotkeyset("{ENTER}","functionname")
  $hkSet = true
endif

if (not WinActive("My App Title")) and $hkSet = true then
 HotKeySet("{ENTER}")
 $hkSet = false
endif


endfunc

This way, whenever you program becomes active it will use the Enter key, and release it when another program is being used.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...