Jump to content
Sign in to follow this  
BreCalmor

Hotkeys for multiple instances of a script

Recommended Posts

BreCalmor

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

Share this post


Link to post
Share on other sites
monoceres

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!

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.