lele9013 发表于 2011-12-23 00:23:06

求高手把一段ahk 转成au3

是一段 魔兽争霸 显血的代码


IsChatting()
{
   Process, Exist ; sets ErrorLevel to the PID of this running script
   h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", ErrorLevel)
   ; Open an adjustable access token with this process (TOKEN_ADJUST_PRIVILEGES = 32)
   DllCall("Advapi32.dll\OpenProcessToken", "UInt", h, "UInt", 32, "UIntP", t)
   VarSetCapacity(ti, 16, 0) ; structure of privileges
   NumPut(1, ti, 0) ; one entry in the privileges array...
   ; Retrieves the locally unique identifier of the debug privilege:
   DllCall("Advapi32.dll\LookupPrivilegeValueA", "UInt", 0, "Str", "SeDebugPrivilege", "Int64P", luid)
   NumPut(luid, ti, 4, "int64")
   NumPut(2, ti, 12) ; enable this privilege: SE_PRIVILEGE_ENABLED = 2
   ; Update the privileges of this process with the new access token:
   DllCall("Advapi32.dll\AdjustTokenPrivileges", "UInt", t, "Int", false, "UInt", &ti, "UInt", 0, "UInt", 0, "UInt", 0)
   DllCall("CloseHandle", "UInt", h) ; close this process handle to save memory

   WinGet,pid,PID,A
   h := DllCall("OpenProcess", "UInt", 24, "Int", false, "UInt", pid) ;DllCall("OpenProcess", "Int", 0x0010 | 0x0400, "Int", false, "UInt", pid, "UInt")
   VarSetCapacity(value,4,0)
   DllCall("ReadProcessMemory","UInt",h,"UInt",0x0045cb8c,"Str",value,"UInt",4,"UIntP",0)
   ;1.20e 0x0045cb8c   1.24c 0x6FAE8450
   Return,value
}

$q::
KeyIsOn := GetKeyState("ScrollLock" ,"T")    ;得到ScrollLock 灯的状态
if(KeyIsOn && !IsChatting())                        ;如果scrollLock灯亮并且不在聊天状态
{
   Send,{Numpad8}                                       ;用Numpad8替换q
}
Else
{
   Send,q                                                      ;发送q
}
return

hzxymkb 发表于 2011-12-23 14:12:07

不会AHK的路过

hzxymkb 发表于 2011-12-23 14:12:55

前面的代码好像是调用API,后面的好像是发送按键!
页: [1]
查看完整版本: 求高手把一段ahk 转成au3