Jump to content

HotKey persists when switching to another application


c.haslam
 Share

Recommended Posts

In an Autoit script, I set Ctrl_S as a hotkey: HotKeySet("^s","SaveData"). Ctrl_S should only execute SaveData() when Form1 is active; a menuitem on this form is "Save Ctrsl_S".

I then open another application. When I press Ctrl_S, SaveData() is executed. This is not what I want!

How do I restrict execution of SaveData() to when the script is running and this form is active?

...chris

Edited by c.haslam
Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

just use GUISetAccelerators :)

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

just use GUISetAccelerators :)

Hi,

You can use _IsPressed with options

#Include <misc.au3>

While 1
If _Ispressed("11") and _IsPressed("53") and WinActive("yourapp","") Then
;if ctrl+s and the window of your app is active
_SaveData()
Endif
Wend
Edited by FireFox
Link to comment
Share on other sites

Many thanks to all.

...chris

BTW Where do I find the codes for HotKey() and _IsPressed()? I have found a table of ASCII character codes in the Help, but not for keystrokes.

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

search in the help file for ''Send Key List''

The Send Key List gives the constituent parts of the argument of SendKeys (and GUISetAccelerators) but _isPressed takes a numeric argument.

...chris

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

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