Jump to content

Small keybind support!


Lett
 Share

Recommended Posts

Hello there!

So, i'm making a small helper for world of warcraft, nothing fancy but it will help me. After a while i came across some trouble, thats why i'm here searching for expertise :-). I have searched the forums and google for help but with no success. Basiclly i want to bind ENTER to my func knapp when my window is active. So i tried

if WinActive($first,"") then

HotKeySet("{ENTER}", "knapp")

else

HotKeySet("{ENTER}")

EndIf

with no luck. Any suggestions?

#include <GUIConstants.au3>
#include <Misc.au3>
HotKeySet("+!w", "active")

; GUI
$First = GUICreate("help", 140, 50, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$search = GUICtrlCreateInput("", 0, 30, 125, 17)
$button1 = GUICtrlCreateButton("WOW", 0, 3, 25, 25,$BS_ICON)
$button2 = GUICtrlCreateButton("Wowhead", 25, 3, 25, 25, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 7)
GUISetState()

$wowdir = IniRead("settings.ini", "wowpath", "key", "c:\games\world of warcraft\")
    
While 1



    $msg = GUIGetMsg(1)
    Select 

        Case $msg[0] = $GUI_EVENT_CLOSE
            Exit
            GUIDelete()
                Case $msg[0] = $button1
                If WinExists("World of Warcraft") Then
                    WinActivate("World of Warcraft")
                        Else
                        Run($wowdir & '\wow.exe')
                        WinWaitActive("World of Warcraft")
            EndIf
        Case $msg[0] = $button2
            ShellExecuteWait("www.wowhead.com/?search=" & GUICtrlRead($search))
    EndSelect

WEnd

Func active()
    If WinActive("World of Warcraft") Then
        Winactivate($first)
    EndIf
EndFunc
Func knapp()
        $msg[0] = $button2
EndFunc
Link to comment
Share on other sites

Instead of this:

if WinActive($first,"") then
HotKeySet("{ENTER}", "knapp")
else
HotKeySet("{ENTER}")
EndIf
Try setting the hotkey like you did at the very beginning instead of in a function, and then in the if/else statement do this:

if WinActive($first,"") then 
HotKeySet("{ENTER}", "knapp") 
else
HotKeySet("{ENTER}") 
send("{ENTER}")
HotKeySet("{ENTER}", "knapp") 
EndIf
Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
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...