autohotkey Dota辅助

; dotaahk_v0.99 
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       WinNT
; Author:         autohotkey@rn <zhang00000@gmail.com>
;
; Script Function:
; An Autohotkey Script for dota!
; test only

#NoEnv
#SingleInstance force
SendMode Input
SetWorkingDir %A_ScriptDir%
Gosub,f_IniRead
Gosub,f_SetHotkey
Hotkey , $WheelDown , Off
Hotkey , $Wheelup , Off
Haystack = abcdefghijklmnopqrstuvwxyz1234567890
suspend on
loop,
{
	winwaitactive,Warcraft III ahk_class Warcraft III
    loop,
    {   
        WinGetPos,,,Width,Height,Warcraft III ahk_class Warcraft III
        if(Width>400 and Height>300)
            break
        sleep 1000
    }
    suspend off
    gosub,f_hbon
	loop,
	{
		ifwinactive,Warcraft III ahk_class Warcraft III
			sleep 1000
		else
			break
	}
    DllCall("ClipCursor", "UInt", 0)
    suspend on
}

Home::
    suspend permit
    reload

End::	
    suspend on
return

;滚轮控制录像回放速度(可以用Shift+F1使此快捷键启用/禁用)
+F1::
	Suspend permit
    Hotkey , WheelUp ,Toggle
	Hotkey , WheelDown ,Toggle
return

WheelUp::
    Suspend permit
	send {=}
return
WheelDown::
    Suspend permit
	send {-}
return

Pgup::
    Suspend permit
    hwnd := WinExist( "Warcraft III ahk_class Warcraft III" )
    If hwnd
    {
        VarSetCapacity(lpRect, 16, 0)
        DllCall("GetClientRect", "UInt", hwnd, "UInt", &lpRect)
        DllCall("ClientToScreen", "Uint", hWnd, "Uint", &lpRect)
        DllCall("ClientToScreen", "Uint", hWnd, "Uint", &lpRect+8)
        DllCall("ClipCursor", "UInt", &lpRect)
    }
Return

Pgdn::
    Suspend permit
    DllCall("ClipCursor", "UInt", 0)
Return

f_IniRead:
{
    SettingFile =%A_ScriptDir%\dotaahk.ini
    if FileExist(SettingFile)
    {
        IniRead, Item7, %A_ScriptDir%\dotaahk.ini, Item, Item7
        IniRead, Item8, %A_ScriptDir%\dotaahk.ini, Item, Item8
        IniRead, Item4, %A_ScriptDir%\dotaahk.ini, Item, Item4
        IniRead, Item5, %A_ScriptDir%\dotaahk.ini, Item, Item5
        IniRead, Item1, %A_ScriptDir%\dotaahk.ini, Item, Item1
        IniRead, Item2, %A_ScriptDir%\dotaahk.ini, Item, Item2
    }
    else
    {
        MsgBox,Dotaahk.ini miss!
        Exitapp
    }
    Return
}

f_SetHotkey:
{
    If Item7
        HotKey, *$%Item7%, f_Item7
    If Item8
        HotKey, *$%Item8%, f_Item8
    If Item4
        HotKey, *$%Item4%, f_Item4
    If Item5
        HotKey, *$%Item5%, f_Item5
    If Item1
        HotKey, *$%Item1%, f_Item1
    If Item2
        HotKey, *$%Item2%, f_Item2
    Return
}

f_Item7:
{
    IfInString, Haystack, %Item7%
    {
        if IME_CHECK("Warcraft III ahk_class Warcraft III")
            send,%Item7%
        else
            send,{Numpad7}{bs}{%Item7%}
        return
    }
    else
        send,{Numpad7}
    return
}

f_Item8:
{
    IfInString, Haystack, %Item8%
    {
        if IME_CHECK("Warcraft III ahk_class Warcraft III")
            send,%Item8%
        else
            send,{Numpad8}{bs}{%Item8%}
        return
    }
    else
        send,{Numpad8}
    return
}

f_Item4:
{
    IfInString, Haystack, %Item4%
    {
        if IME_CHECK("Warcraft III ahk_class Warcraft III")
            send,%Item4%
        else
            send,{Numpad4}{bs}{%Item4%}
        return
    }
    else
        send,{Numpad4}
    return
}

f_Item5:
{
    IfInString, Haystack, %Item5%
    {
        if IME_CHECK("Warcraft III ahk_class Warcraft III")
            send,%Item5%
        else
            send,{Numpad5}{bs}{%Item5%}
        return
    }
    else
        send,{Numpad5}
    return
}

f_Item1:
{
    IfInString, Haystack, %Item1%
    {
        if IME_CHECK("Warcraft III ahk_class Warcraft III")
            send,%Item1%
        else
            send,{Numpad1}{bs}{%Item1%}
        return
    }
    else
        send,{Numpad1}
    return
}

f_Item2:
{
    IfInString, Haystack, %Item2%
    {
        if IME_CHECK("Warcraft III ahk_class Warcraft III")
            send,%Item2%
        else
            send,{Numpad2}{bs}{%Item2%}
        return
    }
    else
        send,{Numpad2}
    return
}

!1::
Send,{Enter}
Send,-allpick
Send,{Enter}{Enter}{Esc}
return

!2::
Send,{Enter}
Send,-di
Send,{Enter}{Enter}{Esc}
return

!3::
Send,{Enter}
Send,-matchup
Send,{Enter}{Enter}{Esc}
return

!4::
Send,{Enter}
Send,-random
Send,{Enter}{Enter}{Esc}
return

!5::
Send,{Enter}
Send,-repick
Send,{Enter}{Enter}{Esc}
return

IME_CHECK(WinTitle)
{
    WinGet,hWnd,ID,%WinTitle%
    Return Send_ImeControl(ImmGetDefaultIMEWnd(hWnd),0x005,"")
}

Send_ImeControl(DefaultIMEWnd, wParam, lParam)
{
    DetectSave := A_DetectHiddenWindows       
    DetectHiddenWindows,ON                           

    SendMessage 0x283, wParam,lParam,,ahk_id %DefaultIMEWnd%
    if (DetectSave <> A_DetectHiddenWindows)
        DetectHiddenWindows,%DetectSave%
    return ErrorLevel
}

ImmGetDefaultIMEWnd(hWnd)
{
    return DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)
}



f_hbon:
{
    Send, {[ Up}
    Send, {] Up}
    Send, {[ Down}
    Send, {] Down}
    send,{bs}{bs}
    return			
}

 

给TA买糖
共{{data.count}}人
人已赞赏
AHKV1

[知识库]Autohotkey知识点整理

2018-1-18 20:23:35

AHKV1办公

autohotkey实现文件(桌面和任意文件夹)自动整理

2018-1-19 21:20:13

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索