找回密码
 加入
搜索
查看: 2311|回复: 2

[AU3基础] 求高手把一段ahk 转成au3

[复制链接]
发表于 2011-12-23 00:23:06 | 显示全部楼层 |阅读模式
是一段 魔兽争霸 显血的代码


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
发表于 2011-12-23 14:12:07 | 显示全部楼层
不会AHK的路过
发表于 2011-12-23 14:12:55 | 显示全部楼层
前面的代码好像是调用API,后面的好像是发送按键!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-17 15:38 , Processed in 0.075698 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表