Jump to content

Hotkeys for multiple instances of a script


Recommended Posts

If two AutoIt scripts set the same HotKeys, you should avoid running those scripts simultaneously. (The second script cannot capture the hotkey unless the first script terminates or unregisters the key prior to the second script setting the hotkey.)

Well, that shot my pause and exit idea...

So, I tried:

; Set hot keys ( Press Esc to terminate script, Pause/Break to "pause")
If $sSiteCode = "V" Then
    HotKeySet("^+{V}", "TogglePause")
    HotKeySet("^!{V}", "Terminate")
ElseIf $sSiteCode = "C" Then
    HotKeySet("^+{C}", "TogglePause")
    HotKeySet("^!{C}", "Terminate")
EndIf

Based on the use of the letters of the 2 copies of the script I will be running on the same computer.

Well, I guess CTRL-ALT-C and CTRL-ALT-V are reserved (although I can't found a listing) and don't work. The CTRL-SHIFT ones work fine for pause.

So, other than changing the letters, am I missing something? :mellow:

Thanks,

Bre

P.S. This is going to be used by a basic computer user, not by me... :(

Edited by BreCalmor
Link to comment
Share on other sites

Hi!

This is not perfect but it will eliminate the above problem.

#include <misc.au3>

AdlibEnable("_CheckHotkey",10)

While True
    Sleep(100)
WEnd



Func _CheckHotKey()
    If _IsPressed("11") And _IsPressed("43") THen
        MsgBox(64,"'Hotkey' was pressed","Ctrl+C")
    EndIf
EndFunc

:mellow:

Broken link? PM me and I'll send you the file!

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