Hotkeys immer aktiv

  • Guten Morgen zusammen,

    ich habe folgendes Problem:
    Wenn in in einer Anwendung Hotkeys verwende,
    dann sollen diese Hotkeys "immer" und überall in Windows aktiv sein.
    Solange wie das Hauptscript läuft.

    Dies geht leider nur wenn das Fenster den Fokus hat.
    Kann man das irgendwie ändern.

    Beispiel F4 Hotkey

    [autoit]


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    $Form1 = GUICreate("Form1", 615, 440, 297, 186)
    $Button1 = GUICtrlCreateButton("Button1", 212, 108, 197, 81)
    Dim $Form1_AccelTable[1][2] = [["{F4}", $Button1]] ; hier ist der Hotkey für die Taste F4
    GUISetAccelerators($Form1_AccelTable)
    GUISetState(@SW_SHOW)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    Case $Button1
    Msgbox(4,"Hotkey","Aktiviert...")
    EndSwitch
    WEnd

    [/autoit][autoit][/autoit][autoit][/autoit]


    Grüße
    Ilse ;)

    Einmal editiert, zuletzt von Ilse (15. November 2010 um 15:11)

  • Hallo Sen,

    hm... d.h. ich muß ganz normale Hotkeys verwenden.
    ...habe ich das richtig verstanden:

    Ich mache den Code für jeden Case Button als Funktion?

    In meinem Beispiel wollte ich mit F4
    den Code von dem Button überall verwenden.

    [autoit]


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    $Form1 = GUICreate("Form1", 615, 440, 297, 186)
    $Button1 = GUICtrlCreateButton("Button1", 212, 108, 197, 81)
    Dim $Form1_AccelTable[1][2] = [["{F4}", $Button1]] ; hier ist der Hotkey für die Taste F4
    GUISetAccelerators($Form1_AccelTable)
    GUISetState(@SW_SHOW)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    Case $Button1
    Msgbox(4,"Hotkey","Aktiviert...")
    EndSwitch
    WEnd

    [/autoit]

    Grüße
    Ilse ;)

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("{F4}","_Func")

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Form1", 615, 440, 297, 186)
    $Button1 = GUICtrlCreateButton("Button1", 212, 108, 197, 81)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While Sleep(15)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _Func()
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Func()
    Msgbox(4,"Hotkey","Aktiviert...")
    EndFunc

    [/autoit]

    Oder was meinst du?

    MfG hellboy

    [autoit]

    Do
    _help($user)
    Until $questions = 0

    [/autoit]

    Meine Werke:
    Ste`s Web-Radio

  • Hallo Hellboy,

    muß das ganze nochmal kurz erklären.

    1. Das Hauptscript soll im Hintergrund laufen. (unsichtbar)
    2. Ein zweites Script soll nur den Hotkey des 1. Scriptes aufrufen also F4

    bis hierhin klappt das mit normalen Hotkeys.

    Das 2. Script sieht so aus

    [autoit]


    send("{F4}") ; ruft nun vom Hauptscript die Funktion auf

    [/autoit]

    das geht leider nicht!
    Drücke ich von Hand F4 das klappt.
    Grüße
    Ilse ;)