; ===================================================================================系统参数 ;{ 和;} 折叠
;~ #Persistent
#SingleInstance force
; #MaxThreads 20
; #HotkeyInterval 2000 ; 这是默认值 (毫秒).
;~ #HotkeyInterval 0
; #MaxHotkeysPerInterval 200
;~ #InstallKeybdHook
#Hotstring Z ? * O
SetBatchLines, -1
SetKeyDelay , 0
SetControlDelay, 0
ThRead, NoTimers
Process, Priority,, High
;~ SetBatchLines, -1
;~ SetKeyDelay , -1, -1
;~ SetKeyDelay , 10,150
;~ SetControlDelay, -1
CoordMode,Mouse,Screen
;~ SetWinDelay, 100
;~ */
;================================================================参数设定================================================================;
;~ #Persistent
#SingleInstance force
;~ #MaxThreads 20
;~ #HotkeyInterval 2000 ; 这是默认值 (毫秒).
;~ #HotkeyInterval 0
;~ #MaxHotkeysPerInterval 200
;~ #InstallKeybdHook
#Hotstring Z ? * O
;~ SetBatchLines, 0
;~ SetKeyDelay , -1, -1
;~ SetKeyDelay , 10,150
;~ SetControlDelay, -1
;~ CoordMode,Mouse,Screen
;~ SetWinDelay, 100
SetWorkingDir %A_ScriptDir%
SoundPlay,Sound\ding.wav
;~ starttime:=A_tickcount
Global SizeT := A_IsUnicode ? 2 : 1
FileRead, HelpText, 更新说明.txt
;~ sfi_size := A_PtrSize + 8 + (A_IsUnicode ? 680 : 340)
;~ MsgBox,%sfi_size%
;~ sfi_size = 352
;~ VarSetCapacity(sfi, sfi_size)
LastTick:=0
LastTime:=0
GameFrame2=任意值
Build_X:=148
Build_y1:=226
Build_W:=62*2
Build_H:=50*7
Build_QWER:=190
;视图模式
ViewType1=Report
ViewType2=IconSmall
ViewType3=List
ViewType4=Icon
Clickcount:=0
SysGet ,SysMenu_H,4 ;;标题栏高度
;~ SysGet ,SysMenu_W,5
;~ MsgBox,%SysMenu_H%
IF A_OSVersion=WIN_7
SysGet ,SysMenu_WH,68 ;;拖动点宽度(窄边)
else
SysMenu_WH=0
;~ MsgBox,%SysMenu_WH%
TimesDelayAlarm=延时提醒
TimesDelayShutDown=延时关机
TimesFixedAlarm=定时提醒
TimesFixedShutDown=定时关机
IME_EN=134481924
WinRun1=-win
QQWinRun1=-win
LButtonAtick:=A_Tickcount
YYShow=http://yy.com/#90201
_Keylist=滚轮上|滚轮下|鼠标左键|鼠标中键|鼠标右键|Esc|``|1|2|3|4|5|6|7|8|9|0|-|=|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|\|,|.|/|[|]|Tab|CapsLock|F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|LCtrl|RCtrl|LAlt|RAlt|LShift|RShift|LWin|RWin|Insert|Delete|Home|End|PGUP|PGDN|Numpad0|Numpad1|Numpad2|Numpad3|Numpad4|Numpad5|Numpad6|Numpad7|Numpad8|Numpad9|NumpadDot (.)|NumpadDiv (/)|NumpadMult (*)|NumpadAdd (+)|NumpadSub (-)|NumpadEnter|Up (↑)|Down (↓)|Left (←)|Right (→)|
;---------------------------热键子程序---------------------------;
;~ 变量规则:
;~ TVName%TVID%:=%TVName%
;~ %_Win%Win=窗口
;~ %Str1%TVID:=n
;~ TVName%n%:=Str1
;---------------------------iniread---------------------------;
; IniRead, ProjectSelect,Default.ini, Default,配置方案
; If ProjectSelect="Error"
; Gosub,预设默认配置
;--------------读入用户配置
;---------------------------iniread---------------------------;
if !FileExist(A_ScriptDir . "Settings")
FileCreateDir,%A_ScriptDir%\Settings
;--------全局 ;配置方案
Loop, %A_ScriptDir%\Settings\*.Ini
{
;~ MsgBox, 4, , Filename = %A_LoopFileName%`n`nContinue?
StringTrimRight,Filename,A_LoopFileName,4
if (Filename="" || Filename="默认配置" || Filename="Enigma" || Filename="Keyboard" || instr(Filename,"复件-"))
continue
;~ MsgBox,=%Filename%=
ProjectType.="|" . Filename
;~ StringReplace,Filename,A_LoopFileName
;~ MsgBox,%ProjectType%
}
ProjectType=新建方案|默认配置|Enigma%ProjectType%|删除方案
;~ MsgBox,%ProjectType%
;~ ProjectType:=_IniRead("新建方案|默认配置|Enigma|","Default.ini","Default","ProjectType") ;配置方案
ProjectSelect:=_IniRead("默认配置","Default.ini","Default","ProjectSelect") ;配置选择
ProgramList:=_IniRead("QQ,cngame,QQBattleZone,GameClient,ra2,RA2MD","Settings\" . ProjectSelect . ".ini","Default","ProgramList") ;程序列表
GuiShowPosX:=_IniRead(500,"Default.ini","Default","GuiShowPosX") ;GuiShow位置X
if (GuiShowPosX<-485 || (GuiShowPosX>A_ScreenWidth))
GuiShowPosX:=0
GuiShowPosY:=_IniRead(300,"Default.ini","Default","GuiShowPosY") ;GuiShow位置Y
if (GuiShowPosY<-290 || (GuiShowPosY>A_ScreenHeight))
GuiShowPosY:=0
GameListPosX:=_IniRead(500,"Default.ini","Default","GameListPosX") ;GameListShow位置X
GameListPosY:=_IniRead(300,"Default.ini","Default","GameListPosY") ;GameListShow位置Y
CurrentGuiSizeW:=_IniRead(850,"Default.ini","Default","CurrentGuiSizeW") ;CurrentGuiSizeW
CurrentGuiSizeH:=_IniRead(640,"Default.ini","Default","CurrentGuiSizeH") ;CurrentGuiSizeH
ViewType:=_IniRead("Report,List,Icon,IconSmall","Default.ini","Default","ViewType") ;视图模式
StringSplit, ViewTypeArray, ViewType, `,
/*
全局通用热键=
(
【工具助手(显示/隐藏)】=~鼠标中键
【音量增大】=~Win+滚轮(上)
【音量减小】=~Win+滚轮(下)
【关闭红警】=~F12
)
全局通用热键:=_IniRead(全局通用热键,"Settings\" . ProjectSelect . ".ini","全局通用热键")
红色警戒=
(
〖上一页(网路/返回)〗=~鼠标右键
最后建造追加热键=大写键
取消画面全部建造=Esc
一键观战=F8
一键打开基地:映射M=《%下一個物件%﹍次数1﹍延时0》《%部署物件%﹍次数1﹍延时0》
移动攻击=A
移动+点击=滚轮(下)
保护模式=F
保护+点击=滚轮(上)
心灵信标=~鼠标左键+鼠标右键
残血部队=Alt+滚轮(下)
快速设键=Ctrl+F10
〈电厂〉=QE
〈矿厂〉=QR
〈兵营〉=QD
〈重工〉=QF
〈空指〉=QT
〈维修厂〉=QG
〈实验室〉=QV
〈造船厂〉=QC
〈精炼器|核子炉〉=QB
〈空降兵〉=WT
〈围墙〉=WE
〈碉堡〉=WR
〈爱国者|防空炮〉=WD
〈光棱塔|磁爆圈〉=WF
〈巨炮〉=WG
〈间谍卫星|复制中心〉=WV
〈裂缝产生器|心灵探测器〉=WC
〈超时空传送仪|铁幕装置〉=WZ
〈天气控制器|核弹发射井〉=WX
〈大兵〉=EE
〈狗〉=ED
〈工程师〉= ER
〈磁暴步兵〉=EF
〈飞行兵|防空兵〉=ET
〈狙击手|辐射兵|恐怖分子〉=EG
〈间谍|伊文〉=EG
〈谭雅|尤里〉=EC
〈时空兵〉=EB
〈矿车〉=RE
〈坦克〉=RR
〈防空车〉=RD
〈光棱|天启〉=RF
〈飞机|蜘蛛〉=RT
〈坦克杀手|自爆卡车|磁能坦克〉=RG
〈基地车〉=RH
〈幻影|飞艇〉=RV
〈运输艇〉=RA
〈驱逐舰|潜水艇〉=RS
〈海豚|乌贼〉=RZ
〈巡洋舰|海蝎〉=RX
〈直升机|V3火箭〉=RC
〈航母舰|无畏舰〉=RB
)
红色警戒:=_IniRead(红色警戒,"Settings\" . ProjectSelect . ".ini","红色警戒")
*/
;--------用户
displayHIDDEN:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","displayHIDDEN") ;是否收缩视图
ViewChoise:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","ViewChoise") ;视图选择
LButtonClickBuild:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","LButtonClickBuild") ;左键连续建造ClickBuildNum
RButtonRepair:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","RButtonRepair") ;左键连续建造ClickBuildNum
ShiftClickBuild:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","ShiftClickBuild") ;+LButton连续建造
ClickBuildNum:=_IniRead(5,"Settings\" . ProjectSelect . ".ini","Default","ClickBuildNum") ;建造数量
IniRead, Ra2Dir,Settings\%ProjectSelect%.ini, Default,Ra2Dir ;红警目录
IniRead, QQBattleZoneDir,Settings\%ProjectSelect%.ini, Default,QQBattleZoneDir ;QQ平台目录
Iniread,Ra2Width,%Ra2Dir%\ra2.ini,Video,ScreenWidth ;红警窗口W
iniread,Ra2Height,%Ra2Dir%\ra2.ini,Video,ScreenHeight ;红警窗口H
WinRun:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","WinRun") ;红警窗口化
QQWinRun:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","QQWinRun") ;QQ平台窗口化
ReturnBack:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","ReturnBack") ;右键返回
Ra2Move_Switch:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","Ra2Move_Switch") ;移动攻击
ClickOK:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","ClickOK") ;点击确定
GameIDDisable:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","GameIDDisable") ;禁用ID
游戏ID列表_:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","游戏ID列表_") ;游戏ID列表_彩蛋
;~ CheckBoxIME_SW:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","CheckBoxIME_SW") ;中英文切换
;~ If CheckBoxIME_SW
;~ {
;~ Hotkey,ifwinactive,ahk_class Red Alert 2
;~ Hotkey,^Space,禁用按键
;~ }
HidewinCheck:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","HidewinCheck") ;悬浮屏幕
SoundWav:=_IniRead("Sound\start.wav","Settings\" . ProjectSelect . ".ini","Default","SoundWav") ;切换提示声音
Ra2_Switch:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","Ra2_Switch") ;红警版本选择
OpenObserve:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","OpenObserve") ;打开观察
LWin_Switch:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","LWin_Switch") ;禁用Win键
If LWin_Switch
{
Hotkey,ifwinactive,ahk_class Red Alert 2
Hotkey,LWin UP,禁用按键
}
DetectHiddenWindows, On
IfWinExist,Red Alert 2 +5 TRAiNER
{
Hotkey,ifwinactive,ahk_class Red Alert 2
Hotkey,F5,禁用按键
Hotkey,F6,禁用按键
Hotkey,F7,禁用按键
Hotkey,F9,一键观战
}
DetectHiddenWindows,Off
_KeyDelay:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","_KeyDelay") ;按键延迟
ScreenPosUpDown:=_IniRead(20,"Settings\" . ProjectSelect . ".ini","Default","ScreenPosUpDown") ;屏幕范围
Check3View:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","Check3View") ;Check3View视图
CustomFont:=_IniRead("微软雅黑","Settings\" . ProjectSelect . ".ini","Default","CustomFont") ;字体
CustomFontSize:=_IniRead(10,"Settings\" . ProjectSelect . ".ini","Default","CustomFontSize") ;字号
ToggleCheckOnTop:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","ToggleCheckOnTop") ;ToggleCheckOnTop
;ToggleCheckHidden 提示音
ToggleCheckHidden:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","ToggleCheckHidden")
ToggleCheckAutorun:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","ToggleCheckAutorun") ;ToggleCheckAutorun
ToggleCheckRunThis:=_IniRead(0,"Settings\" . ProjectSelect . ".ini","Default","ToggleCheckRunThis") ;ToggleCheckRunThis
ToggleCheck检查更新:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","ToggleCheck检查更新") ;ToggleCheck检查更新
gamecode1:=_IniRead(123,"Settings\" . ProjectSelect . ".ini","Default","gamecode1") ;密码房1
gamecode2:=_IniRead(321,"Settings\" . ProjectSelect . ".ini","Default","gamecode2") ;密码房2
CustomButton延迟:=_IniRead(50,"Settings\" . ProjectSelect . ".ini","Default","CustomButton延迟") ;CustomButton延迟
CustomButton1:=_IniRead("自定按钮 1","Settings\" . ProjectSelect . ".ini","Default","CustomButton1") ;CustomButton1
LVCustomButton1_1:=_IniRead(A_ScriptDir . "=1","Settings\" . ProjectSelect . ".ini","Default","LVCustomButton1_1") ;CustomButton1L
LVCustomButton1_2:=_IniRead("http://pan.baidu.com/share/link?shareid=65739&uk=1896339698=1","Settings\" . ProjectSelect . ".ini","Default","LVCustomButton1_2") ;CustomButton1R
CustomButton2:=_IniRead("自定按钮 2","Settings\" . ProjectSelect . ".ini","Default","CustomButton2") ;CustomButton2
LVCustomButton2_1:=_IniRead("http://www.baidu.com/=1","Settings\" . ProjectSelect . ".ini","Default","LVCustomButton2_1") ;CustomButton2L
LVCustomButton2_2:=_IniRead("https://www.google.com.hk/=1","Settings\" . ProjectSelect . ".ini","Default","LVCustomButton2_2") ;CustomButton2R
CustomButton3:=_IniRead("QQ平台启动游戏","Settings\" . ProjectSelect . ".ini","Default","CustomButton3") ;CustomButton3
LVCustomButton3_1:=_IniRead(QQBattleZoneDir . "=1","Settings\" . ProjectSelect . ".ini","Default","LVCustomButton3_1") ;CustomButton3L
LVCustomButton3_2:=_IniRead("http://url.cn/OrPeIP","Settings\" . ProjectSelect . ".ini","Default","LVCustomButton3_2") ;CustomButton3R
CustomButton4:=_IniRead("挤厅器","Settings\" . ProjectSelect . ".ini","Default","CustomButton4") ;CustomButton4
LVCustomButton4_1:=_IniRead("Update\QQBattleZoneLoginTool.exe=1","Settings\" . ProjectSelect . ".ini","Default","LVCustomButton4_1") ;CustomButton4L
LVCustomButton4_2:=_IniRead("http://user.qzone.qq.com/50786729/blog/1243250406=1","Settings\" . ProjectSelect . ".ini","Default","LVCustomButton4_2") ;CustomButton4R
Ra2Handle:=_IniRead("","Settings\" . ProjectSelect . ".ini","Default","Ra2Handle") ;游戏ID列表
;~ MsgBox,%QQBattleZoneDir%
IniRead, IME_CN,Settings\%ProjectSelect%.ini, Default,IME_CN
IniRead, WinGetDDL,Settings\%ProjectSelect%.ini, Default,WinGetDDL
MyRadioGroup1:=_IniRead(1,"Settings\" . ProjectSelect . ".ini","Default","MyRadioGroup1") ;标准/鼠标/高级
WebURL:=_IniRead("http://url.cn/OrPeIP","Settings\" . ProjectSelect . ".ini","Default","WebURL") ;起始页
;---------------TreeView参数
︰【工具助手(显示/隐藏)】=~鼠标中键
︰【重启软件】=~F5
︰【音量增大】=Win+滚轮上
︰【音量减小】=Win+滚轮下
︰【关闭红警】=~F12
︰【重启红警】=~^F12
︰〖上一页(网路/返回)〗=~鼠标右键
︰快速设键=Ctrl+F10
︰切换结盟=Tab
︰最后建造追加热键=大写键
︰取消画面全部建造=Esc
︰一键观战=~F8
︰选中高血部队:映射Shift+t=《`%選擇種類`%﹍次数1﹍延时0》《`%生命值順序`%﹍次数3﹍延时0》
︰选中三星编为6队:映射~Alt+Q=《T﹍次数1﹍延时0》《Y﹍次数1﹍延时0》《Ctrl+6﹍次数1﹍延时0》
︰选中残血编为7队:映射~Alt+W=《T﹍次数1﹍延时0》《U﹍次数1﹍延时0》《Shift+7﹍次数1﹍延时0》《Ctrl+7﹍次数1﹍延时0》《T﹍次数1﹍延时0》《U﹍次数1﹍延时0》《Shift+7﹍次数1﹍延时0》《Ctrl+7﹍次数1﹍延时0》
︰一键打开基地编8队:映射M=《`%下一個物件`%﹍次数1﹍延时0》《`%部署物件`%﹍次数1﹍延时0》《`%創建8部隊`%﹍次数1﹍延时0》
︰Alt+E=编9队:映射~Alt+E=《Ctrl+9﹍次数1﹍延时0》
︰Alt+R=编0队:映射~Alt+R=《Ctrl+0﹍次数1﹍延时0》
︰i:映射鼠标中键=《i﹍次数1﹍延时0》
︰8队:映射大写键=《8﹍次数1﹍延时0》
︰编8队:映射Alt+大写键=《Alt+8﹍次数1﹍延时0》
︰增编8队:映射Shift+大写键=《Shift+8﹍次数1﹍延时0》《Alt+8﹍次数1﹍延时0》
;~ ︰一键打开基地:映射M=《%下一個物件%﹍次数1﹍延时0》《%部署物件%﹍次数1﹍延时0》《%創建8部隊%﹍次数1﹍延时0》
︰移动攻击=A
︰移动+点击=滚轮下
︰保护模式=F
︰保护+点击=滚轮上
︰心灵信标=$B
︰残血部队=Alt+滚轮下
︰空格键+Ctrl=Space
︰〈电厂〉=QE
︰〈矿厂〉=QR
︰〈兵营〉=QD
︰〈重工〉=QF
︰〈空指〉=QT
︰〈维修厂〉=QG
︰〈实验室〉=QV
︰〈造船厂〉=QC
︰〈精炼器|核子炉〉=QB
︰〈空降兵〉=WT
︰〈围墙〉=WE
︰〈碉堡〉=WR
︰〈防空炮|爱国者〉=WD
︰〈光棱塔|磁爆圈〉=WF
︰〈巨炮〉=WG
︰〈间谍卫星|复制中心〉=WZ
︰〈裂缝产生器|心灵探测器〉=WC
︰〈超时空传送仪|铁幕装置〉=WV
︰〈天气控制器|核弹发射井〉=WB
︰〈大兵〉=EE
︰〈狗〉=ED
︰〈工程师〉= ER
︰〈磁暴步兵〉=EF
︰〈飞行兵|防空兵〉=ET
︰〈狙击手|辐射兵|恐怖分子〉=EG
︰〈间谍|伊文〉=EV
︰〈谭雅|尤里〉=EC
︰〈时空兵〉=EB
︰〈矿车〉=RE
︰〈坦克〉=RR
︰〈防空车〉=RD
︰〈光棱|天启〉=RF
︰〈飞机|蜘蛛〉=RT
︰〈坦克杀手|自爆卡车|磁能坦克〉=RG
︰〈基地车〉=RH
︰〈幻影|飞艇〉=RV
︰〈运输艇〉=RA
︰〈驱逐舰|潜水艇〉=RS
︰〈海豚|乌贼〉=RZ
︰〈巡洋舰|海蝎〉=RX
︰〈直升机|V3火箭〉=RC
︰〈航母舰|无畏舰〉=RB
;~ 补充内容
︰〈小狗2〉=E2
︰〈小狗3〉=E3
︰〈小狗4〉=E4
︰〈坦克2〉=R2
︰〈坦克3〉=R3
︰〈坦克4〉=R4
〈电厂〉︰=发电厂,磁能反应炉,电厂英文版
〈矿厂〉︰=矿石精炼厂,矿石精炼场
〈兵营〉︰=兵营,兵營
〈重工〉︰=战车工厂,戰車工廠
〈空指〉︰=空指部,雷达
〈维修厂〉︰=维修厂,維修廠
〈实验室〉︰=作战实验室,作戰實驗室
〈造船厂〉︰=造船厂,造船廠
〈精炼器|核子炉〉︰=矿石精炼器,核子反应炉
〈围墙〉︰=围墙,圍墻
〈碉堡〉︰=机枪碉堡,哨戒炮
〈爱国者|防空炮〉︰=爱国者飞弹,防空炮
〈光棱塔|磁爆圈〉︰=光棱塔,磁爆线圈
〈空降兵〉︰=空降部队
〈巨炮〉︰=巨炮【法国】
〈裂缝产生器|心灵探测器〉︰=裂缝产生器,心灵探测器
〈间谍卫星|复制中心〉︰=间谍卫星,复制中心
〈天气控制器|核弹发射井〉︰=天气控制器【制造】,天气控制器【施放】,核弹发射井【施放】,核弹发射井【制造】
〈超时空传送仪|铁幕装置〉︰=超时空传送仪【施放】,超时空传送仪【制造】,铁幕装置【施放】,铁幕装置【制造】
〈大兵〉︰=美国大兵,动员兵,解放军战士
〈工程师〉︰=工程师,工程師
〈狗〉︰=警犬【盟】,警犬【苏】
〈磁暴步兵〉︰=磁暴步兵
〈飞行兵|防空兵〉︰=火箭飞行兵,防空步兵
〈狙击手|辐射兵|恐怖分子〉︰=狙击手【英国】,辐射工兵【伊拉克】,恐怖分子【古巴】
〈间谍|伊文〉︰=间谍,疯狂伊文
〈谭雅|尤里〉︰=谭雅,尤里
〈时空兵〉︰=超时空军团兵
〈矿车〉︰=超时空采矿车,武装采矿车
〈坦克〉︰=灰熊坦克,犀牛坦克
〈防空车〉︰=多功能步兵车,防空履带车
〈光棱|天启〉︰=光棱坦克,天启坦克
〈飞机|蜘蛛〉︰=入侵者战机,黑鹰战机【韩国】,恐怖机器人
〈坦克杀手|自爆卡车|磁能坦克〉︰=坦克杀手【德国】,自爆卡车【利比亚】,磁能坦克【苏俄】
〈直升机|V3火箭〉︰=夜鹰直升机,V3火箭
〈幻影|飞艇〉︰=幻影坦克,基洛夫空艇
〈基地车〉︰=机动基地车,機動基地車
〈运输艇〉︰=两栖运输艇,装甲运兵船
〈驱逐舰|潜水艇〉︰=驱逐舰,攻击潜艇
〈海豚|乌贼〉︰=海豚,巨型乌贼
〈航母舰|无畏舰〉︰=航空母舰,无畏级战舰
〈巡洋舰|海蝎〉︰=神盾巡洋舰,海蝎
;~ 补充内容
〈小狗2〉︰:=〈狗〉︰
〈小狗3〉︰:=〈狗〉︰
〈小狗4〉︰:=〈狗〉︰
〈坦克2〉︰:=〈坦克〉︰
〈坦克3〉︰:=〈坦克〉︰
〈坦克4〉︰:=〈坦克〉︰
全局通用热键=【工具助手(显示/隐藏)】,【重启软件】,【音量增大】,【音量减小】,【关闭红警】,【重启红警】
红色警戒=控制热键,建造热键,映射实例
控制热键=快速设键,切换结盟,最后建造追加热键,取消画面全部建造,一键观战,移动攻击,移动+点击,保护模式,保护+点击,心灵信标,残血部队,空格键+Ctrl
建造热键=建筑页面_Q,防御页面_W,步兵页面_E,车辆页面_R
建筑页面_Q=〈电厂〉,〈矿厂〉,〈兵营〉,〈重工〉,〈空指〉,〈维修厂〉,〈实验室〉,〈造船厂〉,〈精炼器|核子炉〉
防御页面_W=〈围墙〉,〈碉堡〉,〈爱国者|防空炮〉,〈光棱塔|磁爆圈〉,〈巨炮〉,〈间谍卫星|复制中心〉,〈裂缝产生器|心灵探测器〉,〈超时空传送仪|铁幕装置〉,〈天气控制器|核弹发射井〉
步兵页面_E=〈大兵〉,〈狗〉,〈工程师〉,〈磁暴步兵〉,〈飞行兵|防空兵〉,〈狙击手|辐射兵|恐怖分子〉,〈间谍|伊文〉,〈谭雅|尤里〉,〈时空兵〉,〈小狗2〉,〈小狗3〉,〈小狗4〉
车辆页面_R=〈矿车〉,〈坦克〉,〈防空车〉,〈光棱|天启〉,〈飞机|蜘蛛〉,〈坦克杀手|自爆卡车|磁能坦克〉,〈基地车〉,〈直升机|V3火箭〉,〈幻影|飞艇〉,〈运输艇〉,〈驱逐舰|潜水艇〉,〈海豚|乌贼〉,〈航母舰|无畏舰〉,〈巡洋舰|海蝎〉,〈坦克2〉,〈坦克3〉,〈坦克4〉
映射实例=选中三星编为6队:映射~Alt+Q,选中残血编为7队:映射~Alt+W,一键打开基地编8队:映射M,Alt+E=编9队:映射~Alt+E,Alt+R=编0队:映射~Alt+R,i:映射鼠标中键,8队:映射大写键,编8队:映射Alt+大写键,增编8队:映射Shift+大写键,选中高血部队:映射Shift+t
游戏内置按键=資訊,隊伍,控制,選項,介面,叫囂
資訊=座標
隊伍=將1隊置中,將2隊置中,將3隊置中,將4隊置中,將5隊置中,將6隊置中,將7隊置中,將8隊置中,將9隊置中,將10隊置中,創建1部隊,創建2部隊,創建3部隊,創建4部隊,創建5部隊,創建6部隊,創建7部隊,創建8部隊,創建9部隊,創建10部隊,選擇1隊,選擇2隊,選擇3隊,選擇4隊,選擇5隊,選擇6隊,選擇7隊,選擇8隊,選擇9隊,選擇10隊,新增選擇10隊,新增選擇1隊,新增選擇2隊,新增選擇3隊,新增選擇4隊,新增選擇5隊,新增選擇6隊,新增選擇7隊,新增選擇8隊,新增選擇9隊
控制=同盟,分散,警戒,物件停止,喝彩,部署物件,路徑點
選項=下一個物件,基地置中,生命值順序,等級順序,前一個物件,選擇戰鬥部隊,選擇種類,觀點置中
介面=刪除,查看書籤1,查看書籤2,查看書籤3,查看書籤4,呼叫玩家,選擇防禦頁面,前往雷達通報事件現場,配置心靈信標,卷軸列向上,卷軸列向上換頁,卷軸列向下,卷軸列向下換頁,遊戲選項,選擇步兵頁面,選擇車輛頁面,選擇建築頁面,建築物列表向上換頁,建築物列表向下換頁,建築物列表向下卷動,列出部隊,列出建築物,變賣模式,設定書籤1,設定書籤2,設定書籤3,設定書籤4,修護模式,擷取遊戲畫面,跟隨,部隊列表向上換頁,部隊列表向下換頁,部隊列表向下卷動
叫囂=叫囂1,叫囂2,叫囂3,叫囂4,叫囂5,叫囂6,叫囂7,叫囂8
/* 介面=刪除,查看書籤1,查看書籤2,查看書籤3,查看書籤4,呼叫玩家,前往雷達通報事件現場,配置心靈信標,遊戲選項,選擇建築頁面,選擇防禦頁面,選擇步兵頁面,選擇車輛頁面,變賣模式,設定書籤1,設定書籤2,設定書籤3,設定書籤4,修護模式,擷取遊戲畫面,跟隨
;~ TreeView_Ra2HK_2=建造热键,控制热键,界面热键,系统热键
;~ 界面热键=〖上一页(网路/返回)〗,快速设键
;~ 系统热键=一键关闭红警,音量增大【系统】,音量减小【系统】
;~ 控制热键=最后建造追加热键,取消画面全部建造,一键观战,一键打开基地,移动攻击,保护模式,心灵信标,残血部队
;~ 建造热键=伞兵【中立建筑】,工程师,版本兼容,盟军阵营,苏军阵营
;~ 版本兼容=解放军战士,矿厂【中国】,矿厂英文版,电厂英文版,步兵车英文版
;~ 盟军阵营=盟军建筑,盟军防御,盟军兵营,盟军车辆
;~ 盟军建筑=发电厂,矿石精炼厂,兵营,战车工厂,空指部,维修厂,作战实验室,造船厂,矿石精炼器
;~ 盟军防御=围墙,机枪碉堡,爱国者飞弹,光棱塔,巨炮【法国】,间谍卫星,裂缝产生器,超时空传送仪【制造】,超时空传送仪【施放】,天气控制器【制造】,天气控制器【施放】
;~ 盟军兵营=空降部队,美国大兵,警犬【盟】,火箭飞行兵,狙击手【英国】,间谍,谭雅,超时空军团兵,超时空突击队
;~ 盟军车辆=超时空采矿车,灰熊坦克,多功能步兵车,坦克杀手【德国】,幻影坦克,光棱坦克,机动基地车,入侵者战机,黑鹰战机【韩国】,夜鹰直升机,海豚,驱逐舰,两栖运输艇,神盾巡洋舰,航空母舰
;~ 苏军阵营=苏军建筑,苏军防御,苏军兵营,苏军车辆
;~ 苏军建筑=磁能反应炉,矿石精炼场,兵營,戰車工廠,雷达,維修廠,作戰實驗室,核子反应炉,复制中心,造船廠
;~ 苏军防御=圍墻,哨戒炮,防空炮,磁爆圈,心灵探测器,铁幕装置【制造】,铁幕装置【施放】,核弹发射井【施放】,核弹发射井【制造】
;~ 苏军兵营=动员兵,防空步兵,警犬【苏】,磁暴步兵,疯狂伊文,恐怖分子【古巴】,辐射工兵【伊拉克】,尤里
;~ 苏军车辆=武装采矿车,犀牛坦克,防空履带车,恐怖机器人,V3火箭,天启坦克,自爆卡车【利比亚】,磁能坦克【苏俄】,機動基地車,基洛夫空艇,装甲运兵船,攻击潜艇,巨型乌贼,海蝎,无畏级战舰
;~ 建筑页面【Q】=qe_______电厂,qr_______矿厂,qd_______兵营,qf_______重工,qt_______空指$雷达,qg_______维修厂,qc_______船厂,qv_______高科,qb_______矿石精炼厂$复制中心,qh_______核电厂
;~ 防御页面【W】=we_______围墙,wr_______碉堡,wd_______爱国者$防空炮,wf_______光棱塔$磁暴线圈,wt_______空降兵$伞兵,wg_______巨炮,wc_______裂缝产生器,wv_______间谍卫星$心灵探测器
;~ 步兵页面【E】=ee_______大兵,er_______工程师,ed_______警犬,ef_______时空兵$磁爆步兵,et_______飞兵$防空兵,eg_______狙击手$辐射兵,ec_______间谍$伊文,ev_______谭雅$尤里,eb_______恐怖分子
;~ 车辆页面【R】=re_______矿车,rr_______坦克,rd_______步兵车$防空车,rf_______光棱坦克$天启坦克,rt_______飞机$蜘蛛,rg_______坦克杀手$自暴卡车,ry_______磁能坦克,rc_______直升飞机$V3火箭,rv_______幻影$飞艇,rh_______基地车,ra_______运输船,rs_______巡洋艇$海蝎,rz_______海豚$乌贼,rx_______驱逐艇$潜艇,rb_______航母$无畏
*/
;---------------自定义热键参数
;~ 滚轮上=WheelUp
;~ 滚轮下=WheelDown
;~ 鼠标左键=LButton
;~ 鼠标中键=MButton
;~ 鼠标右键=RButton
;~ 大写键=CapsLock
; 屏幕上方(左)=1
; 屏幕上方(右)=2
; 屏幕左侧(上)=3
; 屏幕左侧(下)=4
; 屏幕右侧(上)=5
; 屏幕右侧(下)=6
_Block0=~
_Ctrl1=Ctrl+
_Shift1=Shift+
_Alt1=Alt+
_Win1=Win+
CheckClickCount1=︰双击
GameIDPic1=∑
GameIDPic2=Ⅰ
GameIDPic3=,
GameIDPic4=∮
GameIDPic5=∝
GameIDPic6=…
GameIDPic7=┼
GameIDPic8=╪
GameIDPic9=∧
GameIDPic10=‰
GameIDPic11=$
GameIDPic12=<
GameIDPic13=Ε
GameIDPic14=Ⅱ
GameIDPic15=Z
GameIDPic16=Ⅲ
GameIDPic17=Ⅳ
GameIDPic18=‘
GameIDPic19=’
GameIDPic20=“
GameIDPic21=”
GameIDPic22=。
GameIDPic23=_
GameIDPic24=—
GameIDPic25=~
GameIDPic26=㎞
GameIDPic27=ζ
GameIDPic28=>
GameIDPic29=ω
GameIDPic30=Ⅴ
GameIDPic31=z
GameIDPic32=γ
VarSetCapacity(dM,156,0), NumPut(156,dM,36, "UInt")
DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40, "UInt")
PrevDisplay:=NumGet(DM,104,"UInt") ;;----------取得当前颜色
;------Tree默认配置------;
IniRead,TreeView_HK_1,Settings\%ProjectSelect%.ini,Default,TreeView_HK_1
if TreeView_HK_1=ERROR
{
TreeView_HK_1=全局通用热键,红色警戒
IniWrite,%TreeView_HK_1%,Settings\%ProjectSelect%.ini,Default,TreeView_HK_1
AddTreeDefault(TreeView_HK_1)
Gosub,预设默认配置
}
;~ MsgBox,%TreeView_Ra2HK_1%
;~ MsgBox,有
CreateRa2GUI()
;~ MsgBox,% a_tickcount-starttime
;~ MsgBox,有
CreateRa2Menu()
Gui, Menu, MyMenuBar
; GuiControl, Choose, MySubroutine,按键设置
;msgmsg魂牵梦萦msggui
; Gui, Add, StatusBar,, Bar's starting text (omit to start off empty).
; SB_SetText("There are " . A_EventInfo . " rows selected.")
; MyStatusBar =你好
; Gui, Add, StatusBar, vMyStatusBar
;~ MsgBox,%GuiShowPosX%
;~ Gui,-Caption
gosub,GuiControlAss
SetTimer,Get红警游戏界面pos,2000
SetTimer WindowCheck_Alert,1000
;~ GamelistH:=A_ScreenHeight
;~ GamelistW:=A_ScreenWidth
/*
Settimer,CheckGameList,1000
Menu, GameListMenu, Add, 开始, GameListMenuLabel
Menu, GameListMenu, Add, 退出, GameListGuiClose
gui,GameList:new
Gui,GameList:-Caption +AlwaysOnTop +Border +HwndGameListhwnd
Gui,GameList:add,CheckBox,section h25 vGameAssign gGameAssign,自动接受
;~ Gui,GameList:add,CheckBox,ys h25 checked,切换到游戏
Gui,GameList:add,CheckBox,ys h25 checked,观察色
;~ Gui,GameList:add,Button,x+-0 yp+4 H15 W15 gGameListGuiClose,×
Gui, Add, StatusBar,vStatusBarStr ;,, Bar's starting text (omit to start off empty).
;~ SB_SetText("There are " . RowCount . " rows selected.")
;~ Gui,GameList:add,Text,xs vGameListN,当前人数:`t游戏数:
;~ Gui, GameList:Default
Gui,GameList:Show,w160 x%GameListPosX% y%GameListPosY%
Hotkey,ifwinactive,ahk_id %GameListhwnd%
hotkey,~lbutton up,GameListLButtonUp
*/
;~ SetTimer 游戏列表,1000
;~ return
Gui, Show,Hide AutoSize x%GuiShowPosX% y%GuiShowPosY% NA
SetTimer,ToggleCheckOnTopCheck,3000
;~ return
Gui +LastFound
;~ Gui, Color, 1ef0f0
;~ GuiControl +Background1ef0f0, ListViewShortCut
;~ Gui +LastFound ; 让 GUI 窗口成为 上次找到的窗口 以用于下一行的命令.
;~ WinSet, TransColor, 1ef0f0
;~ WinSet, TransColor, a5e1b0
;~ WinSet, TransColor,EEAA99 240
;~ MsgBox,% %1440x900%bit
MyGuihwnd := WinExist()
Hotkey,IfWinActive,ahk_id %MyGuihwnd%
Hotkey,~LButton up,LButtonUp
;~ If ShowGui=1
;~ Gosub GuiShow
OnMessage(0x200, "WM_MOUSEMOVE")
OnMessage(0x201, "WM_LBUTTONDOWN")
;~ OnMessage(0x202, "WM_LBUTTOnup")
GameIDClassNN:=Control_GetClassNN(MyGuihwnd,hwndGameIDStr) ;特殊字符Edit
if ProgramCheck=1
gosub,FileSearch
else
{
if Ra2Dir=Error
{
loop
{
IniRead,str,default.ini,Program,P%A_Index%
if str=ERROR
break
IfInString,str,ra2.exe
{
StringGetPos,n,str,=
StringTrimLeft,m,str,n+1
StringReplace,Ra2Dir,m,\ra2.exe
Ra2Dir:=_IniRead(Ra2Dir,"Settings\" . ProjectSelect . ".ini","default","Ra2Dir")
}
}
}
if QQBattleZoneDir=Error
{
loop
{
IniRead,str,default.ini,Program,P%A_Index%
if str=ERROR
break
IfInString,str,QQBattleZone.exe
{
StringGetPos,n,str,=
StringTrimLeft,m,str,n+1
StringReplace,QQBattleZoneDir,m,\QQBattleZone.exe
QQBattleZoneDir:=_IniRead(QQBattleZoneDir,"Settings\" . ProjectSelect . ".ini","default","QQBattleZoneDir")
IniWrite,%QQBattleZoneDir%\QQBattleZone.exe=1,Settings\%ProjectSelect%.ini,default,LVCustoMButton3_1
}
}
}
}
gosub, LButtonUp
needHide := MyGuihwnd ;自动隐藏入口
SetTimer, watchCursor, 300
;~ Hotkey, IfWinActive , ahk_id %Myguihwnd%
;~ Hotkey, ~LButton up,LButtonUpCHECK
;~ Hotkey, ~LButton,LButtonDropCHECK
ComObjError(false)
WB.Silent:="true"
WB.Navigate(WebURL)
;--------------------------检查更新
WinGet,VersionScript,ProcessPath,ahk_id %MyGuihwnd%
FileGetTime, VersionScript, %VersionScript%, C
StringTrimRight,VersionScript,VersionScript,2
Version:="当前:" SubStr(VersionScript,3,2) "." SubStr(VersionScript,5,2) "."SubStr(VersionScript,7,2)
GuiControl, ,Version,%Version%
if (ToggleCheck检查更新=1 && displayHIDDEN=1)
{
;~ MsgBox,7
IE := ComObjCreate("InternetExplorer.Application") ; 创建 IE 对象
;~ ComObjError(false) ;不知道有用没
;~ IE.Silent:="True" ;不知道有用没
;~ IE.Visible := false ; 由于 IE 对象默认是隐藏的 (后台), 这里让它显示出来, 这样我们可以看到操作的效果
;~ 百度网盘:="http://pan.baidu.com/share/link?shareid=65739&uk=1896339698#dir/path=%2F%E6%B8%B8%E6%88%8F"
;~ 百度网盘:="http://pan.baidu.com/share/link?shareid=65739&uk=1896339698"
IE.Navigate("http://pan.baidu.com/share/link?shareid=65739&uk=1896339698")
while, (IE.ReadyState != 4 || IE.Busy)
; while, WB.Busy
Sleep, 100
;~ while, IE.Busy
;~ Sleep, 10
InnerText := IE.document.DocumentElement.InnerText
IE.Quit
;~ MsgBox,%InnerText%
loop,Parse,InnerText,`n
{
IfInString,A_LoopField,旧版备份
{
;~ MsgBox,%a_loopfield%
StringGetPos,n,A_LoopField,游戏,L2
;~ stringleft,str,a_loopfield,n
;~ StringRight,str,a_loopfield,n
StringMid,str,A_LoopField,n-15,16
VersionWeb:= RegExReplace( str, "[^0-9]" )
;~ MsgBox,%VersionWeb%`n%VersionScript% ;;=%a_loopfield%
break
;~ VersionWeb:= RegExReplace( str, "[^0-9]" )
}
}
;~ VersionWeb:=20130108
if ((VersionScript!=VersionWeb) && StrLen(VersionWeb)=12)
GuiControl, ,Version,% "更新:" SubStr(VersionWeb,3,2) "-" SubStr(VersionWeb,5,2) "-" SubStr(VersionWeb,7,2)
;~ MsgBox,%VersionWeb%
;-------------分辨率
;~ EnumDisplaySettingsA()
;~ MsgBox,% Display_Ra2
;~ GuiControl, ,Display_Ra2,%Display_Ra2%
}
;~ Gui, Minimize
return
SetSystemCursor( Cursor = "", cx = 0, cy = 0 )
{
BlankCursor := 0, SystemCursor := 0, FileCursor := 0 ; init
SystemCursors = 32512IDC_ARROW,32513IDC_IBEAM,32514IDC_WAIT,32515IDC_CROSS
,32516IDC_UPARROW,32640IDC_SIZE,32641IDC_ICON,32642IDC_SIZENWSE
,32643IDC_SIZENESW,32644IDC_SIZEWE,32645IDC_SIZENS,32646IDC_SIZEALL
,32648IDC_NO,32649IDC_HAND,32650IDC_APPSTARTING,32651IDC_HELP
if Cursor = ; empty, so create blank cursor
{
VarSetCapacity( AndMask, 32*4, 0xFF ), VarSetCapacity( XorMask, 32*4, 0 )
BlankCursor = 1 ; flag for later
}
else if SubStr( Cursor,1,4 ) = "IDC_" ; load system cursor
{
loop, Parse, SystemCursors, `,
{
CursorName := SubStr( A_LoopField, 6, 15 ) ; get the cursor name, no trailing Space with substr
CursorID := SubStr( A_LoopField, 1, 5 ) ; get the cursor id
SystemCursor = 1
if ( CursorName = Cursor )
{
CursorHandle := DllCall( "LoadCursor", Uint,0, Int,CursorID )
break
}
}
if CursorHandle = ; invalid cursor name given
{
MsgBox,, SetCursor, Error: Invalid cursor name
CursorHandle = Error
}
}
else if FileExist( Cursor )
{
SplitPath, Cursor,,, Ext ; auto-detect type
if Ext = ico
uType := 0x1
else if Ext in cur,ani
uType := 0x2
else ; invalid file ext
{
MsgBox,, SetCursor, Error: Invalid file type
CursorHandle = Error
}
FileCursor = 1
}
else
{
MsgBox,, SetCursor, Error: Invalid file path or cursor name
CursorHandle = Error ; raise for later
}
if CursorHandle != Error
{
loop, Parse, SystemCursors, `,
{
if BlankCursor = 1
{
Type = BlankCursor
%Type%%A_Index% := DllCall( "CreateCursor"
, Uint,0, Int,0, Int,0, Int,32, Int,32, Uint,&AndMask, Uint,&XorMask )
CursorHandle := DllCall( "CopyImage", Uint,%Type%%A_Index%, Uint,0x2, Int,0, Int,0, Int,0 )
DllCall( "SetSystemCursor", Uint,CursorHandle, Int,SubStr( A_LoopField, 1, 5 ) )
}
else if SystemCursor = 1
{
Type = SystemCursor
CursorHandle := DllCall( "LoadCursor", Uint,0, Int,CursorID )
%Type%%A_Index% := DllCall( "CopyImage"
, Uint,CursorHandle, Uint,0x2, Int,cx, Int,cy, Uint,0 )
CursorHandle := DllCall( "CopyImage", Uint,%Type%%A_Index%, Uint,0x2, Int,0, Int,0, Int,0 )
DllCall( "SetSystemCursor", Uint,CursorHandle, Int,SubStr( A_LoopField, 1, 5 ) )
}
else if FileCursor = 1
{
Type = FileCursor
%Type%%A_Index% := DllCall( "LoadImageA"
, UInt,0, Str,Cursor, UInt,uType, Int,cx, Int,cy, UInt,0x10 )
DllCall( "SetSystemCursor", Uint,%Type%%A_Index%, Int,SubStr( A_LoopField, 1, 5 ) )
}
}
}
}
RestoreCursors()
{
SPI_SETCURSORS := 0x57
DllCall( "SystemParametersInfo", UInt,SPI_SETCURSORS, UInt,0, UInt,0, UInt,0 )
}
WM_MOUSEMOVE()
{
;~ WinGetActiveTitle,out
;~ tooltip,%out%=
static CurRControl, PrevControl, _TT ; _TT 保持为空以便用于下面的 ToolTip 命令.
CurRControl := A_GuiControl
if (CurRControl <> PrevControl and not InStr(CurRControl, " "))
{
ToolTip ; 关闭之前的工具提示.
SetTimer, DisplayToolTip, 1000
PrevControl := CurRControl
}
return
DisplayToolTip:
SetTimer, DisplayToolTip, Off
ToolTip % %CurRControl%_TT ; 前导的百分号表示要使用表达式.
SetTimer, RemoveToolTip, 3000
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
}
/*
~NumpadEnter::
~Enter::
~n::
Suspend permit
IME_CHECK:
Build_x1:=A_ScreenWidth-Build_X
Build_x2:=Build_x1+Build_W
Build_y2:=Build_y1+Build_H
Enter_y2:=15
Sleep,200
If WinActive("Red Alert","GUI:Join") Or WinActive("Red Alert","GUI:StartGame")
{
PostMessage, 0x50, 0, %IME_CN%,,A
Suspend,On
}
Else
{
IME:=DllCall("GetKeyboardLayout","UINT",DllCall("GetWindowThreadProcessId","UINT",WinActive("Red Alert"),"UINTP",0),UInt)
i:=IsChatting()
If IsChatting()
{
PostMessage, 0x50, 0, %IME_CN%,,A
Suspend,On
}
Else
{
PostMessage, 0x50, 0, %IME_EN%,,A
Suspend,Off
}
}
Return
红警工具Move:
SetWinDelay,0
MoveCurrent:=a_tickcount
MouseGetPos,KDE_X1,KDE_Y1,KDE_id
WinGet,Win_MinMax,MinMax,ahk_id %Myguihwnd%
if Win_MinMax
return
WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %Myguihwnd%
;~ if (KDE_Y1 - KDE_WinY1 <=25 AND KDE_X1 - KDE_WinX1 >40 ){
;~ tooltip,有
Loop
{
;~ tooltip,有
GetKeyState,KDE_Button,LButton,P
MouseGetPos,KDE_X2,KDE_Y2
KDE_X2 -= KDE_X1
KDE_Y2 -= KDE_Y1
KDE_WinX2 := (KDE_WinX1 + KDE_X2)
KDE_WinY2 := (KDE_WinY1 + KDE_Y2)
WinMove,ahk_id %Myguihwnd%,,%KDE_WinX2%,%KDE_WinY2%
}until (KDE_Button = "U")
if (a_tickcount-MoveCurrent>1000)
{
WinGetPos , GuiShowPosX,GuiShowPosY
IniWrite,%GuiShowPosX%,Default.ini, Default,GuiShowPosX
IniWrite,%GuiShowPosY%,Default.ini, Default,GuiShowPosY
}
;~ }
return
*/
WM_LBUTTONDOWN()
{
;~ MsgBox,%a_gui%
;~ If (A_Gui = 1)
PostMessage, 0xA1, 2 ;关键是这行了
;~ if GetKeyState("LButton","P")
;~ {
;~ Sleep,1
;~ WinGetPos , GuiShowPosX,GuiShowPosY
;~ IniWrite,%GuiShowPosX%,Default.ini, Default,GuiShowPosX
;~ IniWrite,%GuiShowPosY%,Default.ini, Default,GuiShowPosY
;~ }
}
;~ WM_LBUTTONup()
;~ {
;~ MsgBox,%a_gui%
;~ If (A_Gui = 1)
;~ PostMessage, 0xA2, 2 ;关键是这行了
;~ PostMessage, 0xA1, 2 ;关键是这行了
;~ MsgBox,%A_GUIX%
;~ }
/*
Hidewin:
HidewinCheck:=!HidewinCheck
IniWrite,%HidewinCheck%,Settings\%ProjectSelect%.ini,Default,HidewinCheck
;~ tooltip,%HidewinCheck%
If HidewinCheck=1
{
;~ Gui, +AlwaysOnTop +ToolWindow
;~ Gui,-Caption +AlwaysOnTop +Owner
Gui,+AlwaysOnTop -Caption
Gui,Show,Autosize
guicontrol,,Hidewin,↓
;~ WinHide, ahk_id %curWinId%
}
else
{
Gui,+Caption
Gui,Show,Autosize
guicontrol,,Hidewin,↑
}
mode := "up"
Gosub, toggleWindow
Return
;~ LButtonUpCHECK:
;~ WinGetPos, , Y
;~ if (y<1 && A_TickCount-LButtonDropCHECK>1000)
;~ {
;~ mode := "up"
;~ Gosub, toggleWindow
;~ }
;~ return
;~ LButtonDropCHECK:
;~ LButtonDropCHECK:=a_tickcount
;~ return
*/
watchCursor:
if GameFrame1<>0
return
;~ #c::SetSystemCursor("IDC_WAIT")
;~ #x::SetSystemCursor("IDC_HAND")
;~ #b::RestoreCursors()
;~ Return
;~ Const IDC_ARROW = 32512
;~ Const IDC_WAIT = 32514
;~ Const IDC_HAND = 32649
;~ Const OCR_NORMAL = 32512 ' system cursor ID's
;~ Const OCR_WAIT = 32514
;~ esc::exitapp
;~ tooltip,GameFrame1
;~ ToolTip,% autohide_%curWinId% "`n" showing_%winId%_x "`n" showing_%winId%_y
MouseGetPos, , , winId ; get window under Mouse pointer
;~ tooltip,%OutputVarControl%
if (autohide_%winId%) { ; window is on the list of 'autohide' windows
if (hidden_%winId%) { ; window is in 'hidden' position
GuiControlGet, MyGui, Pos
if mode = Right ;;----修正位置
showing_%winId%_x := A_ScreenWidth-MyGuiW-SysMenu_WH
WinSet, TransColor,Off, ahk_id %MyGuihwnd%
;~ previousActiveWindow := WinExist("A")
;~ WinActivate, ahk_id %winId% ; activate the window
WinMove, ahk_id %winId%, , showing_%winId%_x, showing_%winId%_y ; move it to 'showing' position
hidden_%winId% := false
needHide := winId ; store it for next iteration
}
} else {
if (needHide) {
if (hidden_%needHide%_x || hidden_%needHide%_y)
WinSet, TransColor, %RandomColor% 50, ahk_id %MyGuihwnd%
WinMove, ahk_id %needHide%, , hidden_%needHide%_x, hidden_%needHide%_y ; move it to 'hidden' position
;~ WinActivate, ahk_id %previousActiveWindow% ; activate previously active window
hidden_%needHide% := true
needHide := false ; do that only once
}
}
;~ tooltip,showing_%winId%_x%curWinId%
return
toggleWindow:
WinGet, curWinId, id, A
autohideWindows = %autohideWindows%,%curWinId%
if (autohide_%curWinId%) {
gosub, unautohide
} else {
autohide_%curWinId% := true
gosub, workWindow
WinGetPos, orig_%curWinId%_x, orig_%curWinId%_y, width, height, ahk_id %curWinId% ; get the window size and store original position
IniWrite,% orig_%curWinId%_x,default.ini,default,GuiShowPosX
IniWrite,% orig_%curWinId%_y,default.ini,default,GuiShowPosY
/*
if (mode = "right") {
showing_%curWinId%_x := A_ScreenWidth - width
showing_%curWinId%_y := orig_%curWinId%_y
hidden_%curWinId%_x := A_ScreenWidth - 1
hidden_%curWinId%_y := orig_%curWinId%_y
} else if (mode = "left") {
showing_%curWinId%_x := 0
showing_%curWinId%_y := orig_%curWinId%_y
hidden_%curWinId%_x := -width + 1
hidden_%curWinId%_y := orig_%curWinId%_y
} else if (mode = "up") {
showing_%curWinId%_x := orig_%curWinId%_x
showing_%curWinId%_y :=0
hidden_%curWinId%_x := orig_%curWinId%_x
hidden_%curWinId%_y := -height + 1
} else { ; down
showing_%curWinId%_x := orig_%curWinId%_x
showing_%curWinId%_y := A_ScreenHeight - height
hidden_%curWinId%_x := orig_%curWinId%_x
hidden_%curWinId%_y := A_ScreenHeight - 1
}
*/
WinMove, ahk_id %curWinId%, , hidden_%curWinId%_x, hidden_%curWinId%_y ; hide the window
hidden_%curWinId% := true
}
return
unautohide:
autohide_%curWinId% := false
needHide := false
gosub, unworkWindow
WinMove, ahk_id %curWinId%, , orig_%curWinId%_x, orig_%curWinId%_y ; go back to original position
hidden_%curWinId% := false
return
workWindow:
;~ DetectHiddenWindows, On
;~ WinSet, AlwaysOnTop, on, ahk_id %curWinId% ; always-on-top
;~ WinHide, ahk_id %curWinId%
;~ Gui,-Caption
;~ WinSet, Style, -0xC00000, ahk_id %curWinId% ; no title bar
;~ WinSet, ExStyle, +0x80, ahk_id %curWinId% ; remove from task bar
;~ WinShow, ahk_id %curWinId%
return
unworkWindow:
;~ DetectHiddenWindows, On
;~ WinSet, AlwaysOnTop, off, ahk_id %curWinId% ; always-on-top
;~ WinHide, ahk_id %curWinId%
;~ WinSet, Style, +0xC00000, ahk_id %curWinId% ; title bar
;~ WinSet, ExStyle, -0x80, ahk_id %curWinId% ; remove from task bar
;~ WinSet, TransColor, %RandomColor% 50
;~ WinShow, ahk_id %curWinId%
return
LButtonUp:
curWinId:=MyGuihwnd
WinGetPos,MyGuiX,MyGuiY,MyGuiW,MyGuiH,ahk_id %MyGuihwnd%
if ((showing_%curWinId%_x = MyGuiX) && (showing_%curWinId%_y =MyGuiY))
return
;~ LButtonUp_:
if MyGuiY<0
{
mode = Up
showing_%curWinId%_x := MyGuiX
showing_%curWinId%_y :=SysMenu_WH ;+SysMenu_H
hidden_%curWinId%_x := MyGuiX
hidden_%curWinId%_y :=-MyGuiH + 1
autohide_%curWinId% := true
needHide := winId ; store it for next iteration
Gui,+AlwaysOnTop
}
else if (MyGuiX+MyGuiW>A_ScreenWidth)
{
mode = Right
showing_%curWinId%_x := A_ScreenWidth-MyGuiW-SysMenu_WH
showing_%curWinId%_y :=MyGuiY
;~ hidden_%curWinId%_x := A_ScreenWidth-1
hidden_%curWinId%_x :=A_ScreenWidth-1
;~ MsgBox,% SysMenuW
hidden_%curWinId%_y :=MyGuiY
autohide_%curWinId% := true
needHide := winId ; store it for next iteration
Gui,+AlwaysOnTop
}
else if MyGuiX<0
{
mode = Left
showing_%curWinId%_x :=SysMenu_WH ;+SysMenuWW
showing_%curWinId%_y :=MyGuiY
;~ hidden_%curWinId%_x := A_ScreenWidth-1
hidden_%curWinId%_x :=autohide_%curWinId% ? -MyGuiW + 1: -MyGuiW +1
;~ MsgBox,% SysMenuW
hidden_%curWinId%_y :=MyGuiY
autohide_%curWinId% := true
needHide := winId ; store it for next iteration
Gui,+AlwaysOnTop
}
else
{
autohide_%curWinId% := false
needHide := false ; do that only once
}
IniWrite,%MyGuiX%,default.ini,default,GuiShowPosX
IniWrite,%MyGuiY%,default.ini,default,GuiShowPosY
return
MySubroutine:
PrevTab:=MySubroutine
Gui, submit, nohide
;~ MsgBox,%CurrentGuiSizeW%
;~ if MySubroutine=红色警戒
;~ {
;~ }
if MySubroutine=功能说明
{
SysMenu_H:=0 ;;标题栏高度
;~ SysGet ,SysMenu_W,5
SysMenu_WH:=0 ;;拖动点宽度(窄边)
;~ MsgBox,w%CurrentGuiSizeW% h%CurrentGuiSizeH%
GuiControl, Move, WB,w%CurrentGuiSizeW% h%CurrentGuiSizeH%
Gui, Show, AutoSize
Gui,+Resize
}
else
{
SysGet ,SysMenu_H,4 ;;标题栏高度
;~ SysGet ,SysMenu_W,5
SysGet ,SysMenu_WH,68 ;;拖动点宽度(窄边)
Gui,-Resize
;~ Resize
; MouseGetPos, xpos, ypos
; If (xpos>137 && xpos<193 && ypos>50 && ypos<70)
; GuiControl, Move, MySubroutine,H500
; Else
; GuiControl, Move, MySubroutine,w485 h310
; MsgBox,% A_GuiX . "=" . A_GuiY
; Gui +Resize +MinSize640x480
; GuiControl, h900, MySubroutine,按键设置
; MsgBox,% MySubroutine ;A_Gui ;, A_GuiControl, A_GuiEvent 和 A_EventInfo.
; MySubroutineOld:=MySubroutine
; If MySubroutineOld=按键设置
; Gui, Show, AutoSize
; Else
; Gui, Show, AutoSize
; GuiControl, Move, MySubroutine,H500
}
;~ tooltip,有
Gui, Show, AutoSize
;~ settimer,myguigetpos,-500
return
;~ myguigetpos:
;~ GuiControlGet, Mygui, Pos
;~ if mode = Right ;;----修正位置
;~ {
;~ showing_%winId%_x := A_ScreenWidth-MyguiW-SysMenu_WH
;~ WinMove, ahk_id %winId%, , showing_%winId%_x, showing_%winId%_y ; move it to 'showing' position
;~ }
;~ return
;~ ~LButton::
;~ mousegetpos,x,y
;~ PixelGetColor, OutputVar, %X%, %Y%
;~ tooltip,%outputvar%
;~ StringTrimLeft,outputvar,outputvar,2
;~ tooltip,%outputvar%
;~ Gui, Color, %outputvar%
;~ Return
;~ -------------------------------自动隐藏
切换按键设置视图:
Gui,Submit,NoHide
; MsgBox,% Check3View
if Check3View=1
GuiControl,Hide,HKTree2
if Check3View=0
{
GuiControl,Show,HKTree2
GuiControl,Move,HKTree3,w300 h480 x9 y54
}
if Check3View=-1
GuiControl,Move,HKTree3,H255,X15 Y54 W295
; HKTree3h:=255 xm-2 ym+47
; HKTree3x:=15
; HKTree3y:=54
; HKTree3w:=295
Gui, Show, AutoSize
IniWrite,%Check3View%,Settings\%ProjectSelect%.ini,default,Check3View
return
;======函数==========================================================;函数================================================================;
hex2dec(h)
{
SetFormat, integer, dec
d :=h+0
return %d%
}
;十进制转换为十六进制的函数,参数为10进制数整数.ListBox12× 45783
dec2hex(d)
{
SetFormat, integer, hex
h :=d+0
h=%h%
SetFormat, integer, dec ;恢复至正常的10进制计算习惯×6
return %h%
}
DispChangeSettings(colorDepth,ScreenWidth,ScreenHeight,refreshRate)
{
struct_devicemode_size = 156
VarSetCapacity(device_mode, struct_devicemode_size, 0)
EncodeInteger(struct_devicemode_size, 2, &device_mode, 36)
success := DllCall("EnumDisplaySettings", "uint", 0, "uint", -1, "uint", &device_mode)
EncodeInteger(0x00040000|0x00080000|0x00100000|0x00400000, 4, &device_mode, 40)
EncodeInteger(colorDepth, 4, &device_mode, 104)
EncodeInteger(screenWidth, 4, &device_mode, 108)
EncodeInteger(screenHeight, 4, &device_mode, 112)
EncodeInteger(refreshRate, 4, &device_mode, 120)
DllCall("ChangeDisplaySettings", "uint", &device_mode, "uint",1)
Return
}
DecodeInteger( p_type, p_address, p_offset, p_hex=true )
{
old_FormatInteger := A_FormatInteger
if ( p_hex )
SetFormat, Integer, hex
else
SetFormat, Integer, dec
sign := InStr( p_type, "u", false )^1
StringRight, size, p_type, 1
loop, %size%
value += ( *( ( p_address+p_offset )+( A_Index-1 ) ) << ( 8*( A_Index-1 ) ) )
if ( sign and size <= 4 and *( p_address+p_offset+( size-1 ) ) & 0x80 )
value := -( ( ~value+1 ) & ( ( 2**( 8*size ) )-1 ) )
SetFormat, Integer, %old_FormatInteger%
return, value
}
EncodeInteger( p_value, p_size, p_address, p_offset )
{
loop, %p_size%
DllCall( "RtlFillMemory"
, "uint", p_address+p_offset+A_Index-1
, "uint", 1
, "uchar", ( p_value >> ( 8*( A_Index-1 ) ) ) & 0xFF )
}
_IniRead(Var,Filename,Section,key="")
{
IniRead,_%key%,%Filename%,%Section%,%key%
If (InStr(_%key%,"Error") || _%key%="")
{
IniWrite,%Var%,%Filename%,%Section%,%key%
return Var
}
return _%key%
}
TV_GetSearchStrItemID(Str,TV="")
{
StringReplace,STR,STR,~
If TV
Gui,TreeView,%TV%
Loop
{
ItemID := TV_GetNext(ItemID, "Full") ; 把 "Full" 替换为 "Checked" 来找出所有含复选标记的项目.
if not ItemID ; 没有更多项目了.
break
TV_GetText(ItemText, ItemID)
StringSplit,str,ItemText,=
StringReplace,STR1,STR1,~
If (str1=Str)
Break
}
Return ItemID
}
HKRePlaceStr(HK)
{
StringReplace, str,HK,+,Shift @%A_Space%
StringReplace, str,str,^,Ctrl @%A_Space%
StringReplace, str,str,!,Alt @%A_Space%
StringReplace, str,str,@,+,All
StringReplace, str,str,Numpad,小键盘数字
Return str
}
HKRePlaceNum(HK)
{
StringReplace, str,HK,Esc,|27
If ErrorLevel
StringReplace, str,HK,Space,|32
If ErrorLevel
StringReplace, str,HK,Delete,|46
If ErrorLevel
StringReplace, str,HK,Numpad0,|96
If ErrorLevel
StringReplace, str,HK,Numpad1,|97
If ErrorLevel
StringReplace, str,HK,Numpad2,|98
If ErrorLevel
StringReplace, str,HK,Numpad3,|99
If ErrorLevel
StringReplace, str,HK,Numpad4,|100
If ErrorLevel
StringReplace, str,HK,Numpad5,|101
If ErrorLevel
StringReplace, str,HK,Numpad6,|102
If ErrorLevel
StringReplace, str,HK,Numpad7,|103
If ErrorLevel
StringReplace, str,HK,Numpad8,|104
If ErrorLevel
StringReplace, str,HK,Numpad9,|105
If ErrorLevel
StringReplace, str,HK,F1,|112
If ErrorLevel
StringReplace, str,HK,F2,|113
If ErrorLevel
StringReplace, str,HK,F3,|114
If ErrorLevel
StringReplace, str,HK,F4,|115
If ErrorLevel
StringReplace, str,HK,F5,|116
If ErrorLevel
StringReplace, str,HK,F6,|117
If ErrorLevel
StringReplace, str,HK,F7,|118
If ErrorLevel
StringReplace, str,HK,F8,|119
If ErrorLevel
StringReplace, str,HK,F9,|120
If ErrorLevel
StringReplace, str,HK,F10,|121
If ErrorLevel
StringReplace, str,HK,F11,|122
If ErrorLevel
StringReplace, str,HK,F12,|123
If ErrorLevel
{
StringReplace, s,str,+
StringReplace, s,s,^
StringReplace, s,s,!
If StrLen(s)>1
MsgBox,% s
Else
{
n:=Asc(s)
StringReplace, str,str,%s%,|%n%
}
; MsgBox,%str%=%n%
}
StringReplace, str,str,+,|256
StringReplace, str,str,^,|512
StringReplace, str,str,!,|1024
; MsgBox,%str%
Loop,Parse,str,|
{
Num+=A_LoopField
}
; MsgBox,%str%=%Num%
Return Num
}
Asckey(num)
{
If num>2048
{
If num=2086
Var={Numpad8}
If num=2085
Var={Numpad4}
If num=2088
Var={Numpad2}
If num=2087
Var={Numpad6}
}
Else
{
if num>1024
{
num-=1024
key1=!
}
if num>512
{
num-=512
key2=^
}
if num>256
{
num-=256
key3=+
}
;;数字 0-9
If num=12
key4=Numpad5
If num=27
key4=Esc
If num=32
key4=Space
If num=34
key4=Numpad3
If num=35
key4=Numpad1
If num=46
key4=Delete
If num=96
key4=Numpad0
If num=97
key4=Numpad1
If num=98
key4=Numpad2
If num=99
key4=Numpad3
If num=100
key4=Numpad4
If num=101
key4=Numpad5
If num=102
key4=Numpad6
If num=103
key4=Numpad7
If num=104
key4=Numpad8
If num=105
key4=Numpad9
If num=112
key4=F1
If num=113
key4=F2
If num=114
key4=F3
If num=115
key4=F4
If num=116
key4=F5
If num=117
key4=F6
If num=118
key4=F7
If num=119
key4=F8
If num=120
key4=F9
If num=121
key4=F10
If num=122
key4=F11
If num=123
key4=F12
If num=192
key4=``
If key4=
key4:=Chr(num)
if StrLen(key4)>1
key4={%key4%}
; MsgBox,%key4%`n%num%
StringLower, key4,key4
Var=%key1%%key2%%key3%%key4%
}
; MsgBox,%Var%
return Var
}
;---------------------------建立Tree---------------------------;
AddTreeDefault(Name)
{
global
Loop,Parse,Name,CSV
{
Temp = %A_LoopField%
if (Temp="全局通用热键" || Temp="红色警戒")
_win:=Temp
If %Temp% =
{
If ︰%Temp%
IniWrite,% ︰%Temp%,Settings\%ProjectSelect%.ini,%_win%,%Temp%
}
Else
AddTreeDefault(%Temp%)
}
}
AddTreeCut(Name,PID=0,CutStr="")
{
global
; MsgBox,Name=%Name%=CutStr---%CutStr%
Loop,Parse,Name,CSV
{
Temp = %A_LoopField%
If %Temp% <>
{
; %Temp%TVID:=TV_Add(Temp,PID)
IfInString,%Temp%,%CutStr%
{
StringReplace,%Temp%,%Temp%,%CutStr%`,
If ErrorLevel
StringReplace,%Temp%,%Temp%,`,%CutStr%
If ErrorLevel
StringReplace,%Temp%,%Temp%,%CutStr%
Return ErrorLevel
; MsgBox,% %Temp% . "=" . CutStr
} ; . "=" . CutStr
AddTreeCut(%Temp%,PID2,CutStr)
}
}
}
;---------------------------取得红警目录ra2及Keyboard信息---------------------------;
Ra2iniAssignment(Ra2Dir)
{
global
Ra2Dir:=Ra2Dir
IniWrite,%Ra2Dir%,Settings\%ProjectSelect%.ini,Default,设为主要红警
}
;---------------------------取得图标number---------------------------;
GetIcon_From_FileName(FileName)
{
global
str:=FileName
VarSetCapacity(Filename, 260)
sfi_size = 352
VarSetCapacity(sfi, sfi_size)
FileName:=str
hIcon := DllCall("Shell32\ExtractAssociatedIcon", UInt, 0, Str, FileName, UShortP, 0) ;获得一个关联此文件的高质量的小图标:
If Not hIcon ;如果没有获取到图标,则设置一个空白图标
{
IconNumber = 9999999 ; 设置一个超出界限的值来显示一个空白图标。
}
Else ;否则有图标的话,将图标设置到imagelist里面去
{
IconNumber := DllCall("ImageList_ReplaceIcon", "uint", ImageListID1, "int", -1, "uint", hIcon) + 1
DllCall("ImageList_ReplaceIcon", UInt, ImageListID2, Int, -1, UInt, hIcon)
DllCall("DestroyIcon", Uint, hIcon)
IconArray%ExtID% := IconNumber
}
}
SplitFileNameIcon(FileName)
{
global
str:=FileName
StringRight, LastChar, FileName, 1
if LastChar = \
StringTrimRight, FileName, FileName, 1
VarSetCapacity(Filename, 260)
sfi_size = 352
VarSetCapacity(sfi, sfi_size)
FileName:=str
SplitPath, FileName,,, FileExt
If FileExt=lnk
{
FileGetShortcut, %FileName%, FileName
SplitPath, FileName,,, FileExt
}
if FileExt in EXE,ICO,ANI,CUR
{
ExtID := FileExt ; 特殊 ID 作为占位符.
IconNumber = 0 ; 进行标记这样每种类型就含有唯一的图标.
}
else ; 其他的扩展名/文件类型, 计算它们的唯一 ID.
{
ExtID = 0 ; 进行初始化来处理比其他更短的扩展名.
Loop 7 ; 限制扩展名为 7 个字符, 这样之后计算的结果才能存放到 64 位值.
{
StringMid, ExtChar, FileExt, A_Index, 1
if not ExtChar ; 没有更多字符了.
break
; 把每个字符与不同的位位置进行运算来得到唯一 ID:
ExtID := ExtID | (Asc(ExtChar) << (8 * (A_Index - 1)))
}
; 检查此文件扩展名的图标是否已经在图像列表中. 如果是,
; 可以避免多次调用并极大提高性能,
; 尤其对于包含数以百计文件的文件夹而言:
IconNumber := IconArray%ExtID%
}
if not IconNumber ; 此扩展名还没有相应的图标, 所以进行加载.
{
; 获取与此文件扩展名关联的高质量小图标:
if not DllCall("Shell32\SHGetFileInfo" . (A_IsUnicode ? "W":"A"), "str", FileName, "uint", 0, "ptr", &sfi, "uint", sfi_size, "uint", 0x101) ; 0x101 为 SHGFI_ICON+SHGFI_SMALLICON
IconNumber = 9999999 ; 把它设置到范围外来显示空图标.
else ; 成功加载图标.
{
; 从结构中提取 hIcon 成员:
hIcon := NumGet(sfi, 0)
; 直接添加 HICON 到小图标和大图标列表.
; 下面加上 1 来把返回的索引从基于零转换到基于一:
IconNumber := DllCall("ImageList_ReplaceIcon", "ptr", ImageListID1, "int", -1, "ptr", hIcon) + 1
DllCall("ImageList_ReplaceIcon", "ptr", ImageListID2, "int", -1, "ptr", hIcon)
; 现在已经把它复制到图像列表, 所以应销毁原来的:
DllCall("DestroyIcon", "ptr", hIcon)
; 缓存图标来节省内存并提升加载性能:
IconArray%ExtID% := IconNumber
}
}
}
;---------------------------Keyboard Layouts---------------------------;
;---------------------------iniread---------------------------;
_StrinReplace(HK)
{
StringReplace,HK,HK,%A_Space%,_0,All
StringReplace,HK,HK,~,_1
StringReplace,HK,HK,^,_2
StringReplace,HK,HK,!,_3
StringReplace,HK,HK,+,_4
StringReplace,HK,HK,&,_5
StringReplace,HK,HK,``,_6
Return HK
}
HKText(ItemID,ByRef HKText,HK)
{
StringLen,X,HKText
StringLen,Y,HK
Z:=1
While TV_GetParent(ItemID)
{
ItemID:=TV_GetParent(ItemID)
Z++
}
m=-----
HKText .=m . "> " . HK
}
_GuicontrolResolution(string)
{
StringGetPos, pos, string,*
StringLeft,RedScreenX,string,%pos%
StringLen,OutputVar,string
pos:=OutputVar-pos-1
StringRight,RedScreenY,string,%pos%
GuiControl,,RedScreenX,%RedScreenX%
GuiControl,,RedScreenY,%RedScreenY%
}
;================================================================;子程序================================================================;
ChangeDisplaySettings( cD, sW, sH, rR ) { ;------------bit, w, h ,hz
VarSetCapacity(dM,156,0), NumPut(156,dM,36, "UInt")
DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40, "UInt")
NumPut(cD,dM,104, "UInt"), NumPut(sW,dM,108, "UInt"), NumPut(sH,dM,112, "UInt"), NumPut(rR,dM,120, "UInt")
Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
;~ Return DllCall( "ChangeDisplaySettingsA", UIntP,&dM, UInt,0 )
}
EnumDisplaySettingsA() {
global
VarSetCapacity(DM,156,0), NumPut(156,&DM,36, "UShort")
;~ MsgBox,%CS%
While DllCall( "EnumDisplaySettingsA", UInt,0, UInt,A_Index-1, UInt,&DM ) ;----取得所有分辨率
{
WH:=NumGet(DM,108, "UInt") "x" NumGet(DM,112, "UInt")
Bit:=NumGet(DM,104, "UInt") "位"
Hz:=NumGet(DM,120, "UInt") "Hz"
IfNotInString,%WH%Hz,%Hz%
%WH%Hz.=Hz "|"
IfNotInString,%WH%bit,%bit%
%WH%bit.=bit "|"
IfNotInString,%Bit%WH,%WH%
%Bit%WH.=WH "|"
IfNotInString,%Bit%Hz,%Hz%
%Bit%Hz.=Hz "|"
IfNotInString,%Hz%WH,%WH%
%Hz%WH.=WH "|"
IfNotInString,%Hz%bit,%Bit%
%Hz%Bit.=Bit "|"
IfNotInString,Display_WH,%WH%
Display_WH.=WH "|"
Bit:=NumGet(DM,104, "UInt") "位"
IfNotInString,Display_Bit,%Bit%
Display_Bit.=Bit "|"
Hz:=NumGet(DM,120, "UInt") "Hz"
IfNotInString,Display_Hz,%Hz%
Display_Hz.=Hz "|"
/*
if (NumGet(DM,108, "UInt")>1000 && NumGet(DM,104,"UInt")>=16 && NumGet(DM,120, "UInt")>=60) ;----wight>100 bit>=16 Hz>=60 108=wight 112=height 120=Hz 104=bit
{
Display_HzALL.=NumGet(DM,108, "UInt") "x" NumGet(DM,112, "UInt") "/" NumGet(DM,104,"UInt") "位|"
Display_bitALL.=NumGet(DM,108, "UInt") "x" NumGet(DM,112, "UInt") "/" NumGet(DM,120, "UInt") "Hz|"
Display_strALL.=NumGet(DM,108, "UInt") "x" NumGet(DM,112, "UInt") "/" NumGet(DM,104,"UInt") "位/" NumGet(DM,120, "UInt") "Hz|"
;~ EDS:=NumGet(DM,108, "UInt") "x" NumGet(DM,112, "UInt") " / " NumGet(DM,104,"UInt") "bit / " NumGet(DM,120, "UInt") "Hz"
;~ DS.=(!InStr(DS,EDS) ? "|" EDS : "")
}
*/
}
;~ MsgBox,% %Hz%Bit
;~ MsgBox,%Display_Bit%
DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&DM ) ;;----取得当前分辨率
WH:=NumGet(DM,108, "UInt") "x" NumGet(DM,112, "UInt")
Bit:=NumGet(DM,104, "UInt") "位"
Hz:=NumGet(DM,120, "UInt") "Hz"
If (Ra2Width<>"Error" && Ra2Width<>"Error")
StringReplace, Display_Ra2, Display_WH, %Ra2Width%x%Ra2Height%|, %Ra2Width%x%Ra2Height%||, All
StringReplace, Display_WH, Display_WH, %WH%|, %WH%||, All
StringReplace, Display_Bit, Display_Bit, %Bit%|, %Bit%||, All
StringReplace, Display_Hz, Display_Hz, %Hz%|, %Hz%||, All
;~ StringReplace, DS, DS, %CS%|, %CS%||, All
;~ Return SubStr(DS,2)
}
GuiControlDisplay(ControlName)
{
GuiControlGet,%ControlName%
str=Display_WH|Display_bit|Display_Hz|
StringReplace,str,str,%ControlName%|
StringTrimRight,str,str,1
Loop parse,str,|
{
StringSplit,str,A_LoopField,_
GuiControlGet,%A_LoopField%
display:=%ControlName% . str2
Name:=% %A_LoopField%
IfInString,%display%,%Name%
StringReplace, str, %display%, %Name%|, %Name%||, All
else
{
m:=0
loop parse,%display%,|
{
n:=RegExReplace( A_LoopField, "[^0-9]" )
if (n>m)
{
m:=n
str:=A_LoopField
}
}
StringReplace, str, %display%, %str%|, %str%||, All
}
GuiControl,,%A_LoopField%,|%str%
;~ MsgBox,%str%
}
}
Control_GetClassNN(hWndWindow,hWndControl){
DetectHiddenWindows, On
WinGet, ClassNNList, ControlList, ahk_id %hWndWindow%
Loop, PARSE, ClassNNList, `n
{
ControlGet, hwnd, hwnd,,%A_LoopField%,ahk_id %hWndWindow%
if (hWnd = hWndControl)
return A_LoopField
}
}
/*
EnumDisplaySettingsA() {
VarSetCapacity(DM,156,0), NumPut(156,&DM,36, "UShort")
,DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&DM )
,CS:=NumGet(DM,108, "UInt") "x" NumGet(DM,112, "UInt") " / " NumGet(DM,104,"UInt") "bit / " NumGet(DM,120, "UInt") "Hz"
;~ MsgBox,%CS%
While DllCall( "EnumDisplaySettingsA", UInt,0, UInt,A_Index-1, UInt,&DM )
{
EDS:=NumGet(DM,108, "UInt") "x" NumGet(DM,112, "UInt") " / " NumGet(DM,104,"UInt") "bit / " NumGet(DM,120, "UInt") "Hz"
,DS.=(!InStr(DS,EDS) ? "|" EDS : "")
;~ MsgBox, %EDS%`n%DS%
}
StringReplace, DS, DS, %CS%|, %CS%||, All
;~ MsgBox,%DS%
Return SubStr(DS,2)
}
*/
;=====VA_函数========================================================================数据 ================================================================
HKChangeCN(HK)
{
StringReplace,HK, HK,CapsLock,大写键
StringReplace,HK, HK,WheelUp,滚轮上
StringReplace,HK, HK,WheelDown,滚轮下
StringReplace,HK, HK,LButton,鼠标左键
StringReplace,HK, HK,MButton,鼠标中键
StringReplace,HK, HK,RButton,鼠标右键
StringReplace,HK, HK,Space,空格键
StringReplace,HK, HK,~,~
StringReplace,HK, HK,^,Ctrl+
StringReplace,HK, HK,+,Shift+
StringReplace,HK, HK,!,Alt+
StringReplace,HK, HK,#,Win+
StringReplace,HK, HK,%A_Space%&%A_Space%,+
StringUpper, HK, HK ,T
Return HK
}
HKChangeEN(HK)
{
StringReplace,HK, HK,映射
StringReplace,HK, HK,大写键,CapsLock
StringReplace,HK, HK,滚轮上,WheelUp
StringReplace,HK, HK,滚轮下,WheelDown
StringReplace,HK, HK,鼠标左键,LButton
StringReplace,HK, HK,鼠标中键,MButton
StringReplace,HK, HK,鼠标右键,RButton
StringReplace,HK, HK,空格键,Space
StringReplace,HK, HK,~,~
StringReplace,HK, HK,Ctrl+,^
StringReplace,HK, HK,Shift+,+
StringReplace,HK, HK,Alt+,!
StringReplace,HK, HK,Win+,#
StringReplace,HK, HK,+,%A_Space%&%A_Space%
StringLower, HK, HK
Return HK
}
音量(V)
{
If A_OSVersion in WIN_XP,WIN_2003
SoundGet, G, Master
Else
G:=VA_GetMasterVolume()
n := Round(Sqrt(G)*10)
If V=*
{
Send, {Volume_Mute}
Progress, 1:Off
}
Else If V=+
n += n=100 ? 0 : 1
Else If V=-
n += n ? -1 : 0
Else If V is number
n := V
n:=% n*n/100
If A_OSVersion in WIN_XP,WIN_2003
SoundSet, %n%
Else
VA_SetMasterVolume(n)
音量条(n)
IfEqual, V, *, Sleep, 500
}
音量条(n)
{
SoundGet, 静音, Master, Mute
颜色 := 静音="On" ? "000000" : "FF8000"
宽度 := A_ScreenWidth/2
高度 := A_ScreenHeight*3/4
IfWinNotExist, 音量条
Progress, 1:B W%宽度% ZH20 Y%高度% ZX-1 ZY-1 CB%颜色% CW333333, , , 音量条
Progress, 1:%n%
SetTimer, Timer_音量条, 1000
Return
Timer_音量条:
SetTimer, Timer_音量条, Off
Progress, 1:Off
Return
}
IsChatting()
{
Process, Exist
h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", ErrorLevel)
DllCall("Advapi32.dll\OpenProcessToken", "UInt", h, "UInt", 32, "UIntP", t)
VarSetCapacity(ti, 16, 0)
NumPut(1, ti, 0)
DllCall("Advapi32.dll\LookupPrivilegeValueA", "UInt", 0, "Str", "SeDebugPrivilege", "Int64P", luid)
NumPut(luid, ti, 4, "int64")
NumPut(2, ti, 12)
DllCall("Advapi32.dll\AdjustTokenPrivileges", "UInt", t, "Int", false, "UInt", &ti, "UInt", 0, "UInt", 0, "UInt", 0)
DllCall("CloseHandle", "UInt", h)
WinGet,pid,PID,A
h := DllCall("OpenProcess", "UInt", 24, "Int", false, "UInt", pid)
VarSetCapacity(value,4,0)
DllCall("ReadProcessMemory","UInt",h,"UInt",0x00865FF8,"Str",value,"UInt",4,"UIntP",0)
DllCall("CloseHandle", "int", h)
Return,value
}
;=====VA_函数=====
VA_GetMasterVolume(channel="", device_desc="playback")
{
aev := VA_GetAudioEndpointVolume(device_desc)
if channel =
VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(aev, vol)
else
VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(aev, channel-1, vol)
ObjRelease(aev)
return Round(vol*100,3)
}
VA_SetMasterVolume(vol, channel="", device_desc="playback")
{
vol := vol>100 ? 100 : vol<0 ? 0 : vol
aev := VA_GetAudioEndpointVolume(device_desc)
if channel =
VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(aev, vol/100)
else
VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(aev, channel-1, vol/100)
ObjRelease(aev)
}
VA_GetMasterChannelCount(device_desc="playback")
{
aev := VA_GetAudioEndpointVolume(device_desc)
VA_IAudioEndpointVolume_GetChannelCount(aev, count)
ObjRelease(aev)
return count
}
VA_SetMasterMute(mute, device_desc="playback")
{
aev := VA_GetAudioEndpointVolume(device_desc)
VA_IAudioEndpointVolume_SetMute(aev, mute)
ObjRelease(aev)
}
VA_GetMasterMute(device_desc="playback")
{
aev := VA_GetAudioEndpointVolume(device_desc)
VA_IAudioEndpointVolume_GetMute(aev, mute)
ObjRelease(aev)
return mute
}
VA_GetVolume(subunit_desc="1", channel="", device_desc="playback")
{
avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
if !avl
return
VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
if channel =
{
vol = 0
Loop, %channel_count%
{
VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
if (this_vol > vol)
vol := this_vol
}
}
else if channel between 1 and channel_count
{
channel -= 1
VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
VA_IPerChannelDbLevel_GetLevel(avl, channel, vol)
vol := VA_dB2Scalar(vol, min_dB, max_dB)
}
ObjRelease(avl)
return vol
}
VA_SetVolume(vol, subunit_desc="1", channel="", device_desc="playback")
{
avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
if !avl
return
vol := vol<0 ? 0 : vol>100 ? 100 : vol
VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
if channel =
{
vol_max = 0
Loop, %channel_count%
{
VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
channel%A_Index%vol := this_vol
channel%A_Index%min := min_dB
channel%A_Index%max := max_dB
if (this_vol > vol_max)
vol_max := this_vol
}
Loop, %channel_count%
{
this_vol := vol_max ? channel%A_Index%vol / vol_max * vol : vol
this_vol := VA_Scalar2dB(this_vol/100, channel%A_Index%min, channel%A_Index%max)
VA_IPerChannelDbLevel_SetLevel(avl, A_Index-1, this_vol)
}
}
else if channel between 1 and %channel_count%
{
channel -= 1
VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
VA_IPerChannelDbLevel_SetLevel(avl, channel, VA_Scalar2dB(vol/100, min_dB, max_dB))
}
ObjRelease(avl)
}
VA_GetChannelCount(subunit_desc="1", device_desc="playback")
{
avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
if !avl
return
VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
ObjRelease(avl)
return channel_count
}
VA_SetMute(mute, subunit_desc="1", device_desc="playback")
{
amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
if !amute
return
VA_IAudioMute_SetMute(amute, mute)
ObjRelease(amute)
}
VA_GetMute(subunit_desc="1", device_desc="playback")
{
amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
if !amute
return
VA_IAudioMute_GetMute(amute, muted)
ObjRelease(amute)
return muted
}
VA_GetAudioMeter(device_desc="playback")
{
if ! device := VA_GetDevice(device_desc)
return 0
VA_IMMDevice_Activate(device, "{C02216F6-8C67-4B5B-9D00-D008E73E0064}", 7, 0, audioMeter)
ObjRelease(device)
return audioMeter
}
VA_GetDevicePeriod(device_desc, ByRef default_period, ByRef minimum_period="")
{
defaultPeriod := minimumPeriod := 0
if ! device := VA_GetDevice(device_desc)
return false
VA_IMMDevice_Activate(device, "{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}", 7, 0, audioClient)
ObjRelease(device)
DllCall(NumGet(NumGet(audioClient+0)+9*A_PtrSize), "ptr",audioClient, "int64*",default_period, "int64*",minimum_period)
default_period /= 10000
minimum_period /= 10000
ObjRelease(audioClient)
return true
}
VA_GetAudioEndpointVolume(device_desc="playback")
{
if ! device := VA_GetDevice(device_desc)
return 0
VA_IMMDevice_Activate(device, "{5CDF2C82-841E-4546-9722-0CF74078229A}", 7, 0, endpointVolume)
ObjRelease(device)
return endpointVolume
}
VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid)
{
device := VA_GetDevice(device_desc)
if !device
return 0
subunit := VA_FindSubunit(device, subunit_desc, subunit_iid)
ObjRelease(device)
return subunit
}
VA_FindSubunit(device, target_desc, target_iid)
{
if target_desc is integer
target_index := target_desc
else
RegExMatch(target_desc, "(?<_name>.*?)(?::(?<_index>\d+))?$", target)
if !RegExMatch(target_name,"^[^\(]+\)")
target_name := "i)" target_name
r := VA_EnumSubunits(device, "VA_FindSubunitCallback", target_name, target_iid
, Object(0, target_index ? target_index : 1, 1, 0))
DllCall("GlobalFree", "uint", callback)
return r
}
VA_FindSubunitCallback(part, interface, index)
{
index[1] := index[1] + 1
if (index[0] == index[1])
{
ObjAddRef(interface)
return interface
}
}
VA_EnumSubunits(device, callback, target_name="", target_iid="", callback_param="")
{
VA_IMMDevice_Activate(device, "{2A07407E-6497-4A18-9787-32F79BD0D98F}", 7, 0, deviceTopology)
VA_IDeviceTopology_GetConnector(deviceTopology, 0, conn)
ObjRelease(deviceTopology)
VA_IConnector_GetConnectedTo(conn, conn_to)
VA_IConnector_GetDataFlow(conn, data_flow)
ObjRelease(conn)
if !conn_to
return
DllCall(NumGet(NumGet(conn_to+0)), "ptr", conn_to, "ptr", VA_GUID(IID_IPart,"{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}"), "ptr*", part) != 0 ? part:=0 : ""
ObjRelease(conn_to)
if !part
return
r := VA_EnumSubunitsEx(part, data_flow, callback, target_name, target_iid, callback_param)
ObjRelease(part)
return r
}
VA_EnumSubunitsEx(part, data_flow, callback, target_name="", target_iid="", callback_param="")
{
r := 0
VA_IPart_GetPartType(part, type)
if type = 1
{
VA_IPart_GetName(part, name)
if RegExMatch(name, target_name)
{
if target_iid =
r := %callback%(part, 0, callback_param)
else
if VA_IPart_Activate(part, 7, target_iid, interface) = 0
{
r := %callback%(part, interface, callback_param)
ObjRelease(interface)
}
if r
return r
}
}
if data_flow = 0
VA_IPart_EnumPartsIncoming(part, parts)
else
VA_IPart_EnumPartsOutgoing(part, parts)
VA_IPartsList_GetCount(parts, count)
Loop %count%
{
VA_IPartsList_GetPart(parts, A_Index-1, subpart)
r := VA_EnumSubunitsEx(subpart, data_flow, callback, target_name, target_iid, callback_param)
ObjRelease(subpart)
if r
break
}
ObjRelease(parts)
return r
}
VA_GetDevice(device_desc="playback")
{
static CLSID_MMDeviceEnumerator := "{BCDE0395-E52F-467C-8E3D-C4579291692E}"
, IID_IMMDeviceEnumerator := "{A95664D2-9614-4F35-A746-DE8DB63617E6}"
if !(deviceEnumerator := ComObjCreate(CLSID_MMDeviceEnumerator, IID_IMMDeviceEnumerator))
return 0
device := 0
if DllCall(NumGet(NumGet(deviceEnumerator+0)+5*A_PtrSize), "ptr", deviceEnumerator, "wstr", device_desc, "ptr*", device) = 0
goto VA_GetDevice_Return
if device_desc is integer
{
m2 := device_desc
if m2 >= 4096
return m2, ObjAddRef(m2)
}
else
RegExMatch(device_desc, "(.*?)\s*(?::(\d+))?$", m)
if m1 in playback,p
m1 := "", flow := 0
else if m1 in capture,c
m1 := "", flow := 1
else if (m1 . m2) = ""
m1 := "", flow := 0
else
flow := 2
if (m1 . m2) = ""
{
DllCall(NumGet(NumGet(deviceEnumerator+0)+4*A_PtrSize), "ptr",deviceEnumerator, "uint",flow, "uint",0, "ptr*",device)
goto VA_GetDevice_Return
}
DllCall(NumGet(NumGet(deviceEnumerator+0)+3*A_PtrSize), "ptr",deviceEnumerator, "uint",flow, "uint",1, "ptr*",devices)
DllCall(NumGet(NumGet(devices+0)+3*A_PtrSize), "ptr",devices, "uint*",count)
if m1 =
{
DllCall(NumGet(NumGet(devices+0)+4*A_PtrSize), "ptr",devices, "uint",m2-1, "ptr*",device)
goto VA_GetDevice_Return
}
index := 0
Loop % count
if DllCall(NumGet(NumGet(devices+0)+4*A_PtrSize), "ptr",devices, "uint",A_Index-1, "ptr*",device) = 0
if InStr(VA_GetDeviceName(device), m1) && (m2 = "" || ++index = m2)
goto VA_GetDevice_Return
else
ObjRelease(device), device:=0
VA_GetDevice_Return:
ObjRelease(deviceEnumerator)
if devices
ObjRelease(devices)
return device
}
VA_GetDeviceName(device)
{
static PKEY_Device_FriendlyName
if !VarSetCapacity(PKEY_Device_FriendlyName)
VarSetCapacity(PKEY_Device_FriendlyName, 20)
,VA_GUID(PKEY_Device_FriendlyName :="{A45C254E-DF1C-4EFD-8020-67D146A850E0}")
,NumPut(14, PKEY_Device_FriendlyName, 16)
VarSetCapacity(prop, 16)
VA_IMMDevice_OpenPropertyStore(device, 0, store)
DllCall(NumGet(NumGet(store+0)+5*A_PtrSize), "ptr", store, "ptr", &PKEY_Device_FriendlyName, "ptr", &prop)
ObjRelease(store)
VA_WStrOut(deviceName := NumGet(prop,8))
return deviceName
}
VA_GUID(ByRef guid_out, guid_in="%guid_out%") {
if (guid_in == "%guid_out%")
guid_in := guid_out
if guid_in is integer
return guid_in
VarSetCapacity(guid_out, 16, 0)
DllCall("ole32\CLSIDFromString", "ptr", &guid_in, "ptr", &guid_out)
return &guid_out
}
VA_GUIDOut(ByRef guid) {
VarSetCapacity(buf, 78)
DllCall("ole32\StringFromGUID2", "ptr", &guid, "ptr", &buf, "int", 39)
guid := StrGet(&buf, "UTF-16")
}
VA_WStrOut(ByRef str) {
str := StrGet(ptr := str, "UTF-16")
DllCall("ole32\CoTaskMemFree", "ptr", ptr)
}
VA_dB2Scalar(dB, min_dB, max_dB) {
min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
return ((10**(dB/20))-min_s)/(max_s-min_s)*100
}
VA_Scalar2dB(s, min_dB, max_dB) {
min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
return log((max_s-min_s)*s+min_s)*20
}
VA_IMMDevice_Activate(this, iid, ClsCtx, ActivationParams, ByRef Interface) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "uint", ClsCtx, "uint", ActivationParams, "ptr*", Interface)
}
VA_IMMDevice_OpenPropertyStore(this, Access, ByRef Properties) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Access, "ptr*", Properties)
}
VA_IMMDevice_GetId(this, ByRef Id) {
hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", Id)
VA_WStrOut(Id)
return hr
}
VA_IMMDevice_GetState(this, ByRef State) {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", State)
}
VA_IDeviceTopology_GetConnectorCount(this, ByRef Count) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
}
VA_IDeviceTopology_GetConnector(this, Index, ByRef Connector) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Connector)
}
VA_IDeviceTopology_GetSubunitCount(this, ByRef Count) {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", Count)
}
VA_IDeviceTopology_GetSubunit(this, Index, ByRef Subunit) {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Subunit)
}
VA_IDeviceTopology_GetPartById(this, Id, ByRef Part) {
return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "uint", Id, "ptr*", Part)
}
VA_IDeviceTopology_GetDeviceId(this, ByRef DeviceId) {
hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", DeviceId)
VA_WStrOut(DeviceId)
return hr
}
VA_IDeviceTopology_GetSignalPath(this, PartFrom, PartTo, RejectMixedPaths, ByRef Parts) {
return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", PartFrom, "ptr", PartTo, "int", RejectMixedPaths, "ptr*", Parts)
}
VA_IConnector_GetType(this, ByRef Type) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", Type)
}
VA_IConnector_GetDataFlow(this, ByRef Flow) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int*", Flow)
}
VA_IConnector_ConnectTo(this, ConnectTo) {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr", ConnectTo)
}
VA_IConnector_Disconnect(this) {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this)
}
VA_IConnector_IsConnected(this, ByRef Connected) {
return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "int*", Connected)
}
VA_IConnector_GetConnectedTo(this, ByRef ConTo) {
return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr*", ConTo)
}
VA_IConnector_GetConnectorIdConnectedTo(this, ByRef ConnectorId) {
hr := DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr*", ConnectorId)
VA_WStrOut(ConnectorId)
return hr
}
VA_IConnector_GetDeviceIdConnectedTo(this, ByRef DeviceId) {
hr := DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr*", DeviceId)
VA_WStrOut(DeviceId)
return hr
}
VA_IPart_GetName(this, ByRef Name) {
hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr*", Name)
VA_WStrOut(Name)
return hr
}
VA_IPart_GetLocalId(this, ByRef Id) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", Id)
}
VA_IPart_GetGlobalId(this, ByRef GlobalId) {
hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr*", GlobalId)
VA_WStrOut(GlobalId)
return hr
}
VA_IPart_GetPartType(this, ByRef PartType) {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "int*", PartType)
}
VA_IPart_GetSubType(this, ByRef SubType) {
VarSetCapacity(SubType,16,0)
hr := DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", &SubType)
VA_GUIDOut(SubType)
return hr
}
VA_IPart_GetControlInterfaceCount(this, ByRef Count) {
return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", Count)
}
VA_IPart_GetControlInterface(this, Index, ByRef InterfaceDesc) {
return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "uint", Index, "ptr*", InterfaceDesc)
}
VA_IPart_EnumPartsIncoming(this, ByRef Parts) {
return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr*", Parts)
}
VA_IPart_EnumPartsOutgoing(this, ByRef Parts) {
return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "ptr*", Parts)
}
VA_IPart_GetTopologyObject(this, ByRef Topology) {
return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "ptr*", Topology)
}
VA_IPart_Activate(this, ClsContext, iid, ByRef Object) {
return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "uint", ClsContext, "ptr", VA_GUID(iid), "ptr*", Object)
}
VA_IPart_RegisterControlChangeCallback(this, iid, Notify) {
return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "ptr", Notify)
}
VA_IPart_UnregisterControlChangeCallback(this, Notify) {
return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this, "ptr", Notify)
}
VA_IPartsList_GetCount(this, ByRef Count) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
}
VA_IPartsList_GetPart(this, INdex, ByRef Part) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Part)
}
VA_IAudioEndpointVolume_RegisterControlChangeNotify(this, Notify) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", Notify)
}
VA_IAudioEndpointVolume_UnregisterControlChangeNotify(this, Notify) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", Notify)
}
VA_IAudioEndpointVolume_GetChannelCount(this, ByRef ChannelCount) {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", ChannelCount)
}
VA_IAudioEndpointVolume_SetMasterVolumeLevel(this, LevelDB, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(this, Level, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "float", Level, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_GetMasterVolumeLevel(this, ByRef LevelDB) {
return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "float*", LevelDB)
}
VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(this, ByRef Level) {
return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "float*", Level)
}
VA_IAudioEndpointVolume_SetChannelVolumeLevel(this, Channel, LevelDB, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "uint", Channel, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(this, Channel, Level, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "uint", Channel, "float", Level, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_GetChannelVolumeLevel(this, Channel, ByRef LevelDB) {
return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "uint", Channel, "float*", LevelDB)
}
VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(this, Channel, ByRef Level) {
return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "uint", Channel, "float*", Level)
}
VA_IAudioEndpointVolume_SetMute(this, Mute, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "int", Mute, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_GetMute(this, ByRef Mute) {
return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this, "int*", Mute)
}
VA_IAudioEndpointVolume_GetVolumeStepInfo(this, ByRef Step, ByRef StepCount) {
return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), "ptr", this, "uint*", Step, "uint*", StepCount)
}
VA_IAudioEndpointVolume_VolumeStepUp(this, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+17*A_PtrSize), "ptr", this, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_VolumeStepDown(this, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+18*A_PtrSize), "ptr", this, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioEndpointVolume_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
return DllCall(NumGet(NumGet(this+0)+19*A_PtrSize), "ptr", this, "uint*", HardwareSupportMask)
}
VA_IAudioEndpointVolume_GetVolumeRange(this, ByRef MinDB, ByRef MaxDB, ByRef IncrementDB) {
return DllCall(NumGet(NumGet(this+0)+20*A_PtrSize), "ptr", this, "float*", MinDB, "float*", MaxDB, "float*", IncrementDB)
}
VA_IPerChannelDbLevel_GetChannelCount(this, ByRef Channels) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Channels)
}
VA_IPerChannelDbLevel_GetLevelRange(this, Channel, ByRef MinLevelDB, ByRef MaxLevelDB, ByRef Stepping) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Channel, "float*", MinLevelDB, "float*", MaxLevelDB, "float*", Stepping)
}
VA_IPerChannelDbLevel_GetLevel(this, Channel, ByRef LevelDB) {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint", Channel, "float*", LevelDB)
}
VA_IPerChannelDbLevel_SetLevel(this, Channel, LevelDB, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint", Channel, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
}
VA_IPerChannelDbLevel_SetLevelUniform(this, LevelDB, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
}
VA_IPerChannelDbLevel_SetLevelAllChannels(this, LevelsDB, ChannelCount, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint", LevelsDB, "uint", ChannelCount, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioMute_SetMute(this, Muted, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", Muted, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioMute_GetMute(this, ByRef Muted) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int*", Muted)
}
VA_IAudioAutoGainControl_GetEnabled(this, ByRef Enabled) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", Enabled)
}
VA_IAudioAutoGainControl_SetEnabled(this, Enable, GuidEventContext="") {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", Enable, "ptr", VA_GUID(GuidEventContext))
}
VA_IAudioMeterInformation_GetPeakValue(this, ByRef Peak) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "float*", Peak)
}
VA_IAudioMeterInformation_GetMeteringChannelCount(this, ByRef ChannelCount) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", ChannelCount)
}
VA_IAudioMeterInformation_GetChannelsPeakValues(this, ChannelCount, PeakValues) {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint", ChannelCount, "ptr", PeakValues)
}
VA_IAudioMeterInformation_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", HardwareSupportMask)
}
VA_IAudioClient_Initialize(this, ShareMode, StreamFlags, BufferDuration, Periodicity, Format, AudioSessionGuid) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", ShareMode, "uint", StreamFlags, "int64", BufferDuration, "int64", Periodicity, "ptr", Format, "ptr", VA_GUID(AudioSessionGuid))
}
VA_IAudioClient_GetBufferSize(this, ByRef NumBufferFrames) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", NumBufferFrames)
}
VA_IAudioClient_GetStreamLatency(this, ByRef Latency) {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "int64*", Latency)
}
VA_IAudioClient_GetCurrentPadding(this, ByRef NumPaddingFrames) {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", NumPaddingFrames)
}
VA_IAudioClient_IsFormatSupported(this, ShareMode, Format, ByRef ClosestMatch) {
return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "int", ShareMode, "ptr", Format, "ptr*", ClosestMatch)
}
VA_IAudioClient_GetMixFormat(this, ByRef Format) {
return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", Format)
}
VA_IAudioClient_GetDevicePeriod(this, ByRef DefaultDevicePeriod, ByRef MinimumDevicePeriod) {
return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "int64*", DefaultDevicePeriod, "int64*", MinimumDevicePeriod)
}
VA_IAudioClient_Start(this) {
return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this)
}
VA_IAudioClient_Stop(this) {
return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this)
}
VA_IAudioClient_Reset(this) {
return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this)
}
VA_IAudioClient_SetEventHandle(this, eventHandle) {
return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "ptr", eventHandle)
}
VA_IAudioClient_GetService(this, iid, ByRef Service) {
return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "ptr*", Service)
}
VA_IAudioSessionControl_GetState(this, ByRef State) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", State)
}
VA_IAudioSessionControl_GetDisplayName(this, ByRef DisplayName) {
hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr*", DisplayName)
VA_WStrOut(DisplayName)
return hr
}
VA_IAudioSessionControl_SetDisplayName(this, DisplayName, EventContext) {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "wstr", DisplayName, "ptr", VA_GUID(EventContext))
}
VA_IAudioSessionControl_GetIconPath(this, ByRef IconPath) {
hr := DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr*", IconPath)
VA_WStrOut(IconPath)
return hr
}
VA_IAudioSessionControl_SetIconPath(this, IconPath) {
return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "wstr", IconPath)
}
VA_IAudioSessionControl_GetGroupingParam(this, ByRef Param) {
VarSetCapacity(Param,16,0)
hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr", &Param)
VA_GUIDOut(Param)
return hr
}
VA_IAudioSessionControl_SetGroupingParam(this, Param, EventContext) {
return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", VA_GUID(Param), "ptr", VA_GUID(EventContext))
}
VA_IAudioSessionControl_RegisterAudioSessionNotification(this, NewNotifications) {
return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr", NewNotifications)
}
VA_IAudioSessionControl_UnregisterAudioSessionNotification(this, NewNotifications) {
return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "ptr", NewNotifications)
}
VA_IAudioSessionManager_GetAudioSessionControl(this, AudioSessionGuid) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", VA_GUID(AudioSessionGuid))
}
VA_IAudioSessionManager_GetSimpleAudioVolume(this, AudioSessionGuid, StreamFlags, ByRef AudioVolume) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", VA_GUID(AudioSessionGuid), "uint", StreamFlags, "uint*", AudioVolume)
}
VA_IAudioSessionControl2_GetSessionIdentifier(this, ByRef id) {
hr := DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "ptr*", id)
VA_WStrOut(id)
return hr
}
VA_IAudioSessionControl2_GetSessionInstanceIdentifier(this, ByRef id) {
hr := DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "ptr*", id)
VA_WStrOut(id)
return hr
}
VA_IAudioSessionControl2_GetProcessId(this, ByRef pid) {
return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "uint*", pid)
}
VA_IAudioSessionControl2_IsSystemSoundsSession(this) {
return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this)
}
VA_IAudioSessionControl2_SetDuckingPreference(this, OptOut) {
return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), "ptr", this, "int", OptOut)
}
VA_IAudioSessionManager2_GetSessionEnumerator(this, ByRef SessionEnum) {
return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr*", SessionEnum)
}
VA_IAudioSessionManager2_RegisterSessionNotification(this, SessionNotification) {
return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr", SessionNotification)
}
VA_IAudioSessionManager2_UnregisterSessionNotification(this, SessionNotification) {
return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", SessionNotification)
}
VA_IAudioSessionManager2_RegisterDuckNotification(this, SessionNotification) {
return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr", SessionNotification)
}
VA_IAudioSessionManager2_UnregisterDuckNotification(this, SessionNotification) {
return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", SessionNotification)
}
VA_IAudioSessionEnumerator_GetCount(this, ByRef SessionCount) {
return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", SessionCount)
}
VA_IAudioSessionEnumerator_GetSession(this, SessionCount, ByRef Session) {
return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", SessionCount, "ptr*", Session)
}
; =====热键命令子程序============================================================热键命令子程序=================================================================================
;--------------------增编部队
選擇1隊:
If ((A_PriorHotkey <> "~" . 選擇1隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇1隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇1隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇1隊%
Return
}
If Ra2_Switch
{
Send %將1隊置中%
Send %將1隊置中%
}
Return
選擇2隊:
If ((A_PriorHotkey <> "~" . 選擇2隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇2隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇2隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇2隊%
Return
}
If Ra2_Switch
{
Send %將2隊置中%
Send %將2隊置中%
}
Return
選擇3隊:
If ((A_PriorHotkey <> "~" . 選擇3隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇3隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇3隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇3隊%
Return
}
If Ra2_Switch
{
Send %將3隊置中%
Send %將3隊置中%
}
Return
選擇4隊:
If ((A_PriorHotkey <> "~" . 選擇4隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇4隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇4隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇4隊%
Return
}
If Ra2_Switch
{
Send %將4隊置中%
Send %將4隊置中%
}
Return
選擇5隊:
If ((A_PriorHotkey <> "~" . 選擇5隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇5隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇5隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇5隊%
Return
}
If Ra2_Switch
{
Send %將5隊置中%
Send %將5隊置中%
}
Return
選擇6隊:
If ((A_PriorHotkey <> "~" . 選擇6隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇6隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇6隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇6隊%
Return
}
If Ra2_Switch
{
Send %將6隊置中%
Send %將6隊置中%
}
Return
選擇7隊:
If ((A_PriorHotkey <> "~" . 選擇7隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇7隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇7隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇7隊%
Return
}
If Ra2_Switch
{
Send %將7隊置中%
Send %將7隊置中%
}
Return
選擇8隊:
If ((A_PriorHotkey <> "~" . 選擇8隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇8隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇8隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇8隊%
Return
}
If Ra2_Switch
{
Send %將8隊置中%
Send %將8隊置中%
}
Return
選擇9隊:
If ((A_PriorHotkey <> "~" . 選擇9隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇9隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇9隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇9隊%
Return
}
If Ra2_Switch
{
Send %將9隊置中%
Send %將9隊置中%
}
Return
選擇10隊:
If ((A_PriorHotkey <> "~" . 選擇10隊) or A_TimeSincePriorHotkey > 400)
{
While (GetKeyState(選擇10隊,"P") && Ra2Move_Switch)
{
If (A_TimeSinceThisHotkey > 300)
{
選擇x隊:=選擇10隊
Gosub,移动攻击
}
}
;~ KeyWait, %選擇10隊%
Return
}
If Ra2_Switch
{
Send %將10隊置中%
Send %將10隊置中%
}
Return
/*
選擇1隊:
If ((A_PriorHotkey <> "~" . 選擇1隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇1隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將1隊置中%
Send %將1隊置中%
}
Return
選擇2隊:
If ((A_PriorHotkey <> "~" . 選擇2隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇2隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將2隊置中%
Send %將2隊置中%
}
Return
選擇3隊:
If ((A_PriorHotkey <> "~" . 選擇3隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇3隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將3隊置中%
Send %將3隊置中%
}
Return
選擇4隊:
If ((A_PriorHotkey <> "~" . 選擇4隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇4隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將4隊置中%
Send %將4隊置中%
}
Return
選擇5隊:
If ((A_PriorHotkey <> "~" . 選擇5隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇5隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將5隊置中%
Send %將5隊置中%
}
Return
選擇6隊:
If ((A_PriorHotkey <> "~" . 選擇6隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇6隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將6隊置中%
Send %將6隊置中%
}
Return
選擇7隊:
If ((A_PriorHotkey <> "~" . 選擇7隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇7隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將7隊置中%
Send %將7隊置中%
}
Return
選擇8隊:
If ((A_PriorHotkey <> "~" . 選擇8隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇8隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將8隊置中%
Send %將8隊置中%
}
Return
選擇9隊:
If ((A_PriorHotkey <> "~" . 選擇9隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇9隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將9隊置中%
Send %將9隊置中%
}
Return
選擇10隊:
If ((A_PriorHotkey <> "~" . 選擇10隊) or A_TimeSincePriorHotkey > 400)
{
Send {Shift Down}
Send {Ctrl Down}
;~ PostMessage, 0x50, 0, %IME_EN%,,A
KeyWait, %選擇10隊%
Send {Shift Up}
Send {Ctrl Up}
Return
}
If Ra2_Switch
{
Send %將10隊置中%
Send %將10隊置中%
}
Return
*/
新增選擇1隊:
Send,%新增選擇1隊%
Send,%創建1部隊%
Return
新增選擇2隊:
Send,%新增選擇2隊%
Send,%創建2部隊%
Return
新增選擇3隊:
Send,%新增選擇3隊%
Send,%創建3部隊%
Return
新增選擇4隊:
Send,%新增選擇4隊%
Send,%創建4部隊%
Return
新增選擇5隊:
Send,%新增選擇5隊%
Send,%創建5部隊%
Return
新增選擇6隊:
Send,%新增選擇6隊%
Send,%創建6部隊%
Return
新增選擇7隊:
Send,%新增選擇7隊%
Send,%創建7部隊%
Return
新增選擇8隊:
Send,%新增選擇8隊%
Send,%創建8部隊%
Return
新增選擇9隊:
Send,%新增選擇9隊%
Send,%創建9部隊%
Return
新增選擇10隊:
Send,%新增選擇10隊%
Send,%創建10部隊%
Return
; --------------------------------------------------------------全局通用热键
【音量增大】:
Suspend ,Permit
音量("+")
Return
【音量减小】:
Suspend ,Permit
音量("-")
Return
【关闭红警】:
Suspend ,Permit
Process, Exist, Game.exe
If ErrorLevel
Process Close,Game.exe
Process, Exist, Ra2.exe
If ErrorLevel
Process Close,Ra2.exe
Process, Exist, GameMD.exe
If ErrorLevel
Process Close,GameMD.exe
return
【重启红警】:
Suspend ,Permit
Process, Exist, Game.exe
If ErrorLevel
{
Process Close,Game.exe
Process WaitClose,Game.exe
Process WaitClose,Ra2.exe
}
SetTimer,WaitRa2,500
return
WaitRa2:
Process, Exist, Game.exe
If !ErrorLevel
{
ControlGet, i,Enabled,,Button12,ahk_class QQBattle_MainFrame
If i
ControlClick,Button12,ahk_class QQBattle_MainFrame,,,, NA
else
Run, %ra2dir%\ra2.exe
;~ Process, Exist, Game.dat
;~ If ErrorLevel
;~ Process Close,Game.dat
}
Else IfWinActive,ahk_class Red Alert 2,GUI:MainMenu
{
ControlClick,GUI:Network,ahk_class Red Alert 2,,,1,NA
SetTimer,WaitRa2,Off
}
return
【工具助手(显示/隐藏)】:
/*
n:=0
Loop % %A_ThisLabel%0
{
Label:=% %A_ThisLabel%%A_Index%
If % %Label%()
n++
}
If (n=%A_ThisLabel%0)
{
*/
;~ If HidewinCheck=1
;~ Gosub,Hidewin
;~ else
;~ {
ControlGetFocus,OutputVar ,ahk_id %Myguihwnd%
; MsgBox,======%Myguihwnd%
if OutputVar
Gui,Hide
else
Gui,Show,AutoSize x%MyguiX% y%MyguiY%
;~ tooltip,%myguix%=%myguiy%
;~ }
return
_RESET:
IniDelete,Default.ini,Default,GuiShowPosX
IniDelete,Default.ini,Default,GuiShowPosY
Reload
return
; --------------------------------------------------------------红警大厅界面
〖上一页(网路/返回)〗:
Suspend Permit
n:=0
Loop % %A_ThisLabel%0
{
Label:=% %A_ThisLabel%%A_Index%
If % %Label%()
n++
}
If (n=%A_ThisLabel%0)
{
; MsgBox,% _%Array1%(Array2)
; ----------------------主内容
IfWinActive,ahk_group 红警大厅界面,GUI:ResumeMission
ControlClick, GUI:ResumeMission,ahk_group 红警大厅界面,,,1,NA
Else IfWinActive,ahk_group 红警大厅界面,GUI:Continue
ControlClick, GUI:Continue,ahk_group 红警大厅界面,,,1,NA
Else IfWinActive,ahk_group 红警大厅界面,GUI:Network
ControlClick, GUI:Network,ahk_group 红警大厅界面,,,1,NA
Else IfWinActive,ahk_group 红警大厅界面,GUI:Return
ControlClick, GUI:Return,ahk_group 红警大厅界面,,,1,NA
Else IfWinActive,ahk_group 红警大厅界面, GUI:MainMenu
ControlClick, GUI:MainMenu,ahk_group 红警大厅界面,,,1,NA
Else IfWinActive,ahk_group 红警大厅界面,GUI:Back
ControlClick, GUI:Back,ahk_group 红警大厅界面,,,1,NA
}
return
; --------------------------------------------------------------红警游戏热键映射
红色警戒热键映射:
HK:=":映射" . HKChangeCN(A_ThisHotkey)
;~ MsgBox,% %hk%
StringReplace,HK,%HK%,《,,All
StringTrimRight,HK,HK,1
;~ MsgBox,%HK%
Loop,Parse,HK,》
{
StringSplit,str,A_LoopField,﹍
IfInString,STR1,`%
{
StringTrimLeft,str,str1,1
StringTrimRight,str1,str,1
str1:=%str1%
}
else
str1:=HKChangeEN(str1)
StringReplace,str2,str2,次数
StringReplace,str3,str3,延迟
Loop,%str2%
{
Send,%str1%
Sleep,%str3%
}
}
Return
; --------------------------------------------------------------红警辅助热键
切换结盟:
Suspend Permit
IfWinActive,Red Alert,GUI:DiplomacyMenu
ControlClick,GUI:Return,Red Alert,,,1,NA
Else
Send, 0{%A_ThisHotkey%}
GameFrame2=
Return
; --------------------------------------------------------------红警游戏热键
最后建造追加热键:
If ((LastControlClickX>Build_x1) And (LastControlClickX>Build_y1))
{
ControlClick x%LastControlClickX% y%LastControlClickY%,A,,,%ClickBuildNum%,NA
Sleep,50
}
Else
{
PixelSearch,LastClickX,LastClickY,Build_x1,Build_y1,Build_x2,Build_y2,0x00FFFF,3,Fast
if ErrorLevel
PixelSearch,LastClickX,LastClickY,Build_x1,Build_y1,Build_x2,Build_y2,0xFFD3A5,3,Fast
if ErrorLevel
PixelSearch,LastClickX,LastClickY,Build_x1,Build_y1,Build_x2,Build_y2,0xB5EFF7,3,Fast
if ErrorLevel
PixelSearch,LastClickX,LastClickY,Build_x1,Build_y1,Build_x2,Build_y2,0xF7D79C,3,Fast
if ErrorLevel=0
ControlClick x%LastClickX% y%LastClickY%,A,,,%ClickBuildNum%,NA
Sleep,20
}
Return
空格键+Ctrl:
StartTime := A_TickCount
;~ Send, {Shift Down}
Send, {Ctrl Down}
KeyWait,Space
Send, {Ctrl Up}
;~ Send, {Shift Up}
If (A_TickCount-StartTime < 200)
Send,{Space}
Return
心灵信标:
;~ Critical
Send %配置心靈信標%
Sleep, 100
Click,5
Sleep, 100
Send {Delete}
Return
残血部队: ;{
Send %選擇種類%
Sleep,50+%_KeyDelay%
Send,%生命值順序%
Sleep,20+%_KeyDelay%
;~ Send,%新增選擇7隊%
;~ Sleep,20+%_KeyDelay%
Send,%創建7部隊%
SoundPlay,%SoundWav%
Sleep,50+%_KeyDelay%
Send,%生命值順序%
Sleep,20+%_KeyDelay%
Send,%新增選擇7隊%
Sleep,20+%_KeyDelay%
Send,%創建7部隊%
Sleep,50+%_KeyDelay%
Click,1
Sleep, 100+%_KeyDelay%
Return ;}
一键观战:
Send,{Esc}
WinWaitActive,Red Alert,GUI:AbortMission,30
Sleep,200
ControlClick,GUI:AbortMission,Red Alert,,,,NA
Sleep,20
WinWaitActive,Red Alert,GUI:AskAbortMission,5
Sleep,200
ControlGet,i,Visible,,Button3
If i
ControlClick,Button3,Red Alert,,,,NA
Else
ControlClick,Button2,Red Alert,,,,NA
Sleep,20
Return
保护+点击:
;~ Critical
Send {Alt Down}
SoundPlay,%SoundWav%
Send {Ctrl Down}
Sleep, 150
Click,1
Sleep, 100
Send {Ctrl Up}
Send {Alt Up}
Return
移动+点击:
;~ Critical
Send {Shift Down}
SoundPlay,%SoundWav%
Send {Ctrl Down}
Sleep, 150
Click,1
Sleep, 100
Send {Ctrl Up}
Send {Shift Up}
Return
保护模式:
;~ Critical
StringReplace,str,A_ThisHotkey,~
Send {Alt Down}
Send {Ctrl Down}
Sleep, 100
KeyWait,%str%
Send {Ctrl Up}
Send {Alt Up}
Sleep, 50
Return
/*
移动攻击:
;~ Critical
;~ StringReplace,str,A_ThisHotkey,~
Send {Shift Down}
Send {Ctrl Down}
PostMessage, 0x50, 0, %IME_EN%,,A
Sleep, 100
KeyWait,%選擇x隊%
Send {Shift Up}
Send {Ctrl Up}
Sleep, 50
Return
*/
移动攻击:
;~ Critical
;~ StringReplace,str,A_ThisHotkey,~
Send {Shift Down}
Send {Ctrl Down}
PostMessage, 0x50, 0, %IME_EN%,,A
Sleep, 100
KeyWait,%選擇x隊%
Send {Shift Up}
Send {Ctrl Up}
Sleep, 50
Return
快速设键:
Suspend,Permit
IniRead,hotkeystr,settings\%ProjectSelect%.ini,Hotkey
if hotkeystr=error
{
tooltip,没找到备份按键,请先备份后再恢复
sleep,500
tooltip
return
}
F10check:=1
Gui,TreeView,HKTree1
GuiControl, -Redraw,HKTree1 ;取消重绘提高性能
TV_Delete(游戏内置按键TVID)
游戏内置按键TVID:=TV_Add("游戏内置按键",红色警戒TVID)
TV_Add("红警路径:" . Ra2Dir . "\ra2.exe",游戏内置按键TVID)
SetCapsLockState ,Off
SetTimer WindowCheck_Alert,Off
Suspend,on
SetControlDelay,1
SetKeyDelay,0
SendMessage, 0x50, 0, %IME_EN%,,A
WinGet, ControlList, ControlList, A
If ((GameFrame1=1) and (ControlList=""))
{
Send,{Esc}
Sleep,200
WinWaitActive,ahk_class Red Alert 2,GUI:AbortMission,5
Sleep,200
ControlClick,GUI:GameOptions,ahk_class Red Alert 2,,,1,NA
ControlClick,GUI:GameControls,ahk_class Red Alert 2,,,1,NA
WinWaitActive,ahk_class Red Alert 2,GUI:Keyboard,5
Sleep,200
ControlClick,GUI:Keyboard,ahk_class Red Alert 2,,,1,NA
WinWaitActive,ahk_class Red Alert 2,GUI:ResetAll,5
If !ErrorLevel
Gosub,KeyBoardCGX
ControlClick,GUI:Back,ahk_class Red Alert 2,,,1,NA
WinWaitActive,ahk_class Red Alert 2,GUI:Keyboard,5
Sleep,200
ControlClick,GUI:Back,ahk_class Red Alert 2,,,1,NA
WinWaitActive,ahk_class Red Alert 2,GUI:AbortMission,5
Sleep,200
ControlClick,GUI:ResumeMission,ahk_class Red Alert 2,,,1,NA
}
Else IfWinNotActive,ahk_class Red Alert 2,GUI:KeyboardOptions
{
Loop 10
{
IfWinActive,ahk_class Red Alert 2,GUI:Options
{
ControlClick, GUI:Options ,ahk_class Red Alert 2,,,1,NA
Sleep,300
}
IfWinActive,ahk_class Red Alert 2,GUI:Keyboard
{
ControlClick, GUI:Keyboard,ahk_class Red Alert 2,,,1,NA
Sleep,1000
Break
}
IfWinActive,ahk_class Red Alert 2,GUI:MainMenu
{
ControlClick, GUI:MainMenu ,ahk_class Red Alert 2,,,1,NA
Sleep,300
}
IfWinActive,ahk_class Red Alert 2,GUI:Back
{
ControlClick, GUI:Back ,ahk_class Red Alert 2,,,1,NA
Sleep,300
}
}
}
IfWinActive,ahk_class Red Alert 2,GUI:Keyboard
{
Gosub,KeyBoardCGX
ControlClick,GUI:Back,ahk_class Red Alert 2,,,1,NA
WinWaitActive,ahk_class Red Alert 2,GUI:Keyboard,5
Sleep,500
ControlClick,GUI:Back,ahk_class Red Alert 2,,,1,NA
WinWaitActive,ahk_class Red Alert 2,GUI:MainMenu,5
ControlClick,GUI:MainMenu,ahk_class Red Alert 2,,,1,NA
Sleep,500
WinWaitActive,ahk_class Red Alert 2,GUI:Network,5
Sleep,500
ControlClick,GUI:Network,ahk_class Red Alert 2,,,1,NA
}
SetTimer WindowCheck_Alert,On
GameFrame2=
GuiControl, +Redraw,HKTree1
Return
预设默认配置:
IniWrite,《T﹍次数1﹍延时0》《Y﹍次数1﹍延时0》《Ctrl+6﹍次数1﹍延时0》,Settings\%ProjectSelect%.ini,红色警戒,选中三星编为6队:映射~Alt+Q
IniWrite,《T﹍次数1﹍延时0》《U﹍次数1﹍延时0》《Shift+7﹍次数1﹍延时0》《Ctrl+7﹍次数1﹍延时0》《T﹍次数1﹍延时0》《U﹍次数1﹍延时0》《Shift+7﹍次数1﹍延时0》《Ctrl+7﹍次数1﹍延时0》,Settings\%ProjectSelect%.ini,红色警戒,选中残血编为7队:映射~Alt+W
IniWrite,《`%下一個物件`%﹍次数1﹍延时0》《`%部署物件`%﹍次数1﹍延时0》《`%創建8部隊`%﹍次数1﹍延时0》,Settings\%ProjectSelect%.ini,红色警戒,一键打开基地编8队:映射M
IniWrite,《Ctrl+9﹍次数1﹍延时0》,Settings\%ProjectSelect%.ini,红色警戒,Alt+E=编9队:映射~Alt+E
IniWrite,《Ctrl+0﹍次数1﹍延时0》,Settings\%ProjectSelect%.ini,红色警戒,Alt+R=编0队:映射~Alt+R
IniWrite,《i﹍次数1﹍延时0》,Settings\%ProjectSelect%.ini,红色警戒,:映射鼠标中键
URL=
(
百度=http://www.baidu.com/
QQ红警论坛=http://qqbattle.gamebbs.qq.com/forum.php?mod=forumdisplay&fid=11227
联谊红警论坛=http://bbs.myra2.com/forum-17-1.html
)
IniWrite,%URL%,Settings\%ProjectSelect%.ini,FavoritesCustom
return
CreateRa2Menu()
{
global
;-------------------MenuBar
Menu, FileMenu, Add, &打开软件目录`tCtrl+O, MenuFileOpen ; 关于 Ctrl+O 请参阅后面的备注.
Menu, FileMenu, Add, 启动红警, MenuFileOpen
Menu, FileMenu, Add, 打开红警目录, MenuFileOpen
Menu, FileMenu, Add
Menu, FileMenu, Add, 页内打开收藏,MenuHandler
If ToggleCheckRunThis
Menu, FileMenu, Check, 页内打开收藏
Menu, FileMenu, Add, 保存为起始页,MenuHandler
Menu, FileMenu, Add
Menu, FileMenu, Add, 选择红警目录, FileSelectFolder红警目录
Menu, FileMenu, Add, 退出, MenuExit
Menu, EditMenu, Add, &删除, MenuHandler
Menu, EditMenu, Add, 全部删除, MenuHandler
Menu, EditMenu, Add, &复制文件路径, MenuHandler
Menu, SystemMenu, Add, 定时器, SystemHandler
Menu, SystemMenu, Add, 计算器, SystemHandler
Menu, SystemMenu, Add, 画图, SystemHandler
Menu, SystemMenu, Add
Menu, SystemMenu, Add, 关闭屏幕, SystemHandler
Menu, SystemMenu, Add, 启动项管理,SystemHandler
Menu, SystemMenu, Add
Menu, SystemMenu, Add, 重启, SystemHandler
Menu, SystemMenu, Add, &休眠`tCtrl+Shift+End, SystemHandler
Menu, SystemMenu, Add, 关机, SystemHandler
Menu, OptionsMenu, Add, 深夜等游戏…, MenuHandler
Menu, SystemMenu, Add
Menu, OptionsMenu, Add, &备份和恢复, MenuHandler
Menu, OptionsMenu, Add, 设置自定按钮 1, MenuHandler
Menu, OptionsMenu, Add, 设置自定按钮 2, MenuHandler
Menu, OptionsMenu, Add, 设置自定按钮 3, MenuHandler
Menu, OptionsMenu, Add, 设置自定按钮 4, MenuHandler
Menu, OptionsMenu, Add, 管理收藏夹, MenuHandler
Menu, OptionsMenu, Add, 参数选项, 参数选项
;~ Menu, Submenu备份和恢复, Add, 备份键盘文件, _iniBackup
;~ Menu, Submenu备份和恢复, Add, 备份ra2.ini配置, _iniBackup
;~ Menu, Submenu备份和恢复, Add, 备份rules.ini规则, _iniBackup
Menu, ToolsMenu, Add, &添加工具, MenuHandler
Menu, ToolsMenu, Add
IniRead ToolsCustom,Settings\%ProjectSelect%.ini,ToolsCustom
Loop, Parse, ToolsCustom, `n, `r
{
RegExMatch(A_LoopField, "(\s*)(?P<key>.+?)(\s*?)=(\s*)(?P<value>.*?)\s*?$", _)
; MsgBox,%_key%=%_value%
Menu, ToolsMenu, Add, %_key%, RunToolsMenu
}
Menu, FavoritesMenu, Add, &添加收藏, MenuHandler
Menu, FavoritesMenu, Add
IniRead FavoritesCustom,Settings\%ProjectSelect%.ini,FavoritesCustom
Loop, Parse, FavoritesCustom, `n, `r
{
RegExMatch(A_LoopField, "(\s*)(?P<key>.+?)(\s*?)=(\s*)(?P<value>.*?)\s*?$", _)
; MsgBox,%_key%=%_value%
Menu, FavoritesMenu, Add, %_key%, RunFavoritesMenu
}
;~ Menu, HelpMenu, Add, 窗口最前, MenuHandler ;转移到后面
;~ if ToggleCheckOnTop
;~ {
;~ menu, HelpMenu, Check, 窗口最前
;~ Gui,+AlwaysOnTop
;~ }
Menu, HelpMenu, Add, 提示音, MenuHandler
If ToggleCheckBeep
Menu, HelpMenu, Check, 提示音
Menu, HelpMenu, Add, 关闭到任务栏, MenuHandler
If ToggleCheckHidden
Menu, HelpMenu, Check, 关闭到任务栏
Menu, HelpMenu, Add, 开机自启动,MenuHandler
If ToggleCheckAutoRun
Menu, HelpMenu, Check, 开机自启动
Menu, FileMenu, Add
Menu, HelpMenu, Add, 使用说明, MenuHandler
Menu, HelpMenu, Add, 检查更新, MenuHandler
Menu, HelpMenu, Add, &关于, MenuHandler
If ToggleCheck检查更新
Menu, HelpMenu, Check, 检查更新
Menu, HelpMenu, Add, 反馈建议, MenuHandler
Menu, MyMenuBar, Add, 文件, :FileMenu ; 附加上面的两个子菜单.
Menu, MyMenuBar, Add, 编辑, :EditMenu
Menu, MyMenuBar, Add, 系统, :SystemMenu
Menu, MyMenuBar, Add, 设置, :OptionsMenu
Menu, MyMenuBar, Add, 常用工具, :ToolsMenu
Menu, MyMenuBar, Add, 收藏夹, :FavoritesMenu
Menu, MyMenuBar, Add, 帮助, :HelpMenu
;~ Menu, MyMenuBar, 5555
;~ Menu, OptionsMenu, Add,&备份和恢复, :Submenu备份和恢复
;~ Menu, Submenu游戏常用ID, Add, 管理游戏ID列表, MyContextMenu
; 创建第一个菜单的子菜单 (右箭头指示符). 当用户选择它时会显示第二个菜单.
;~ Menu, MyContextMenuRa2, Add, 游戏常用ID, :Submenu游戏常用ID
; 创建第一个菜单的子菜单 (右箭头指示符). 当用户选择它时会显示第二个菜单.
;===========================Menu任务栏============================;
If FileExist(A_ScriptDir . "\Images\Ra2.ico")
Menu, Tray, Icon, %A_ScriptDir%\Images\Ra2.ico
Menu, tray, NoStandard
Menu, Tray, Icon,,, 1
Menu, Tray, Tip,伪红警高级助手
Menu, tray, add,选项设置,displayHidden
;~ Menu, tray, add,选项设置, _RESET
Menu, tray, add,使用帮助, WebsiteFAQ
Menu, tray, add,下载更新, WebsiteDownLoad
Menu, tray, add,重启脚本, Reload
Menu, tray, add
Menu, tray, add,关闭红警, 【关闭红警】
Menu, tray, add,退出程序, MenuExit
Menu, Tray, Default, 选项设置
Menu, Tray, Click, 1
;===========================GuiMenu============================;
;----------非Ra2菜单
Menu, MyContextMenu, Add, 打开, MyContextMenu
Menu, MyContextMenu, Default,打开
Menu, MyContextMenu, Add, 打开目录, MyContextMenu
Menu, MyContextMenu, Add, 复制文件路径,MyContextMenu
Menu, MyContextMenu, Add, 删除, MyContextMenu
Menu, MyContextMenu, Add, 重命名, MyContextMenu
Menu, MyContextMenu, Add
Menu, MyContextMenu, Add, 添加, MyContextMenu
Menu, MyContextMenu, Add, 上移一格, MyContextMenu
Menu, MyContextMenu, Add, 下移一格, MyContextMenu
Menu, MyContextMenu, Add, 属性,MyContextMenu
Menu, MyContextMenuRa2, Add,设为主要红警, MyContextMenu
Menu, SubMenu游戏常用ID, Add, 保存当前游戏ID, MyContextMenu
Loop,Parse,MultiPlayer,/\
Menu, SubMenu游戏常用ID, Add,%A_LoopField%, MyContextMenu
Menu, SubMenu游戏常用ID, Add, 管理游戏ID列表, MyContextMenu
; 创建第一个菜单的子菜单 (右箭头指示符). 当用户选择它时会显示第二个菜单.
Menu, MyContextMenuRa2, Add, 游戏常用ID, :SubMenu游戏常用ID
; 添加子菜单到上面的菜单中.
;~ Menu,删除分辨率, Add, 删除,删除分辨率
Loop,Parse,Ra2Resolution,/\
Menu, SubMenu分辨率, Add,%A_LoopField%, MyContextMenu
Menu, SubMenu分辨率, Add,管理分辨率, MyContextMenu
; 创建第一个菜单的子菜单 (右箭头指示符). 当用户选择它时会显示第二个菜单.
;~ Menu, Submenu分辨率, Add,1024, MyContextMenu
Menu, MyContextMenuRa2, Add, 游戏分辨率, :SubMenu分辨率
Menu, MyContextMenuRa2, Add,设为QQ平台红警, MyContextMenu
Menu, MyContextMenuRa2, Add ; 添加分隔线.
;~ Menu,删除分辨率, Add, 删除,删除分辨率
;~ Menu, Submenu分辨率, Add, 删除, :删除分辨率
;----------Ra2菜单
Menu, MyContextMenuRa2, Add, 运行, MyContextMenu
Menu, MyContextMenuRa2, Default,运行
Menu, MyContextMenuRa2, Add, 打开目录, MyContextMenu
Menu, MyContextMenuRa2, Add, 复制文件路径,MyContextMenu
Menu, MyContextMenuRa2, Add
; 添加子菜单到上面的菜单中.
Menu, MyContextMenuRa2, Add, 删除, MyContextMenu
Menu, MyContextMenuRa2, Add, 重命名, MyContextMenu
Menu, MyContextMenuRa2, Add
Menu, MyContextMenuRa2, Add, 添加, MyContextMenu
Menu, MyContextMenuRa2, Add, 上移一格, MyContextMenu
Menu, MyContextMenuRa2, Add, 下移一格, MyContextMenu
Menu, MyContextMenuRa2, Add, 属性, MyContextMenu
Menu, MyContextMenuRa2, Add
Menu, MyContextMenuRa2, Add, 导入键盘(替换), MyContextMenu
Menu, MyContextMenuRa2, Add, 导出键盘(备份), MyContextMenu
return
;---------------------------常用工具---------------------------;
参数选项: ;{ --
Gui,Options:new
Gui, font, s9 ,%CustomFont%
Gui, Options:add,Tab2,w485 h310,界面样式|自定按钮
Gui, Options:Tab,1
;~ Gui, Options:Add, Slider,Range0-255 H255 Section ToolTipBottom TickInterval51 Vertical vCOLORSliderR GCOLORSlider
;~ Gui, Options:Add, Slider,YS Range0-255 H255 ToolTipBottom Vertical TickInterval51 vCOLORSliderG GCOLORSlider
;~ Gui, Options:Add, Slider,YS Range0-255 H255 ToolTipBottom Vertical TickInterval51 vCOLORSliderB GCOLORSlider
Gui,Options:add,text, Section,主界面颜色:
Gui,Options:add,text, xs,红:
Gui, Options:Add, Slider,x+3 yp Range0-255 W255 Tool TickInterval51 vColorSliderR GCOLORSlider
Gui,Options:add,text, xs,蓝:
Gui, Options:Add, Slider,x+3 yp Range0-255 W255 ToolTip TickInterval51 vColorSliderG GCOLORSlider
Gui,Options:add,text, xs,绿:
Gui, Options:Add, Slider,x+3 yp Range0-255 W255 ToolTip TickInterval51 vColorSliderB GCOLORSlider
Gui,Options:add,text, xs,主界面透明度:
Gui, Options:Add, Slider,x+3 yp Range0-255 W192 Tool TickInterval51
Gui,Options:add,text,xs,边缘隐藏透明度:
Gui, Options:Add, Slider,x+3 yp Range0-255 W180 Tool TickInterval51
Gui,Options:add,text,xs,字体:
Gui,Options:show
return ;}
COLORSlider: ;{ --
Gui,Submit,NoHide
SetFormat, Integer, hex
ColorSliderr += 0
SetFormat, Integer, D
SetFormat, Integer, hex
ColorSliderg += 0
SetFormat, Integer, D
SetFormat, Integer, hex
ColorSliderb += 0
SetFormat, Integer, D
StringRight,r,ColorSliderr,2
StringRight,g,ColorSliderg,2
StringRight,b,ColorSliderb,2
RandomColor=%r%%g%%b%
Gui, 1:Default
Gui,Color,%RandomColor%
Clipboard:=RandomColor
return ;}
参数选项GuiClose:
Gui Destroy
Gui, 1:Default
return
SystemHandler: ;{ --
If A_ThisMenuItem=定时器
{
SystemHandler_:
MouseGetPos,x,y
x-=120
y-=200
If Gui定时器=1
{
Gui,TimeShutdown:Default
GuiControl,,Tmh,%A_Hour%
GuiControl,,Tmm,%A_Min%
GuiControl,,Tms,%A_Sec%
GuiControl,,TimesFixedShutdown,%TimesFixedShutdown%
If TimesFixedShutdown=定时关机
GuiControl,Hide,定时关机
Else
GuiControl,Show,定时关机
GuiControl,,TimesFixedAlarm,%TimesFixedAlarm%
If TimesFixedAlarm=定时提醒
GuiControl,Hide,定时提醒
Else
GuiControl,Show,定时提醒
GuiControl,,TimesDelayShutdown,%TimesDelayShutdown%
If TimesDelayShutdown=延时关机
GuiControl,Hide,延时关机
Else
GuiControl,Show,延时关机
GuiControl,,TimesDelayAlarm,%TimesDelayAlarm%
If TimesDelayAlarm=延时提醒
GuiControl,Hide,延时提醒
Else
GuiControl,Show,延时提醒
Gui,TimeShutdown:Show,x%x% y%y% w240,Gui定时器
}
Else
{
Gui,TimeShutdown:new
Gui,+AlwaysOnTop
Gui, font, s14
;~ Gui,Timeshutdown:add,edit,y+20 w70 h25 Limit4 Number
;~ Gui,Timeshutdown:add, UpDown,h25 vYear Range2012-2112 0x80, %A_YYYY%
;~ Gui,Timeshutdown:add,text,x+5 yp+5,年
;~ Gui,Timeshutdown:add,edit,x+5 yp-5 w50 h25 Limit2 Number
;~ Gui,Timeshutdown:add, UpDown,h25 vMM Range1-12, %A_MM%
;~ Gui,Timeshutdown:add,text,x+5 yp+5,月
;~ Gui,Timeshutdown:add,edit,x+5 yp-5 w50 h25 Limit2 Number
;~ Gui,Timeshutdown:add, UpDown,h25 vDD Range1-31, %A_DD%
;~ Gui,Timeshutdown:add,text,x+5 yp+5,日
; Gui,Timeshutdown:add,checkbox,ys Checked%CheckTimesSound% vCheckTimesSound gCheckTimesSound,声音提醒
Gui,TimeShutdown:add,Edit,xm+80 ym+72 w50 h25 Number Center vSTShutdown,30
Gui,TimeShutdown:add,edit,xm-12 ym w50 h25 Limit2 Number Center Section
Gui,TimeShutdown:add, UpDown,h25 vTmh Range1-24, %A_Hour%
Gui,TimeShutdown:add,text,x+5 yp+5,时
Gui,TimeShutdown:add,edit,x+5 yp-5 w50 h25 Limit2 Number Center
Gui,TimeShutdown:add, UpDown,h25 vTmm Range0-59, %A_Min%
Gui,TimeShutdown:add,text,x+5 yp+5,分
Gui,TimeShutdown:add,edit,x+5 yp-5 w50 h25 Limit2 Number Center
Gui,TimeShutdown:add, UpDown,h25 vTms Range0-59,%A_Sec%
Gui,TimeShutdown:add,text,x+5 yp+5,秒
Gui,TimeShutdown:add,Button,xs+12 Section h28 vTimesFixedShutdown gTimesFixedShutDown,%TimesFixedShutdown%
Gui,TimeShutdown:add,Button,ys h28 vTimesFixedAlarm gTimesFixedAlarm,%TimesFixedAlarm%
Gui,TimeShutdown:add,Checkbox,xs+10 Section Checked%CheckTimesSound% vCheckTimesSound gCheckTimesSound,闹铃
Gui,TimeShutdown:add,text,xm+140 ym+75,分钟后
Gui,TimeShutdown:add,Button,xs-10 Section h28 vTimesDelayShutdown gTimesDelayShutDown,%TimesDelayShutdown%
Gui,TimeShutdown:add,Button,ys Section h28 vTimesDelayAlarm gTimesDelayAlarm,%TimesDelayAlarm%
Gui, font, s8 cblue
Gui,TimeShutdown:add,text,xm-13 ym+38 v定时关机 Hidden,关`n机
Gui,TimeShutdown:add,text,xm207 ym+38 v定时提醒 Hidden,提`n醒
Gui,TimeShutdown:add,text,xm-13 ym+108 v延时关机 Hidden,关`n机
Gui,TimeShutdown:add,text,xm207 ym+108 v延时提醒 Hidden,提`n醒
;~ Gui,add,Button,x+10 h30 gblog,我的<a href="http://koudaizhi.blogbus.com" target="_blank">博客</a>
Gui, Color, E8E8FF
Gui, TimeShutdown:Show,x%x% y%y% w240,Gui定时器
Gui定时器:=1
}
return
TimesFixedShutDown:
If TimesFixedShutdown=定时关机
{
Gui,Submit
TimesFixedShutdown := SubStr("0" . Tmh, -1) . ":" . SubStr("0" . Tmm, -1) . ":" . SubStr("0" . Tms, -1)
Tmh := Tmh - A_Hour
Tmm := Tmm - A_Min
Tms := Tms - A_Sec
Tm:= (3600*Tmh + 60*Tmm + Tms)*1000
If Tm<0
gosub AuShutDownFixed
Else
{
SetTimer,AuShutdownFixed,-%Tm%
GuiControl,,TimesFixedShutdown,%TimesFixedShutdown%
GuiControl,Show,定时关机
}
}
Else
{
TimesFixedShutdown=定时关机
SetTimer,AuShutdownFixed,Off
GuiControl,,TimesFixedShutdown,定时关机
GuiControl,Hide,定时关机
}
return
TimesFixedAlarm:
If TimesFixedAlarm=定时提醒
{
Gui,Submit,NoHide
Tm:= (3600*(Tmh - A_Hour) + 60*( Tmm - A_Min) + Tms - A_Sec)*1000
If Tm<0
ToolTip, 请选择大于当前的时间
Else
{
TimesFixedAlarm := SubStr("0" . Tmh, -1) . ":" . SubStr("0" . Tmm, -1) . ":" . SubStr("0" . Tms, -1)
; Tmh := Tmh - A_Hour
; Tmm := Tmm - A_Min
; Tms := Tms - A_Sec
Gui,Hide
SetTimer,AuAlarmDelay,-%Tm%
GuiControl,,TimesFixedAlarm,%TimesFixedAlarm%
GuiControl,Show,定时提醒
}
}
Else
{
TimesFixedAlarm=定时提醒
SetTimer,AuAlarmFixed,Off
GuiControl,,TimesFixedAlarm,定时提醒
GuiControl,Hide,定时提醒
}
return
TimesDelayShutDown:
If TimesDelayShutdown=延时关机
{
Gui,Submit
Tm := STShutdown*60*1000
SetTimer,AuShutdownDelay,-%Tm%
TimesDelayShutdown=%STShutdown%分钟后
}
Else
{
TimesDelayShutdown=延时关机
SetTimer,AuShutdownFixed,Off
GuiControl,,TimesDelayShutdown,延时关机
GuiControl,Hide,延时关机
}
return
return
TimesDelayAlarm:
If TimesDelayAlarm=延时提醒
{
Gui,Submit
Tm := STShutdown*60*1000
SetTimer,AuAlarmDelay,-%Tm%
TimesDelayAlarm=%STShutdown%分钟后
}
Else
{
TimesDelayAlarm=延时提醒
SetTimer,AuAlarmDelay,Off
GuiControl,,TimesDelayAlarm,延时提醒
GuiControl,Hide,延时提醒
}
return
AuAlarmDelay:
If CheckTimesSound
SetTimer,SoundPlaying,1500
TimesFixedAlarm=定时提醒
MsgBox , 262213,提醒时间已到,提醒时间已到了~
SetTimer,SoundPlaying,Off
IfMsgBox Retry
gosub,SystemHandler_
return
AuAlarmFixed:
If CheckTimesSound
SetTimer,SoundPlaying,1500
TimesFixedAlarm=定时提醒
MsgBox , 262213,提醒时间已到,提醒时间已到了~
SetTimer,SoundPlaying,Off
IfMsgBox Retry
gosub,SystemHandler_
return
AuShutDownDelay:
If CheckTimesSound
SetTimer,SoundPlaying,1500
TimesDelayShutdown=延时关机
MsgBox , 262213,确认自动关机,10秒后自动关机, 10
SetTimer,SoundPlaying,Off
IfMsgBox Retry
gosub,SystemHandler_
Else IfMsgBox Timeout
Shutdown, 5
return
AuShutDownFixed:
If CheckTimesSound
SetTimer,SoundPlaying,1500
TimesFixedShutdown=定时关机
MsgBox , 262213,确认自动关机,10秒后自动关机, 10
SetTimer,SoundPlaying,Off
IfMsgBox Retry
gosub,SystemHandler_
Else IfMsgBox Timeout
Shutdown, 5
return
CheckTimesSound:
Gui,Submit,NoHide
IniWrite,%CheckTimesSound%,Settings\%ProjectSelect%.ini, Default,CheckTimesSound
return
SoundPlaying:
SoundPlay,%CheckTimesSoundChoise%
return
; TimeshutdownGuiEscape:
; TimeshutdownGuiClose:
; Gui, 1:Default
; return
/* if A_ThisMenuItem=定时器
{
Gui,Timeshutdown:+Owner1 ToolWindow
Gui,+Disabled
Gui,Timeshutdown:Default
Gui, font, s14
;~ Gui,Timeshutdown:add,edit,y+20 w70 h25 Limit4 Number
;~ Gui,Timeshutdown:add, UpDown,h25 vYear Range2012-2112 0x80, %A_YYYY%
;~ Gui,Timeshutdown:add,text,x+5 yp+5,年
;~ Gui,Timeshutdown:add,edit,x+5 yp-5 w50 h25 Limit2 Number
;~ Gui,Timeshutdown:add, UpDown,h25 vMM Range1-12, %A_MM%
;~ Gui,Timeshutdown:add,text,x+5 yp+5,月
;~ Gui,Timeshutdown:add,edit,x+5 yp-5 w50 h25 Limit2 Number
;~ Gui,Timeshutdown:add, UpDown,h25 vDD Range1-31, %A_DD%
;~ Gui,Timeshutdown:add,text,x+5 yp+5,日
Gui,Timeshutdown:add,Edit,xm+120 ym+309 w50 h25 Number Center vSTshutdown,30
Gui,Timeshutdown:add,DateTime,xm ym vMyDateTime w240 Section,%A_Space%yyyy年M月dd日(ddd)
Gui,Timeshutdown:add,Button,ys-1 h28 gSTimeAlert,定时提醒
Gui,Timeshutdown:add,edit,xs+5 w50 h25 Limit2 Number Center Section
Gui,Timeshutdown:add, UpDown,h25 vH_ST Range1-24, %A_Hour%
Gui,Timeshutdown:add,text,x+5 yp+5,时
Gui,Timeshutdown:add,edit,x+5 yp-5 w50 h25 Limit2 Number Center
Gui,Timeshutdown:add, UpDown,h25 vm_ST Range0-59, %A_Min%
Gui,Timeshutdown:add,text,x+5 yp+5,分
Gui,Timeshutdown:add,edit,x+5 yp-5 w50 h25 Limit2 Number Center
Gui,Timeshutdown:add, UpDown,h25 vs_ST Range0-59,%A_Sec%
Gui,Timeshutdown:add,text,x+5 yp+5 ,秒
Gui,Timeshutdown:add,Button,ys-1 x+20 h28 gSTshutdown1,定时关机
Gui, font, s9 cblue
Gui,Timeshutdown:add, listview,Checked xs-5 w350 H200 vLVTimes gLVTimes -Readonly, 事件内容:|日期|次
LV_ModifyCol(1,195)
LV_ModifyCol(2,130)
LV_ModifyCol(3,25)
IniRead,str,Settings\%ProjectSelect%.ini, Alarm
Loop, parse, str, `n, `r%A_Space%%A_Tab%
{
StringSplit,Timestr,a_loopfield,=
StringRight,n,Timestr4,1
;~ MsgBox,%Timestr4%%Timestr3%
if n
LV_Add("check",Timestr2,Timestr1,Timestr3)
else
LV_Add("",Timestr2,Timestr1,Timestr3)
}
;~ LV_ModifyCol(2,230)
Gui,Timeshutdown:add,checkbox,xs Section Checked%CheckTimesSound% vCheckTimesSound gCheckTimesSound,声音提醒
Gui,Timeshutdown:Add, Radio, vMyRadioGroupTimes gMyRadioGroupTimes x+3 ys,每年
Gui,Timeshutdown:Add, Radio,x+3 ys gMyRadioGroupTimes,每月
Gui,Timeshutdown:Add, Radio,x+3 ys gMyRadioGroupTimes,每日
Gui,Timeshutdown:Add, Radio,x+3 ys gMyRadioGroupTimes,每周
Gui,Timeshutdown:Add, Radio,x+3 ys Checked gMyRadioGroupTimes,仅一次
Gui,Timeshutdown:add,checkbox,x+10 ys,每年
Gui,Timeshutdown:add,checkbox,x+10 ys,每月
Gui,Timeshutdown:add,checkbox,xs Section,悬浮提示
Gui,Timeshutdown:add,checkbox,x+10 ys,每周
Gui,Timeshutdown:add,checkbox,x+10 ys,每日
Gui, font, s14
Gui,Timeshutdown:add,Button,ys-20 h30,保存
Gui,Timeshutdown:add,Button,ys-20 h30,取消
Gui, font, s14
Gui,Timeshutdown:add,Button,xs Section h30 gSTshutdown2,延时关机
Gui,Timeshutdown:add,text,xm+180 ym+312,分钟后
Gui,Timeshutdown:add,Button,ys Section h30 gSTAlert,延时报警
;~ Gui,add,Button,x+10 h30 gblog,我的<a href="http://koudaizhi.blogbus.com" target="_blank">博客</a>
Gui, Color, E8E8FF
Gui, Timeshutdown:Show,,定时器 ---(双击删除项值) !
}
str=
Loop % LV_GetCount()
{
LV_GetText(LVText1, A_Index,1)
LV_GetText(LVText2, A_Index,2)
LV_GetText(LVText3, A_Index,3)
SendMessage, 4140, A_Index - 1, 0xF000, SysListView321 ; 4140 为 LVM_GETITEMSTATE. 0xF000 为 LVIS_STATEIMAGEMASK.
IsChecked := (ErrorLevel >> 12) - 1 ; 如果 RowNumber 为选中的则设置 IsChecked 为真, 否则为假.
if IsChecked
{
NewStr := RegExReplace(LVText2, "\D")
str.=NewStr . LVText3 . ","
}
IniWrite,%LVText1%=%LVText3%=%IsChecked%,Settings\%ProjectSelect%.ini, Alarm,%LVText2%
}
StringTrimRight,TimesParse,str,1
IniWrite,%TimesParse%,Settings\%ProjectSelect%.ini, Default,TimesParse
Gui, 1:-Disabled
Gui Destroy
Gui, 1:Default
return
TimesParseCheck:
loop parse,TimesParse,CSV
{
str1:=A_Now
Stringleft,str2,A_LOOPFIELD,10
str2:="20" . A_LOOPFIELD
Stringright,str3,A_LOOPFIELD,1
if str3=年
{
st1:=SubStr(str1, 7 , 2)
st2:=SubStr(str2, 7 , 2)
}
else if str3=月
{
st1:=SubStr(str1, 7 , 2)
st2:=SubStr(str2, 7 , 2)
}
else if str3=日
{
StringTrimLeft,st1,str1,8
StringTrimLeft,st2,str2,8
}
else if str3=周
{
FormatTime, m,str1, ddd
StringTrimLeft,st1,str1,8
st1.=m
FormatTime, m,str2, ddd
StringTrimLeft,st2,str2,8
st2.=m
}
if (st1=st2)
{
SetTimer,TimesParseCheck,Off
str=你的提醒是魂牵梦萦魂牵梦萦影响力影响力
gosub STAlertW
}
;~ tooltip,% str1 . "`n" . str2
;~ MsgBox,%A_LOOPFIELD%
;~ StringReplace,str,A_LOOPFIELD,
}
return
MyRadioGroupTimes:
gui,submit,nohide
FocusedRowNumber := LV_GetNext(0, "F") ; 查找焦点行.
if not FocusedRowNumber ; 没有焦点行.
return
if MyRadioGroupTimes=1
str=年
if MyRadioGroupTimes=2
str=月
if MyRadioGroupTimes=3
str=日
if MyRadioGroupTimes=4
str=周
if MyRadioGroupTimes=5
str=
LV_Modify(FocusedRowNumber,"Col3",str)
return
LVTimes:
if A_GuiEvent=DoubleClick
{
MsgBox , 1,确认删除,确定删除此提醒?
IfMsgBox Cancel
return
LV_GetText(LVText2, A_EventInfo,2)
IniDelete,Settings\%ProjectSelect%.ini,Alarm,%LVText2%
LV_Delete(A_EventInfo)
}
Return
STimeAlert:
gui,submit,nohide
;~ Gui,ListView,LVTimes
GuiControl,focus,LVTimes
if H_ST<10
H_ST:="0" . H_ST
if M_ST<10
M_ST:="0" . M_ST
if S_ST<10
S_ST:="0" . S_ST
LV_Add("Check select focus","新的提醒事件",SubStr(MyDateTime, 3 , 2) . "/" . SubStr(MyDateTime, 5 , 2) . "/" . SubStr(MyDateTime, 7 , 2) . " - " . H_ST . ":" . M_ST . ":" . S_ST)
;~ LV_Modify(RowNumber,"focus")
Send,{F2}
Return
STAlert_:
gui,submit,nohide
STshutdown:= (3600*STmh + 60*STmm + STms)*1000/60000
STAlert:
gui,submit,nohide
; gosub,TimeshutdownGuiClose
SetTimer,STAlertW,% -60000*STshutdown
return
STAlertW: ;;继续工作
if CheckTimesSound
SetTimer,SoundPlaying,2000
;~ MsgBox,%CheckTimesSound%
Gui,STAlertS:+Owner1 ToolWindow
Gui,+Disabled
Gui,STAlertS:Default
Gui, font, s14
Gui,STAlertS:add,Text,w209 Center,%str%
Gui,STAlertS:add,edit,xs w50 h25 Limit2 Number Center Section
Gui,STAlertS:add, UpDown,h25 vSTmh Range0-24, 0
Gui,STAlertS:add,text,x+5 yp+5,时
Gui,STAlertS:add,edit,x+5 yp-5 w50 h25 Limit2 Number Center
Gui,STAlertS:add, UpDown,h25 vSTmm Range0-59, 5
Gui,STAlertS:add,text,x+5 yp+5,分
Gui,STAlertS:add,edit,x+5 yp-5 w50 h25 Limit2 Number Center
Gui,STAlertS:add, UpDown,h25 vSTms Range0-59,0
Gui,STAlertSn:add,text,x+5 yp+5 ,秒
Gui,STAlertS:add,Button,xs+2 Section h30 gSTAlert,下次提醒
Gui,STAlertS:add,Button,ys h30 gSTAlert_,延时提醒
Gui,STAlertS:add,Button,xs Section h30 gSTAlertSGuiClose,关闭声音
Gui,STAlertS:add,Button,ys h30 gSTAlert_,删除退出
Gui, Color, E8E8FF
Gui,STAlertS:Show,,定时器
return
STAlertSGuiClose:
Gui, 1:-Disabled
Gui Destroy
Gui, 1:Default
SetTimer,SoundPlaying,Off
return
*/
}
Else If A_ThisMenuItem=启动项管理
Run msconfig -4
Else If A_ThisMenuItem=计算器
Run,%windir%\system32\calc.exe
Else If A_ThisMenuItem=画图
Run,%windir%\system32\mspaint.exe
Else If A_ThisMenuItem=关闭屏幕
{
Sleep,3000
SendMessage, 0x112, 0xF170, 2,, Program Manager
}
Else If A_ThisMenuItem=重启
Run Shutdown, 6
Else If A_ThisMenuItem=&休眠`tCtrl+Shift+End
Run C:\WINDOWS\system32\Rundll32.exe powrprof.dll`,SetSuspendState
Else If A_ThisMenuItem=关机
{
Run, %ComSpec% /c Shutdown /f /s -i -s
; run, %comspec% /c shutdown /f /s -t 0
Run Shutdown, 5
}
return ;}
;---------------------------Menu子程序---------------------------;
_iniBackup:
return
MenuFileOpen: ;{ --
;~ MsgBox,%A_ThisMenuItem%
IfInString A_ThisMenuItem,&打开软件目录
Run,explorer.exe /select `, %A_ScriptFullPath%,, UseErrorLevel
Else If A_ThisMenuItem=打开红警目录
Run,explorer.exe /select `, %Ra2Dir%\ra2.exe,, UseErrorLevel
Else If A_ThisMenuItem=启动红警
Run,%Ra2Dir%\ra2.exe
return ;}
RunToolsMenu: ;{ --
IniRead,str,Settings\%ProjectSelect%.ini, ToolsCustom,%A_ThisMenuItem%
Run,%str%,,UseErrorLevel
return ;}
RunFavoritesMenu: ;{ --
IniRead,str,Settings\%ProjectSelect%.ini, FavoritesCustom,%A_ThisMenuItem%
If ToggleCheckRunThis
{
WebURL:=str
ComObjError(false)
WB.Silent:="True"
WB.Navigate(WebURL)
MySubroutine=功能说明
GuiControl, Choose, MySubroutine,功能说明
gosub,MySubroutine
GuiControl,,WebURL,%WebURL%
}
Else
Run,%str%,,UseErrorLevel
return ;}
MenuHandler:
; MsgBox,%A_ThisMenuItem%
If A_ThisMenuItem=窗口最前
{
Menu, HelpMenu, ToggleCheck, 窗口最前
ToggleCheckOnTop:=!ToggleCheckOnTop
IniWrite,%ToggleCheckOnTop%,Settings\%ProjectSelect%.ini, Default,ToggleCheckOnTop
If ToggleCheckOnTop
Gui,+AlwaysOnTop
Else
Gui,-AlwaysOnTop
return
}
Else If A_ThisMenuItem=提示音
{
Menu, HelpMenu, ToggleCheck, 提示音
ToggleCheckBeep:=!ToggleCheckBeep
IniWrite,%ToggleCheckBeep%,Settings\%ProjectSelect%.ini, Default,ToggleCheckBeep
return
}
Else If A_ThisMenuItem=关闭到任务栏
{
Menu, HelpMenu, ToggleCheck, 关闭到任务栏
ToggleCheckHidden:=!ToggleCheckHidden
IniWrite,%ToggleCheckHidden%,Settings\%ProjectSelect%.ini, Default,ToggleCheckHidden
return
}
Else If A_ThisMenuItem=开机自启动
{
Menu, HelpMenu, ToggleCheck, 开机自启动
ToggleCheckAutoRun:=!ToggleCheckAutoRun
IniWrite,%ToggleCheckAutoRun%,Settings\%ProjectSelect%.ini, Default,ToggleCheckAutoRun
If ToggleCheckAutoRun
FileCreateShortcut, %A_ScriptDir%\红警工具.exe, %A_Startup%\红警工具.lnk
Else
FileDelete, %A_Startup%\红警工具.lnk
return
}
Else If A_ThisMenuItem=页内打开收藏
{
Menu, FileMenu, ToggleCheck, 页内打开收藏
ToggleCheckRunThis:=!ToggleCheckRunThis
IniWrite,%ToggleCheckRunThis%,Settings\%ProjectSelect%.ini, Default,ToggleCheckRunThis
return
}
Else If A_ThisMenuItem= 保存为起始页
{
Gui,Submit,NoHide
IniWrite,%WebURL%,Settings\%ProjectSelect%.ini, Default,WebURL
return
}
Else If A_ThisMenuItem=使用说明
gosub,WebsiteHelp
Else If A_ThisMenuItem=检查更新
{
Menu, HelpMenu, ToggleCheck,检查更新
ToggleCheck检查更新:=!ToggleCheck检查更新
IniWrite,%ToggleCheck检查更新%,Settings\%ProjectSelect%.ini, Default,ToggleCheck检查更新
If ToggleCheck检查更新
gosub,WebsiteDownLoad
return
}
Else If A_ThisMenuItem=反馈建议
gosub,WebsiteFAQ
Else If A_ThisMenuItem=打开软件目录
Run,explorer.exe /select `, %A_ScriptFullPath%,, UseErrorLevel
Else If A_ThisMenuItem=打开红警目录
Run,explorer.exe /select `, %Ra2Dir%\ra2.exe,, UseErrorLevel
Else IfInString A_ThisMenuItem,管理收藏夹
{
Gui,CustomFavorites:+Owner1 +Resize
Gui,+Disabled
Gui,CustomFavorites:Default
Gui,CustomFavorites: Font, cblue s8 宋体
Gui,CustomFavorites:Add,ListView,R20 w600 Grid -ReadOnly vCustomFavorites1 g_DoubleClick,名称|常用工具列表: ( 双击删除该项值!)
Gui,ListView,CustomFavorites1
IniRead,str,Settings\%ProjectSelect%.ini, ToolsCustom
Loop, Parse, str, `n, `r
{
RegExMatch(A_LoopField, "(\s*)(?P<key>.+?)(\s*?)=(\s*)(?P<value>.*?)\s*?$", _)
LV_Add("",_key,_value)
}
LV_ModifyCol(1)
Gui,CustomFavorites:Add,ListView,R20 w600 xs Grid -ReadOnly vCustomFavorites2 g_DoubleClick,名称|收藏夹列表: ( 双击删除该项值!)
Gui,ListView,CustomFavorites2
IniRead,str,Settings\%ProjectSelect%.ini, FavoritesCustom
Loop, Parse, str, `n, `r
{
RegExMatch(A_LoopField, "(\s*)(?P<key>.+?)(\s*?)=(\s*)(?P<value>.*?)\s*?$", _)
LV_Add("",_key,_value)
}
LV_ModifyCol(1)
Gui,CustomFavorites:Show,,修改或添加列表
return
}
Else If A_ThisMenuItem=深夜等游戏…
{
SetTimer,CheckGameList,1000
Menu, GameListMenu, Add, 开始, GameListMenuLabel
Menu, GameListMenu, Add, 退出, GameListGuiClose
Gui,GameList:new
Gui,GameList:-Caption +AlwaysOnTop +Border +HwndGameListhwnd
Gui,GameList:add,Checkbox,Section h25 vGameAssign gGameAssign,自动接受
;~ Gui,GameList:add,CheckBox,ys h25 checked,切换到游戏
Gui,GameList:add,Checkbox,ys h25 Checked,观察色
;~ Gui,GameList:add,Button,x+-0 yp+4 H15 W15 gGameListGuiClose,×
Gui, Add, StatusBar,vStatusBarStr ;,, Bar's starting text (omit to start off empty).
;~ SB_SetText("There are " . RowCount . " rows selected.")
;~ Gui,GameList:add,Text,xs vGameListN,当前人数:`t游戏数:
;~ Gui, GameList:Default
;~ MsgBox,x%GameListPosX% y%GameListPosY%
If ((A_ScreenWidth-GameListPosX<160) || (GameListPosX<1))
{
GameListPosX:=A_ScreenWidth-160
IniWrite,%GameListPosX%,Default.ini,Default,GameListPosX
}
If ((A_ScreenHeight-GameListPosY<60) || (GameListPosY<1))
{
GameListPosY:=A_ScreenHeight-100
IniWrite,%GameListPosY%,Default.ini,Default,GameListPosY
}
Gui,GameList:Show,h60 w160 x%GameListPosX% y%GameListPosY%
Hotkey,IfWinActive,ahk_id %GameListhwnd%
Hotkey,~LButton up,GameListLButtonUp
return
}
Else IfInString A_ThisMenuItem,自定按钮
{
StringRight,CustomButton,A_ThisMenuItem,1
Gui,CustomButton:+Owner1
Gui +Disabled
Gui,CustomButton:Default
Gui,CustomButton:Font, cblue s8 宋体
Gui,CustomButton:Add,ListView,w400 Checked Grid -ReadOnly vLVCustomButton1 g_DoubleClick,鼠标左键列表:
Gui,CustomButton:Add,Text,xs Section,多个程序同时启动+延时:
Gui,CustomButton:Add,Edit,x+1 ys-2 h15 w40 vCustomButton延迟,%CustomButton延迟%
Gui,CustomButton:Add,Text,ys cGreen ,按钮名:
Gui,CustomButton:Add,Edit,x+1 ys-1 h15 w90 vCustomButton%CustomButton%,% CustomButton%CustomButton%
Gui,CustomButton:Add,Text,ys cred,双击删除该项值!
Gui,CustomButton:Add,ListView,w400 xs y+6 Checked Grid -ReadOnly vLVCustomButton2 g_DoubleClick,鼠标右键列表:
Loop,2
{
Gui,ListView,LVCustomButton%A_Index%
Loop Parse,LVCustomButton%CustomButton%_%A_Index%,CSV
{
StringGetPos,n,A_LoopField,=,R
StringLeft,m,A_LoopField,n
; MsgBox,%m%
StringRight,n,A_LoopField,1
If n=1
LV_Add("Check",m)
Else
LV_Add("",m)
}
IfNotInString LVCustomButton%CustomButton%_%A_Index%,可输入网址
LV_Add("","可输入网址")
LV_ModifyCol()
}
Gui,CustomButton:Show,,请拖入程序或(粘贴/输入)网址
return
GameAssign:
GuiControlGet,GameAssign
return
GameListGuiClose:
SetTimer,CheckGameList,Off
Gui, GameList:Default
;~ MsgBox,%A_GuiX%
WinGetPos,GameListPosX,GameListPosY,,,A
IniWrite,%GameListPosX%,Default.ini,Default,GameListPosX
IniWrite,%GameListPosY%,Default.ini,Default,GameListPosY
Gui,Destroy
Gui, 1:Default
return
GameListLButtonUp:
WinGetPos,GameListPosX,GameListPosY,,,ahk_id %GameListhwnd%
IniWrite,%GameListPosX%,Default.ini,Default,GameListPosX
IniWrite,%GameListPosY%,Default.ini,Default,GameListPosY
return
GameListGuiContextMenu:
Menu,GameListMenu,show
return
GameListMenuLabel: ;{ --
GameListJoin:=!GameListJoin
If GameListJoin=1
{
SetTimer,CheckGameList,1000
Menu,GameListMenu,Rename,开始,取消
}
Else
Menu,GameListMenu,Rename,取消,开始
return ;}
CheckGameList:
;~ if GameFrame1=3
If GameFrame1<1
{
Loop 5
{
ControlGetPos,X,Y,W,H,ListBox%A_Index%,ahk_class Red Alert 2,Gui:Players
If (W=204 || W=224) ;游戏列表
{
ListBoxGameList=ListBox%A_Index%
;~ If W=204
;~ {
;~ X+=214
;~ Y+=H-30
;~ ControlClick, x%X% y%Y%,ahk_class Red Alert 2,,,1, NA
;~ }
}
If (W=195 || W=215) ;ID列表
{
ListBoxIDList=ListBox%A_Index%
}
}
SendMessage, 390, 0, 0, %ListBoxGameList%, ahk_class Red Alert 2 ; LB_SETCURSEL = 390 - position 'one'选择首行
SendMessage, 0x18b, 0, 0, %ListBoxGameList%, ahk_class Red Alert 2 ; 0x18b is LB_GETCount (for a ListBox).计算行数
GameListN:=ErrorLevel-1
SendMessage, 0x18b, 0, 0, %ListBoxIDList%, ahk_class Red Alert 2 ; 0x18b is LB_GETCount (for a ListBox).
IDListN:=ErrorLevel
StatusBarStr=大厅人数: %IDListN% 游戏数: %GameListN%
;~ tooltip,%GameListN%
Gui, GameList:Default
SB_SetText(StatusBarStr)
;~ MsgBox,%str%
;~ Guicontrol,,GameListN,当前人数: %IDListN%`t游戏数: %GameListN%
if( GameListJoin=1 && (IDListN<>IDListN_))
{
;~ tooltip,有
SoundPlay,Sound\Click.wav
IDListN_:=IDListN
SendMessage, 0x18b, 0, 0, %ListBoxGameList%, ahk_class Red Alert 2 ; 0x18b is LB_GETCount (for a ListBox).计算行数
SendMessage, 390, (ErrorLevel-1), 0, %ListBoxGameList%, ahk_class Red Alert 2 ; LB_SETCURSEL = 390 - position ' one'
ControlClick,Gui:Join,ahk_class Red Alert 2,,,1,NA
SetTimer,WinActivateRa2,500
WinWait,ahk_class Red Alert 2,Gui:OK,0.5
If !ErrorLevel
ControlSend,Gui:OK,{Space},ahk_class Red Alert 2
WinWait,ahk_class Red Alert 2,Gui:None,1
If !ErrorLevel
{
;~ tooltip,有
;~ WinActivate,ahk_class Red Alert 2
;~ SetTimer,WinActivateRa2,500
If GameAssign=1
ControlClick,Gui:Assign,ahk_class Red Alert 2,,,1,NA
;~ if GameFrame1=1
SetTimer,CheckGameList,Off
Menu,GameListMenu,Rename,取消,开始
GameListJoin:=!GameListJoin
;~ WinGetPos,GameListPosX,GameListPosY,,,A
;~ IniWrite,%GameListPosX%,Default.ini,Default,GameListPosX
;~ IniWrite,%GameListPosY%,Default.ini,Default,GameListPosY
}
}
}
return
_DoubleClick:
Gui,ListView,%A_GuiControl%
;~ ToolTip,%A_GuiControl%
If A_GuiEvent=DoubleClick
{
LV_GetText(OutputVar, A_EventInfo,1)
If % LV_Delete(A_EventInfo)
{
If A_GuiControl=CustomFavorites1
Menu, ToolsMenu,Delete , %OutputVar%
If A_GuiControl=CustomFavorites2
Menu, FavoritesMenu,Delete , %OutputVar%
}
}
return
ToolsCustom:
Gui,Submit,NoHide
If ToolsCustom
{
IniWrite,%Tools%,Settings\%ProjectSelect%.ini, ToolsCustom,%ToolsCustom%
Menu, ToolsMenu, Add,%ToolsCustom%, RunToolsMenu
}
Else
{
IniWrite,%Tools%,Settings\%ProjectSelect%.ini, ToolsCustom,%Tools%
Menu, ToolsMenu, Add, %Tools%, RunToolsMenu
}
FavoritesCustom:
Gui,Submit,NoHide
If FavoritesCustom
{
IniWrite,%Favorites%,Settings\%ProjectSelect%.ini, FavoritesCustom,%FavoritesCustom%
Menu, FavoritesMenu, Add, %FavoritesCustom%, RunFavoritesMenu
}
Else
{
IniWrite,%Favorites%,Settings\%ProjectSelect%.ini, FavoritesCustom,%Favorites%
Menu, FavoritesMenu, Add, %Favorites%, RunFavoritesMenu
}
ToolsGuiClose:
FavoritesGuiClose:
Gui, 1:-Disabled
Gui Destroy
Gui, 1:Default
return
CustomButtonGuiClose:
Gui,Submit,NoHide
Loop,2
{
n:=A_Index
Gui,ListView,LVCustomButton%n%
IniDelete,Settings\%ProjectSelect%.ini, Default,LVCustomButton%CustomButton%_%n%
str=
Loop % LV_GetCount()
{
LV_GetText(LVText, A_Index)
SendMessage, 4140, A_Index-1, 0xF000, SysListView32%n%
IsChecked := (ErrorLevel >> 12) - 1
; MsgBox,% LVText . "=" . IsChecked
str.=LVText . "=" . IsChecked . ","
}
; MsgBox,%str%
StringTrimRight,LVCustomButton%CustomButton%_%A_Index%,str,1
; MsgBox,% LVCustomButton%CustomButton%_%A_Index%
IniWrite,% LVCustomButton%CustomButton%_%A_Index%,Settings\%ProjectSelect%.ini, Default,LVCustomButton%CustomButton%_%A_Index%
}
Gui, 1:-Disabled
Gui Destroy
Gui, 1:Default
GuiControl,,CustomButton%CustomButton%,% CustomButton%CustomButton%
IniWrite,% CustomButton%CustomButton%,Settings\%ProjectSelect%.ini, Default,CustomButton%CustomButton%
IniWrite,%CustomButton延迟%,Settings\%ProjectSelect%.ini, Default,CustomButton延迟
return
CustomFavoritesGuiClose:
Gui,Submit,NoHide
Gui,ListView,CustomFavorites1
IniDelete,Settings\%ProjectSelect%.ini,ToolsCustom
Loop % LV_GetCount()
{
LV_GetText(LVText1, A_Index,1)
LV_GetText(LVText2, A_Index,2)
IniWrite,%LVText2%,Settings\%ProjectSelect%.ini, ToolsCustom,%LVText1%
}
Gui,ListView,CustomFavorites2
IniDelete,Settings\%ProjectSelect%.ini,FavoritesCustom
Loop % LV_GetCount()
{
LV_GetText(LVText1, A_Index,1)
LV_GetText(LVText2, A_Index,2)
IniWrite,%LVText2%,Settings\%ProjectSelect%.ini, FavoritesCustom,%LVText1%
}
Gui, 1:-Disabled
Gui Destroy
Gui, 1:Default
return
}
Else If A_ThisMenuItem=全部删除
gosub,Filesearch
Else If A_ThisMenuItem=&备份和恢复
{
}
Else If A_ThisMenuItem=&添加工具
{
Gui,Tools:+Owner1 AlwaysOnTop
Gui,+Disabled
Gui,Tools:Default
Gui,Tools:Add,Text,,地址:
Gui,Tools:Add,Edit,ys w300 vTools
Gui,Tools:Add,Text,xs Section,名称:
Gui,Tools:Add,Edit,ys w205 vToolsCustom
Gui,Tools:Add,Button,ys gToolsCustom,保存
Gui,Tools:Add,Button,ys gToolsGuiClose,取消
Gui,Tools:Show,,可直接拖入程序文件
return
}
Else If A_ThisMenuItem=&添加收藏
{
Gui,Favorites:+Owner1 +AlwaysOnTop
Gui,+Disabled
Gui,Favorites:Default
Gui,Favorites:Add,Text,,地址:
Gui,Favorites:Add,Edit,ys w300 vFavorites
Gui,Favorites:Add,Text,xs Section,名称:
Gui,Favorites:Add,Edit,ys w205 vFavoritesCustom
Gui,Favorites:Add,Button,ys gFavoritesCustom,保存
Gui,Favorites:Add,Button,ys gFavoritesGuiClose,取消
Gui,Favorites:Show,,请输入网址或地址~
return
}
Else
MsgBox,呃.......没有关于 ^_~
return
;---------------------------Gui子程序---------------------------;
CustomButtonGuiDropFiles: ;{ --
IfInString,A_GuiControl,LVCustomButton
{
StringRight, n,A_GuiControl, 1
Gui,ListView,LVCustomButton%n%
SplitFileNameIcon(A_GuiEvent)
LV_Add("Check",A_GuiEvent)
LV_ModifyCol()
}
return ;}
ToolsGuiDropFiles:
FavoritesGuiDropFiles: ;{ --
If (A_GuiControl="Tools")
{
GuiControl,,Tools,%A_GuiEvent%
GuiControl,Focus,ToolsCustom
}
return ;}
GuiDropFiles: ;{ --
;~ MsgBox,8
If (A_GuiControl="CustomButton1")
{
Gui,ListView,CustomButton1L
SplitFileNameIcon(A_GuiEvent)
LV_Add("Check",A_GuiEvent)
; IniWrite, %OutNameNoExt%=%A_GuiEvent%,Default.ini, Program,P%RowCount%
}
If (A_GuiControl="ListViewShortCut")
{
;~ MsgBox,8
Gui, ListView, ListViewShortCut
SplitFileNameIcon(A_GuiEvent)
;~ MsgBox,% A_GuiEvent
SplitPath, A_GuiEvent, ,,, OutNameNoExt
;~ OutNameNoExt:=RegExReplace(OutNameNoExt, "[.-\s]", "")
LV_Add("Icon" . IconNumber,OutNameNoExt,A_GuiEvent)
LV_ModifyCol()
RowCount:=LV_GetCount()
IniWrite, %OutNameNoExt%=%A_GuiEvent%,Settings\%ProjectSelect%.ini, Program,P%RowCount%
}
return ;}
CustomFavoritesGuiSize: ;{ --
;对窗口调整大小, 最小化, 最大化或还原时自动运行此子程序. 内置变量 A_GuiWidth 和 A_GuiHeight 分别包含了窗口工作区调整后的宽度和高度, 窗口工作区不包括标题栏, 菜单栏和边框. 此外, A_EventInfo 和 ErrorLevel 将同时包含下列数字的其中一个:
;0: 窗口被还原或通过拖拉窗口边缘这样正常调节过大小时.
;1: 窗口被最小化了.
;2: 窗口被最大化了.
w:=A_GuiWidth-20
h:=A_GuiHeight/2
;~ loop,2
GuiControl,Move,CustomFavorites1,% "w" w "h" h-5
GuiControl,Move,CustomFavorites2,% "y" h+5 "w" w "h" h-10
return ;}
MyContextMenu:
Gui, ListView, ListViewShortCut
FocusedRowNumber := LV_GetNext(0, "F")
If not FocusedRowNumber
return
RowCount:=LV_GetCount()
LV_GetText(CustomName, FocusedRowNumber, 1)
LV_GetText(FileName, FocusedRowNumber, 2)
LV_GetText(Num, FocusedRowNumber, 3)
;~ MsgBox,% FileName
If A_ThisMenuItem=运行
Run,%FileName% %WinRunStr%,, UseErrorLevel
Else If (A_ThisMenuItem="上移一格" && FocusedRowNumber>1)
{
n:=FocusedRowNumber-1
SplitFileNameIcon(FileName)
LV_Delete(FocusedRowNumber)
LV_Insert(n,"Icon" . IconNumber,CustomName,FileName)
IniRead,str1,Settings\%ProjectSelect%.ini,program,P%n%
IniRead,str2,Settings\%ProjectSelect%.ini,program,P%FocusedRowNumber%
IniWrite,%str1%,Settings\%ProjectSelect%.ini,program,P%FocusedRowNumber%
IniWrite,%str2%,Settings\%ProjectSelect%.ini,program,P%n%
str:=ViewTypeArray%ViewChoise%
If str=IconSmall
m=Icon
Else
m=Report
GuiControl,+%m%,ListViewShortCut
GuiControl,+%str%,ListViewShortCut
; GuiControl, +Redraw,ListViewShortCut
}
Else If ((A_ThisMenuItem="下移一格") && (FocusedRowNumber<RowCount))
{
n:=FocusedRowNumber+1
SplitFileNameIcon(FileName)
LV_Delete(FocusedRowNumber)
LV_Insert(n,"Icon" . IconNumber,CustomName,FileName)
IniRead,str1,Settings\%ProjectSelect%.ini,program,P%n%
IniRead,str2,Settings\%ProjectSelect%.ini,program,P%FocusedRowNumber%
IniWrite,%str1%,Settings\%ProjectSelect%.ini,program,P%FocusedRowNumber%
IniWrite,%str2%,Settings\%ProjectSelect%.ini,program,P%n%
str:=ViewTypeArray%ViewChoise%
If str=IconSmall
m=Icon
Else
m=Report
GuiControl,+%m%,ListViewShortCut
GuiControl,+%str%,ListViewShortCut
}
Else If A_ThisMenuItem=打开目录
Run,explorer.exe /select `, %FileName%,, UseErrorLevel
Else IfInString A_ThisMenuItem,复制文件路径
Clipboard:=FileName
Else If A_ThisMenuItem=设为主要红警
{
;~ MsgBox,% FileName
;~ Ra2Dir:=FileName
;~ IniWrite,%FileName%,Settings\%ProjectSelect%.ini,Default,设为主要红警
;~ Menu,MyContextMenuRa2,Rename, 设为主要红警,主要红警
;~ Menu,MyContextMenuRa2,Check, 主要红警
;~ Menu,MyContextMenuRa2,Default, 主要红警
StringReplace,Ra2Dir,FileName,\ra2.exe
IniWrite,%Ra2Dir%,Settings\%ProjectSelect%.ini,Default,Ra2Dir
GuiControl,,Ra2Dir,%Ra2Dir%
Gui,TreeView,HKTree1
TV_Delete()
;~ MsgBox,%Ra2Dir%
gosub,HKTree1Label
}
Else If A_ThisMenuItem=设为QQ平台红警
{
If QQBattleZoneDir
IniWrite %FileName%,%QQBattleZoneDir%\QBGames.ini,Game10,Exe
Else
{
MsgBox,4096,没有找到QQ平台!
return
}
}
Else If A_ThisMenuItem=删除
{
LV_Delete(FocusedRowNumber)
;~ MsgBox,%CustomName%
Count:=RowCount-FocusedRowNumber
Loop %Count%
{
n:=FocusedRowNumber+A_Index
IniRead,str,Settings\%ProjectSelect%.ini,program,P%n%
;~ MsgBox,%str%=%n%
n-=1
IniWrite,%str%,Settings\%ProjectSelect%.ini,program,P%n%
;~ MsgBox,%str%=%n%
}
IniDelete,Settings\%ProjectSelect%.ini,program,P%RowCount%
}
Else IfInString A_ThisMenuItem,属性
Run Properties "%FileName%",, UseErrorLevel
Else If A_ThisMenu=SubMenu分辨率
{
;~ tooltip,%A_GuiEvent%
IfInString A_ThisMenuItem,管理分辨率
{
;~ MsgBox %OutputVar%%Ra2Resolution%
Gui +OwnDialogs
;~ IniRead, 游戏分辨率,Default.ini, Default,游戏分辨率
InputBox, OutputVar , 快速分辨率菜单管理,注意书写格式:%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%斜杠"/"分组%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%星号"*"隔开,, ,130,, , , , %Ra2Resolution%
If !ErrorLevel
{
IniWrite,% RegExReplace(OutputVar, "[^\\/\*\d]", ""),Default.ini, Default,游戏分辨率\
Reload
}
;~ str=0123456789,*
;~ OutputVar=123*,----
;~ m:=0
;~ Loop,parse,OutputVar
;~ {
;~ i:=A_LoopField
;~ Loop,parse,str
;~ {
;~ n:=1
;~ if (A_LoopField=i)
;~ {
;~ n:=0
;~ break
;~ }
;~ }
;~ m+=n
;~ }
;~ MsgBox,%m%
}
Else
{
StringGetPos, pos, A_ThisMenuItem,*
StringLeft,RedScreenX,A_ThisMenuItem,%pos%
StringLen,OutputVar,A_ThisMenuItem
pos:=OutputVar-pos-1
StringRight,RedScreenY,A_ThisMenuItem,%pos%
GuiControl,,RedScreenX,%RedScreenX%
GuiControl,,RedScreenY,%RedScreenY%
}
}
Else If A_ThisMenu=SubMenu游戏常用ID
{
;~ tooltip,%A_GuiEvent%
IfInString A_ThisMenuItem,管理游戏ID列表
{
Gui +OwnDialogs
;~ IniRead, 游戏分辨率,Default.ini, Default,游戏分辨率
InputBox, OutputVar , 游戏ID列表管理,注意书写格式:%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%斜杠"/"分组,, ,130,, , , , %MultiPlayer%
If !ErrorLevel
{
Loop,Parse,MultiPlayer,/\
IniRead,%A_LoopField%,Settings\%ProjectSelect%.ini,MultiPlayer,%A_LoopField%
IniDelete,Settings\%ProjectSelect%.ini,MultiPlayer
Loop,Parse,OutputVar,/\
{
RegExReplace(A_LoopField, "[^\w#_@$]", "")
IniWrite,% %A_LoopField%,Settings\%ProjectSelect%.ini,MultiPlayer,%A_LoopField%
}
}
;~ str=0123456789,*
;~ OutputVar=123*,----123 234
;~ m:=0
;~ Loop,parse,OutputVar
;~ {
;~ i:=A_LoopField
;~ Loop,parse,str
;~ {
;~ n:=1
;~ if (A_LoopField=i)
;~ {
;~ n:=0
;~ break
;~ }
;~ }
;~ m+=n
;~ }
;~ MsgBox,%m%
}
Else
{
StringGetPos, pos, A_ThisMenuItem,*
StringLeft,RedScreenX,A_ThisMenuItem,%pos%
StringLen,OutputVar,A_ThisMenuItem
pos:=OutputVar-pos-1
StringRight,RedScreenY,A_ThisMenuItem,%pos%
GuiControl,,RedScreenX,%RedScreenX%
GuiControl,,RedScreenY,%RedScreenY%
}
}
Else If ErrorLevel
MsgBox 无法执行此操作 "%FileName%".
return
}
Loop
{
FormatTime, OutputVar , ,HH:mm
Loop 5
{
ControlGetPos,,,W,,ListBox%A_Index%,ahk_class Red Alert 2,Gui:Players
;~ If (W=204 || W=224) ;游戏列表
;~ If (W=195 || W=215) ;ID列表
If W=135 ;游戏ID
{
ControlGet, Rec, Hwnd,, ListBox%A_Index%,ahk_class Red Alert 2
;~ ControlSend,ListBox%A_Index%,{End}{Left}{BackSpace 5}%OutputVar%{End},ahk_class Red Alert 2
ControlSend,ListBox%A_Index%,{End}{Left}{BackSpace 5},ahk_class Red Alert 2
ControlSendRaw,ListBox%A_Index%,%OutputVar%,ahk_class Red Alert 2
;~ ListBoxGameID=ListBox%A_Index%
;~ If W=204
;~ {
;~ X+=214
;~ Y+=H-30
;~ Text=Some text ; Text for the control
;~ ToolTip % control
;~ SendMessage, 0x0C, 0, &Text, , ahk_id %control% ;
;~ ControlClick, x%X% y%Y%,ahk_class Red Alert 2,,,1, NA
;~ }
}
}
;~ ControlSend,ListBox1,{BackSpace 5}%OutputVar%,ahk_class Red Alert 2
Sleep,60000
}
;=====Gui界面===========================================================Gui界面================================================================;
CreateRa2GUI()
{
global
;~ While (r+g+b<384)
;~ {
Random,r,150,200
Random,g,150,225
Random,b,150,255
;~ }
SetFormat, integer, hex
r += 0
SetFormat, integer, D
SetFormat, integer, hex
g += 0
SetFormat, integer, D
SetFormat, integer, hex
b += 0
SetFormat, integer, D
StringRight,r,r,2
StringRight,g,g,2
StringRight,b,b,2
RandomColor=%r%%g%%b%
;~ Gui,-Caption
;~ RandomColor=fdb536 #96fd5c默认色 EEAA99这色不错
;~ RandomColor=EEAA99
;~ RandomColor=ffd282
;~ RandomColor=e8caef
;~ RandomColor=f8d9b2
ViewTypeArray:=ViewTypeArray%ViewChoise%
;~ MsgBox,%ViewTypeArray%%ViewChoise%
; Gui,GuiMain
; Gui,GuiMain
Gui, Color, %RandomColor%
Gui,Font
;~ Gui, +Owner ;+Resize
; Gui, Color, ffd282
; Gui +LastFound ; 让 GUI 窗口成为 上次找到的窗口 以用于下一行的命令.
; WinSet, TransColor, ffd282
;~ Gui,Font,s9,%CustomFont%
Gui,Font,s9,%CustomFont%
; Gui,+E0x40000
Gui, Add, Tab2,x10 y5 w485 h292 vMySubroutine gMySubroutine , 常用程序|红色警戒|按键设置|个性ID名|功能说明
Gui, Tab, 1
Gui, Add,ListView,xm+2 ym+23 Grid r20 w479 h212 -Multi -ReadOnly section +%ViewTypeArray% Backgrounda5e1b0 vListViewShortCut gListViewShortCut,* 名称|路径|No
Gui,ListView,ListViewShortCut
; LV_ModifyCol(3, "Integer") ; 为了排序, 表示 Size 列中的内容是整数.
;~ ImageListID1 := IL_Create(10)
;~ ImageListID2 := IL_Create(10, 10, true) ; 大图标列表和小图标列表.
ImageListID1 := IL_Create(50)
ImageListID2 := IL_Create(50, 50, True) ; A List of large icons to go with the small ones.
LV_SetImageList(ImageListID1)
LV_SetImageList(ImageListID2)
GuiControl, -Redraw,ListViewShortCut
;~ Lv_SetImageList(ImageListID2 := IL_Create(10,10,True))
Loop
{
IniRead,str,Settings\%ProjectSelect%.ini,Program,P%A_Index%
If str=ERROR
{
If A_Index=1
ProgramCheck=1
break
}
StringGetPos, n,str,=
StringTrimLeft,ProgramDir,str,n+1
StringLeft,ProgramName,str,n
GetIcon_From_FileName(ProgramDir)
LV_Add("Icon" . IconNumber, ProgramName,ProgramDir,A_Index)
;~ MsgBox %ProgramDir%
;~ i:=A_Index+IconNumber
;~ MsgBox,%A_Index%+%IconNumber%=%i%
;~ LV_Add("Icon" . i, ProgramName,ProgramDir,A_Index)
;~ IL_Add(ImageListID2, ProgramDir,ProgramDir, i)
;~ SplitFileNameIcon(ProgramDir)
}
/*
Loop
{
IniRead,str,Default.ini,Program,P%A_Index%
If str=ERROR
{
If A_Index=1
ProgramCheck=1
break
}
StringGetPos, n,str,=
StringTrimLeft,ProgramDir,str,n+1
StringLeft,ProgramName,str,n
SplitFileNameIcon(ProgramDir)
LV_Add("Icon" . IconNumber, ProgramName,ProgramDir,A_Index)
;~ If (ProgramDir=Ra2Dir)
;~ {
;~ LV_Modify(%A_Index%, "Check")
;~ }
;~ else
}
*/
LV_ModifyCol(1)
LV_ModifyCol(2)
LV_ModifyCol(3)
GuiControl, +Redraw,ListViewShortCut
Loop,HKEY_CURRENT_USER,Keyboard Layout\Preload, 1, 1
{
RegRead,Layout
RegRead,IMEName,HKEY_LOCAL_MACHINE,SYSTEM\CurrentControlSet\Control\Keyboard Layouts\%Layout%,Layout Text
RegRead,Layout
IME_List.=IMEName . "|"
Layout:=DllCall("LoadKeyboardLayout", "Str", Layout, "UInt", 1,"Uint")
IMEList_%A_Index%:=Layout
IMEName%Layout%:=IMEName
;~ MsgBox,%Layout%
;~ MsgBox,%IMEName%
}
if IME_CN=Error
{
Loop
{
if IMEList_%A_Index%=
Break
IME_CN:=IMEList_%A_Index%
IME_CNname=% IMEName%IME_CN%
;~ MsgBox,%IME_CNname%
IfInString,IME_CNname,中文
{
IfNotInString,IME_CNname,美式
{
IniWrite, %IME_CN%,settings\%ProjectSelect%.ini, Default,IME_CN
break
}
}
;~ MsgBox,%IME_CNname%
;~ IniWrite, %IME_CN%,settings\%ProjectSelect%.ini, Default,IME_CN
}
}
;~ Gui, Add, Text ,xm+3 ym+295 g桌面分辨率, 桌面分辨率:
;~ Gui, Add, DropDownList,xm+79 ym+290 w87 ,1920x1080||
;~ Gui, Add, DropDownList,x+3 yp w50 ,32位||
;~ Gui, Add, DropDownList,x+3 yp w53 ,60Hz||
Gui, Font,cBlue s9 ;S9 Norm
;~ Gui,Font,,宋体
;~ Gui, Add, Checkbox ,xs+5 section h17 vCheckBoxIME_SW gCheckBoxIME_SW,切换输入法:
;~ Gui, Add, DropDownList,AltSubmit ys-4 xm+99 w205 vIME_Choice gIME_Choice,%IME_List%
Gui, Add, Button,xm+3 ym+238 h23 w74 vCustomButton1 gCustomButton,%CustomButton1%
Gui, Add, Button,xp ym+264 h23 w74 vCustomButton2 gCustomButton,%CustomButton2%
Gui, Add, DropDownList,AltSubmit xm+80 ym+237 w180 vIME_Choice gIME_Choice,%IME_List%
Gui, Add, Text,x+5 yp+3 gWebsiteQQBBS, 【QQ平台论坛】
Gui, Add, Checkbox,check3 x+5 yp w15 h15 vdisplayHIDDEN gdisplayHIDDEN
Gui, Add, Text,x+3 yp vVersion gVersion w90 ;正在检查更新...
Gui, Add, DateTime,xm+80 ym+264 vMyDateTime w180 h23,%A_Space%yyyy年M月dd日(ddd)
Gui, Add, Button,x+8 yp h23 w50 gSystemHandler_,定时器
Gui, Add, Button,x+5 yp w98 h23 vCustomButton3 gCustomButton,%CustomButton3%
Gui, Add, Button,x+5 yp w50 h23 vCustomButton4 gCustomButton,%CustomButton4%
;~ Gui, Color, MyDateTime, blue
Gui, Font,Cdefault
EnumDisplaySettingsA()
Gui, Add, DropDownList,xm+2 ym+294 w87 vdisplay_wh gdisplay_,%Display_WH%
Gui, Add, DropDownList,x+3 yp w50 vDisplay_BIT gDisplay_,%Display_BIT%
Gui, Add, DropDownList,x+3 yp w53 vDisplay_Hz gDisplay_,%Display_Hz%
Gui, Add, Checkbox,xm+205 ym+297 vQQWinRun gQQWinRun,QQ平台窗口化
;~ Gui, Add, Text ,xm+300 ym+295 section g桌面分辨率, 游戏分辨率
Gui, Add,ComboBox,x+0 ym+294 w87 vDisplay_Ra2 gDisplay_Ra2,%Display_Ra2%
;~ GuiControl, Move, Display_Ra2,h10
;~ Gui, Add, Edit ,x+0 ys-2 h18 w35 Center vRedScreenX gRedScreenX Limit4 Number
;~ Gui, Add, Text ,x+3 ys, *
;~ Gui, Add, Edit ,x+3 ys-2 h18 w35 Center vRedScreenY gRedScreenY Limit4 Number
Gui, Add, Checkbox,x+0 ym+297 right vWinRun gWinRun,红警窗口化
Gui, Add,Button,xm+305 ym+2 w18 h20 gListViewType,▓
;~ Gui, Font,cBlue s9 ;S9 Norm
;~ Gui, Add, Text,xm+335 ym+237 gWebsiteQQBBS section, 【QQ平台论坛】
;~ Gui, Add, Button,xm+428 ym+235 w50 h23 vCustomButton4 gCustomButton,%CustomButton4%
;~ Gui, Add, Text,xm+385 ym+262,更新:13.01.05
;~ Gui, Add, DropDownList,xm+340 ym+235 w87 ,1920x1080||
;~ Gui, Add, DropDownList,x+3 yp w50 ,32位||
;~ Gui, Add, DateTime,xm+99 ym+262 section vMyDateTime w205 Section,%A_Space%yyyy年M月dd日(ddd)
;~ Gui, Add, Button,xm+98 ym+290 h23 w74 section vCustomButton1 gCustomButton,%CustomButton1%
;~ Gui, Add, Button,ys x+4 h23 w50 gSystemHandler_,定时器
;~ Gui, Add, Button,ys x+4 section h23 w74 vCustomButton2 gCustomButton,%CustomButton2%
;~ Gui, Add, Button,xm+310 ys w98 h23 vCustomButton3 gCustomButton,%CustomButton3%
;~ Gui, Add,Button,xm+427 ym+262 w50 h23,分辨率
;~ Gui, Add, Button,xm+412 ym+290 w65 h23 vCustomButton4 gCustomButton,%CustomButton4%
;~ Gui, Add, Text ,xm+320 ym+240 section g桌面分辨率, 游戏分辨率
;~ Gui, Add, Edit ,ys-2 h18 w35 Center vRedScreenX gRedScreenX Limit4 Number
;~ Gui, Add, Text ,x+3 ys, *
;~ Gui, Add, Edit ,x+3 ys-2 h18 w35 Center vRedScreenY gRedScreenY Limit4 Number
;~ Gui, Add, Text,xm+320 ym+265 section,红警+QQ平台窗口化
;~ Gui, Add, Checkbox,xm+285 ym+265 check3 vWinRun gWinRun,红警窗口化
;~ Gui, Add, Checkbox,xm+310 ym+240 section vWinRun gWinRun,红警窗口化
;~ Gui, Add, Edit ,x+0 ys-2 h18 w35 Center vRedScreenX gRedScreenX Limit4 Number
;~ Gui, Add, Text ,x+3 ys, x
;~ Gui, Add, Edit ,x+3 ys-2 h18 w35 Center vRedScreenY gRedScreenY Limit4 Number
;~ Gui, Add, Checkbox,xm+310 ym+265 vQQWinRun,QQ平台窗口
;~ Gui, Add, Text,xm+1 ym+265 gWebsiteQQBBS section, 【QQ平台论坛】
;~ Gui, Add, Text,xm+1 ym+293 gWebsiteCNBBS, 【联谊红警论坛】
;~ Gui, Add, Button,xm+237 ym+258 section h20 w72 vCustomButton1 gCustomButton,%CustomButton1%
;~ Gui, Add, Button,xs y+4 section h20 w72 vCustomButton2 gCustomButton,%CustomButton2%
;~ Gui, Add, Button,ys h19,QQ平台启动游戏
;~ Gui, Add, Button,xm+450 ym+283 h18 gWinHiddenWindows,↘
Gui, Tab, 2
CreateRa2GUI_Tab_2()
Gui, Tab, 3
CreateRa2GUI_Tab_3()
Gui, Tab, 4
;;--------A0 是空格
Gui,Font,s10 cdefault
Gui, Add,Text,xm+9 ym+30,红警游戏ID:
IniRead,Handle,%Ra2Dir%\ra2.ini,MultiPlayer,Handle
GameIDStr=
loop,parse,Handle,CSV
GameIDStr.=Chr(hex2dec("0x" . A_LoopField))
Gui, Add,Edit,x+3 yp-1 h23 w200 Limit16 vGameIDStr hwndhwndGameIDStr,%GameIDStr%
Gui, add,Button,x+3 yp h23 vGameIDRadio,保存启用ID
Gui, add,Button,x+13 yp h23 Section,游戏ID列表
;~ Gui,Font,s8
;~ Gui, Add,text,x+33 ym-5,注: 部分效果仅游戏才显示
Gui,Font,s10
Gui,Add,ListView,x+33 ym-2 w145 h290 Grid v常用游戏ID列表 g常用游戏ID列表 Background%RandomColor%,拖动-删除|双击-添加
Gui,ListView,常用游戏ID列表
Loop,parse,Ra2Handle,|
{
Str=
loop,parse,A_LoopField,CSV
Str.=Chr(hex2dec("0x" . A_LoopField))
LV_Add("",Str)
}
Gui,Font,s13
Gui, Add, Picture,xm+4 ym+56 section w475 h-1 vGameIDPic gGameIDPic,Images\128-159.png
n:=159
loop,6
{
n++
Gui, Add, Button,xs-1 y+1 w28 h28 v%n% gGameID,% chr(n)
loop,15
{
n++
Gui, Add, Button,x+2 w28 h28 v%n% gGameID,% chr(n)
}
}
;~ MsgBox,%n%
Gui, Tab, 5
Gui,Font
; NavBar=http://hi.baidu.com/cgx5871/item/5b28003ebc440223b3c0c530
; WB=http://hi.baidu.com/cgx5871/item/5b28003ebc440223b3c0c530
; Gui, Add, Custom, ClassToolbarWindow32 hwndhToolbar x0 y0 h23 w500 0x0800 0x0100 0x0040 0x0008 0x0004
; Gui, Add, Custom, ClassReBarWindow32 hwndhRebar gRB_Notifications 0x0200 0x0400 0x0040 0x8000
; Gui, Add, Combobox, hwndhNavBar vNavBar, http://www.autohotkey.com||http://www.autohotkey.com/board
WebURL=http://hi.baidu.com/cgx5871/item/5b28003ebc440223b3c0c530
;~ Gui, Show, , "www.YourTVSeri.es" Ahk_L TestNav.Navigate("www.yourtvseri.es")Nav.Silent := TrueReturn
Gui Add, ActiveX,xm-1 ym+24 vWB w%CurrentGuiSizeW% h%CurrentGuiSizeH%, Shell.Explorer ; 最后一个参数是 ActiveX 组件的名称.
Gui Add, Edit,ym-5 xm+485 w300 section r1 vWebURL, %WebURL%
Gui Add, Button,ys x+6 w30 h20 Default gGo, Go
;~ WB.Navigate(WebURL) ;有用
;~ RB.ShowBand(1) ;有用
; Gui Add, Button,ys x+6 w30 h20 Default gGoWebSite, Go
/*
While, WB.ReadyState != 4 ;等待网页加载完成http://hi.baidu.com/cgx5871/item/2acfe71b7785f00cd0d66d9e
sleep, 10
Gui, Add,Edit,c000080 w466 h270 VScroll ReadOnly vHelpText,%HelpText%
Gui, Font, CBlue Underline
*/
Gui, Tab
Gui,Font,s10 bold,楷体
Gui, Add, DropDownList,section ym-2 xm+365 w85 vProjectChoice gProjectChoice, %ProjectType%
Gui, Add, Text,ym+3 xm+327, 配置:
Gui,Font
Gui,Font,s9,宋体
Gui, Add, button,0x8000 ym-1 xm+455 h19 w25 gReload,√ ;√
;~ Hidewin_TT=隐藏于屏幕上方
Return
Version:
Run,http://pan.baidu.com/share/link?shareid=65739&uk=1896339698
return
;------------------子程序
IME_Choice:
Gui,Submit,NoHide
IME_CN:=IMEList_%IME_Choice%
IME_CNname=% IMEName%IME_CN%
; MsgBox,%IME_CNname%
IniWrite, %IME_CN%,settings\%ProjectSelect%.ini, Default,IME_CN
Return
常用游戏ID列表:
Gui,ListView,常用游戏ID列表
If A_GuiEvent=DoubleClick
{
LV_GetText(LVText, A_EventInfo,1)
GuiControl,,GameIDStr,%LVText%
}
if A_GuiEvent=D
{
LV_GetText(LVText, A_EventInfo,1)
MsgBox , 4097,确认删除,确定删除此ID?
IfMsgBox Cancel
return
Str=
loop,parse,LVText
{
;~ MsgBox,% Asc(A_LoopField)
n:=% dec2hex(Asc(A_LoopField))
StringTrimLeft,IDdec,n,2
Str.=IDdec . ","
}
Str=%Str%|
;~ MsgBox,%Str%
StringReplace,Ra2Handle,Ra2Handle,%Str%
IniWrite %Ra2Handle% ,settings\%ProjectSelect%.ini, Default,Ra2Handle
LV_Delete(A_EventInfo)
}
return
Button游戏ID列表:
游戏ID列表_++
if 游戏ID列表_=1
MsgBox , 4096,不知道这按钮有神马作用 ?
if 游戏ID列表_=2
MsgBox , 4096,这只是一个搞笑按钮 ^_~
if 游戏ID列表_=3
MsgBox , 4096,还点呀-_- 你蛋疼? ...小子
if 游戏ID列表_=4
MsgBox , 4096,真不死心...好吧, 我FU了You了~ 你想要什么?
if 游戏ID列表_=5
MsgBox , 4096,呃....再点你就死定了!
if 游戏ID列表_=6
{
MsgBox , 4096,看吧......知道出事了吧
gosub,【关闭红警】
If Not FileExist(Ra2DIR . "\ra2.exe")
Gosub FileSelectFolder红警目录
}
if 游戏ID列表_=7
{
MsgBox , 4096,还点呀! 你赢了~ 上游戏看看?
Handle=
m=131,132,134,135,137,138,140,141,146,147,148,149,153,154,155,156,159
loop,parse,m,CSV
{
str:=dec2hex(A_LoopField)
StringTrimLeft,str,str,2
Handle.=str . ","
}
Handle=01,%Handle%02,
;~ MsgBox,%Handle%
IniWrite,%Handle%,%Ra2Dir%\ra2.ini,MultiPlayer,Handle
IniWrite %游戏ID列表_% ,settings\%ProjectSelect%.ini, Default,游戏ID列表_
}
if 游戏ID列表_>7
MsgBox , 4096,不和你玩了~ 谢谢再见~
if 游戏ID列表_=12
{
MsgBox , 4096,呃.....你又来了...再给你一次机会吧
游戏ID列表_:=0
IniWrite %游戏ID列表_% ,settings\%ProjectSelect%.ini, Default,游戏ID列表_
}
return
Button保存启用ID:
GUI,SUBMIT,NOHIDE
;~ loop,5
;~ {
;~ controlgetpos,,,ra2width, ,ListBox%a_index%,ahk_class Red Alert 2
;~ If ra2width=135 ;ID框;~ If (i=442 || i=429)
;~ listbox135=ListBox%a_index%
;~ }
Handle=
loop,parse,GameIDStr
{
CK:=0
Loop 32
{
if (A_LOOPFIELD=GameIDPic%A_Index%)
{
CK:=A_Index+127
break
}
}
str:= ck>0 ? dec2hex(ck) : dec2hex(Asc(A_LoopField))
;~ if ck
;~ str:=% dec2hex(ck)
;~ else
;~ str:=% dec2hex(Asc(A_LoopField))
StringTrimLeft,IDdec,str,2
Handle.=IDdec . ","
}
IniWrite,%Handle%,%Ra2Dir%\ra2.ini,MultiPlayer,Handle
ck=0
Loop,parse,Ra2Handle,|
{
If (Handle=A_LoopField)
{
ck=1
break
}
}
if ck=0
{
;~ MsgBox,%Ra2Handle%
Ra2Handle.=Handle . "|"
IniWrite %Ra2Handle% ,settings\%ProjectSelect%.ini, Default,Ra2Handle
Gui,ListView,常用游戏ID列表
LV_Add("",GameIDStr)
}
Process, Exist, Game.exe
If ErrorLevel
SetTimer,GameIDChange,1000
Return
GameIDChange:
If GameFrame1=3
{
BlockInput,Send
SetKeyDelay,10
loop,5
{
controlgetpos,,,width, ,ListBox%a_index%,ahk_class Red Alert 2
If width=135 ;----- (i=442 || i=429)
{
listbox135=ListBox%a_index%
ControlGet, listboxHwnd135, Hwnd,, %listbox135%,ahk_class Red Alert 2
}
}
;~ winset,disable,,ahk_id %listboxHwnd135%
;~ winset,Region, 50-0 W200 H250 E,ahk_id %listboxHwnd135%
;~ WinHide,ahk_id %listboxHwnd135%
controlsend,%listbox135%,{End}{BackSpace 16},ahk_class Red Alert 2
Loop,parse,Handle,CSV
{
keystr=
Num:=hex2dec("0x" . A_LoopField)
if Num>127
Num:=hex2dec("0x" . A_LoopField . A_LoopField)
loop,parse,Num
keystr.="{Numpad" . A_LoopField . "}"
keystr={Alt Down}%keystr%{Alt Up}
ControlSend,%listbox135%,%keystr%,ahk_class Red Alert 2
if Num>127
controlsend,%listbox135%,{BackSpace},ahk_class Red Alert 2
}
SetTimer,GameIDChange,off
BlockInput,Off
}
Return
GameIDPic:
GuiControlGet, GameIDPic, Pos
;~ ControlGetPos , , , Width, Height,GameIDPic
;~ MsgBox,%GameIDPicW%=%GameIDPicH%
CoordMode,Mouse,Client
MouseGetPos,x,y
N:=Ceil((x-GameIDPicX)/(GameIDPicW/16))+Floor((y-GameIDPicY)/(GameIDPicH/2))*16
;~ GameIDPicN:=Ceil((x-GameIDPicX)/(GameIDPicW/16))+Floor((y-GameIDPicY)/(GameIDPicH/2))*16+127
Guicontrol,Focus,GameIDStr
Control, EditPaste,% GameIDPic%N%, %GameIDClassNN%
Return
GameID:
GUI,SUBMIT,NOHIDE
Guicontrol,Focus,GameIDStr
;~ GuiControlGet, OutputVar, Focus
;~ MsgBox,%A_GuiControl%
Control, EditPaste,% chr(A_GuiControl), %GameIDClassNN%
return
GoWebSite:
Gui, Submit, NoHide
WB.Navigate(NavBar)
IELoad(WB)
Gui, Show,, % WB.LocationName
return
Gui,submit,nohide
ComObjError(false)
WB.Silent:="True"
WebURL=http://hi.baidu.com/cgx5871/item/5b28003ebc440223b3c0c530
WB.Navigate(WebURL)
Return
;~ CheckBoxIME_SW:
;~ Gui,SubMit,NoHide
;~ IniWrite %CheckBoxIME_SW% ,settings\%ProjectSelect%.ini, Default,CheckBoxIME_SW
;~ If CheckBoxIME_SW=1
;~ {
;~ IME_CNname=% IMEName%IME_CN%
;~ GuIControL,Enable,IME_Choice
;~ Hotkey,ifwinactive,ahk_class Red Alert 2
;~ Hotkey,^Space,禁用按键,On
;~ }
;~ Else
;~ {
;~ GuIControL,Disable,IME_Choice
;~ Hotkey,ifwinactive,ahk_class Red Alert 2
;~ Hotkey,^Space,Off
;~ }
;~ Return
ListViewType:
Gui, ListView, ListViewShortCut
ViewChoise:=mod(ViewChoise,4)+1
;~ MsgBox,%ViewChoise%
str=% ViewTypeArray%ViewChoise%
GuiControl, +%str%, ListViewShortCut
IniWrite,%ViewChoise%,Settings\%ProjectSelect%.ini, Default,ViewChoise
LV_ModifyCol()
return
ListViewShortCut:
Critical
If A_GuiEvent=D
PostMessage, 0xA1, 2 ;关键是这行了
Gui, ListView, ListViewShortCut
;~ MsgBox,% FileName
LV_GetText(RowText3,A_EventInfo,3)
LV_GetText(RowText2,A_EventInfo,2)
LV_GetText(RowText1,A_EventInfo,1)
/*
If A_GuiEvent=I
{
MsgBox,%A_GuiEvent%
If ErrorLevel=C
{
IfNotInString,RowText2,\ra2.exe
{
;~ tooltip,%A_GuiEvent%
;~ If A_GuiEvent=ColClick
;~ {
;~ tooltip,只能勾选红警目录
;~ SetTimer,_tooltip,-1000
;~ }
LV_Modify(A_EventInfo, "-Check")
}
else
{
MsgBox,%RowText2%
IniWrite, %RowText2%,settings\%ProjectSelect%.ini, Default,红警选择
ListViewShortCutCount+=1
Loop % LV_GetCount()
{
If (A_Index<>A_EventInfo && !(ListViewShortCutCount&1))
LV_Modify(A_Index, "-Check")
}
SplitPath, RowText2, , OutDir
iniread,ScreenWidth,%OutDir%\ra2.ini,Video,ScreenWidth
GuiControl,,RedScreenX,%ScreenWidth%
iniread,ScreenHeight,%OutDir%\ra2.ini,Video,ScreenHeight
GuiControl,,RedScreenY,%ScreenHeight%
}
}
}
*/
If A_GuiEvent=e
{
IniWrite, %RowText1%=%RowText2%,Settings\%ProjectSelect%.ini, Program,P%RowText3%
}
If (A_GuiEvent = "DoubleClick")
Run,% RowText2 " " WinRun%WinRun%,, UseErrorLevel
return
ProjectChoice:
Gui,Submit,NoHide
If ProjectChoice=删除方案
{
if (ProjectSelect<>"默认配置" && ProjectSelect<>"Enigma")
{
;~ MsgBox,8
;~ MsgBox,%ProjectChoice%=%ProjectSelect%
;~ MsgBox,% ProjectType
MsgBox,4145,确认删除,删除配置方案: %ProjectSelect%?`n注: 可在<备份和恢复>或Settings文件夹中取回数据
IfMsgBox,Cancel
Return
FileMove,%A_ScriptDir%\Settings\%ProjectSelect%.ini,%A_ScriptDir%\Settings\复件-%ProjectSelect%.ini, 1
StringReplace,ProjectType, ProjectType,|%ProjectSelect%
;~ MsgBox,% ProjectType
;~ GuiControl,,ProjectChoice,%ProjectType%删除方案
GuiControl,,ProjectChoice,|%ProjectType%
GuiControl,Choose,ProjectChoice,默认配置
IniWrite,默认配置,Default.ini, Default,ProjectSelect
Return
}
else
GuiControl,Choose,ProjectChoice,%ProjectSelect%
return
}
Else If ProjectChoice=新建方案
{
Gui +OwnDialogs
;~ IniRead, 游戏分辨率,Default.ini, Default,游戏分辨率
InputBox, OutputVar , 配置方案管理,请填写名称:,, 100,125,, , , ,
if !ErrorLevel
{
If RegExMatch(OutputVar, "(^\d+$)")
OutputVar=_%OutputVar%
IfNotInString,ProjectType,|%OutputVar%|
FileAppend ,,Settings\%OutputVar%.ini
IniWrite,%OutputVar%,Default.ini, Default,ProjectSelect
;~ ProjectType.=OutputVar . "|"
;~ MsgBox,% ProjectType
;~ IniWrite,%ProjectType%,Default.ini, Default,ProjectType
;~ IniWrite,%OutputVar%,Default.ini, Default,ProjectChoice
;~ GuiControl,,ProjectChoice,|%ProjectType%删除方案
;~ GuiControl,Choose,ProjectChoice,%ProjectSelect%
;~ GuiControl,Choose,ProjectChoice,%OutputVar%
;~ ProjectSelect:=ProjectChoise
;~ GuiControl,,Hide,ProjectDel
;~ GuiControl,Show,ProjectAdd
;~ GuiControl,Show,ProjectEdit
;~ TrayTip, ,请输入方案名`n点击保存返回
;~ GuiControl,,ProjectEdit
;~ GuiControl,Focus,ProjectEdit
}
else
GuiControl,Choose,ProjectChoice,%ProjectSelect%
}
Else
{
ProjectSelect:=ProjectChoice
IniWrite,%ProjectSelect%,Default.ini, Default,ProjectSelect
}
Reload
return
}
CreateRa2GUI_Tab_2()
{
global
;~ Gui, Font,10,宋体
;~ MsgBox,%customfont%
Gui, Font,s10
Gui, Add, Text,xm+8 ym+32 Section,红警目录:
Gui, Add, GroupBox ,xp-3 y+-7 w473 h100
Gui, Add, Checkbox ,xs+2 yp+12 Section vRa2_Switch gSetRa2_Switch,共和国之辉<仿原版1006>
Gui, Add, Checkbox ,xs y+3 vRa2Move_Switch gRa2Move_Switch,持续按住部队 = 移动攻击
Gui, Add, Checkbox ,xs y+3 vReturnBack gReturnBack,右键返回
Gui, Add, Checkbox ,x+5 yp vLWin_Switch gLWin_Switch,禁用Win键
Gui, Add, Checkbox,xs y+3 vOpenObserve gOpenObserve,自动打开观察8
Gui, Add, Button,xs h25,地图全亮补丁
Gui, Add, Text,x+3 yp+3,注: 平台对战-必须双方都安装才能联机看到对方
Gui, Add, Button,xs y+6 h22 ,冰天雪地(全亮)图
Gui, Add, Text,x+3 yp+3,注: 游戏时会传送地图, 无须对方安装, 所有玩家地图全亮
Gui, Add, Text,xs y+5 cred,以上所有玩家都是全亮的, 公平作战【-因为开图高手太多,直接全图, 不喜请无视-】
Gui, Add, Button,xm+8 ym+226 h25 ,单机地图补丁
Gui, Add, Button,x+25 ym+226 h25 ,红警很卡补丁
Gui, Add, Button,x+25 ym+226 h25 ,蓝色皮肤
;~ Gui, Add, Text,x+18 yp+5 cBlue v联谊红警 gWebsite_, 【联谊红警‐原版论坛】
Gui, Add, Button,xs h25,游戏界面补丁
Gui, Add, Text,x+20 yp cBlue vYYShow gWebsite_, 【YY直播间‐红色警戒】
Gui, Add, Button,xm+390 ym+150 h25,简体字补丁
Gui, Add, Checkbox ,xm+200 ys Section vShiftClickBuild gShiftClickBuild,Shift+左键=快速建造
Gui, Add, Checkbox ,xs y+5 vLButtonClickBuild gLButtonClickBuild,按住左键 = 快速建造
Gui, Add, Text ,xs+20 y+5,建造数量:
Gui, Add, Edit,x+10 yp h20 w20 Center vClickBuildNum gClickBuildNum,%ClickBuildNum%
Gui, Add, Text ,x+10 yp,个
Gui, Add, Checkbox ,xs y+0 vRButtonRepair gRButtonRepair,右键 = 修理
Gui, Add, Text,xm+370 ys Section,密码房/。
Gui, Add, Edit,x+5 yp+1 h20 w38 vgamecode1 ggamecode1,%gamecode1%
Gui, Add, Text,xs y+2 Section,密码房/,
Gui, Add, Edit,x+5 yp h20 w38 vgamecode2 ggamecode2,%gamecode2%
Gui, Add, Text,y+3 xs+3 cred,注: // 清除密码
Gui, Add, Checkbox ,xs y+2 vClickOK gClickOK,自动点击确定
;~ Gui, Add, text ,xs ,Ctrl+F10快速设键
Gui, Add, Button,xm+285 ym+254 Section,保存键盘设置
Gui, Add, Button,x+5 yp,恢复键盘设置
Gui, Add, Checkbox ,check3 xp-30 yp-25 right vGameIDDisable gGameIDDisable,测试禁止修改ID:
Gui, Add, Edit,xm+70 ym+30 w320 h20 vRa2Dir,%Ra2Dir%
Gui,font,s9
Gui, Add, Button,x+4 yp gFileSelectFolder红警目录 h20 w35,浏览
Gui, Add, Button,x+10 yp gRa2DirEdit h20 w35,保存
;~ Gui, Add, Text,xm+8 ym+285 gWebsiteCNBBS section, 【互动论坛中心‐红警主论坛】
;~ Gui, Add, Text,ys gWebsiteQQBBS section, 【QQ平台论坛‐红色警戒】
;~ Gui, Add, Text,xm+370 ys gWebsiteFAQ,(﹍風の叹息﹍)
;~ Gui, Add, Edit,ys-2 h20 w38 vgamecode1 ggamecode1,%gamecode1%
;~ Gui, Add, Text,ys,密码房/,
;~ Gui, Add, Edit,ys-2 h20 w38 vgamecode2 ggamecode2,%gamecode2%
;~ Gui, Add, Text,xs cred,注: // 清除密码 /. 或/, 进入密码
Return
OpenObserve:
GameIDDisable:
gamecode1:
gamecode2:
_KeyDelay:
ScreenPosUpDown:
ReturnBack:
ShiftClickBuild:
LButtonClickBuild:
RButtonRepair:
ClickBuildNum:
Ra2Move_Switch:
ClickOK:
Gui,Submit,NoHide
;~ tooltip,% %A_ThisLabel%
IniWrite, % %A_ThisLabel%,settings\%ProjectSelect%.ini, Default,%A_ThisLabel%
Return
Button保存键盘设置:
if Ra2Dir=ERROR
gosub,FileSelectFolder红警目录
else
{
MsgBox 4129,保存键盘设置,当前红警目录:`n%Ra2Dir%`n确认当前保存键盘设置?
IfMsgBox,Cancel
Return
IniRead,str,%Ra2Dir%\Keyboard.ini,Hotkey
IniDelete,settings\%ProjectSelect%.ini ,Hotkey
IniWrite, %str%,settings\%ProjectSelect%.ini,Hotkey
TrayTip ,,按键已保存
}
Return
Button恢复键盘设置:
if Ra2Dir=ERROR
gosub,FileSelectFolder红警目录
else
{
IniRead,str,settings\%ProjectSelect%.ini,Hotkey
if str=error
{
MsgBox,4076,没找到备份按键,请先备份后再恢复
return
}
MsgBox 4145,恢复键盘设置,当前红警目录:%Ra2Dir%`n如果游戏已打开, 将自动关闭`n请按<确定>恢复已保存按键
IfMsgBox,Cancel
Return
Process, Exist, Game.exe
If ErrorLevel
Process Close,Game.exe
Process,WaitClose,Game.exe,3
Process,WaitClose,Ra2.exe,3
TrayTip ,,按键已恢复
Sleep,1000
IniDelete, %Ra2Dir%\Keyboard.ini,Hotkey
IniWrite, %str%,%Ra2Dir%\Keyboard.ini,Hotkey
}
Return
Ra2DirEdit:
Gui,Submit,NoHide
IniWrite, %Ra2Dir%,settings\%ProjectSelect%.ini, Default,Ra2Dir
Gui,TreeView,HKTree1
TV_Delete()
gosub,HKTree1Label
Return
LWin_Switch:
Gui,Submit,NoHide
If LWin_Switch
{
TrayTip ,,左Win键已禁用
Hotkey,ifwinactive,ahk_class Red Alert 2
Hotkey,LWin UP,禁用按键,On
;~ Hotkey,ifwinactive
;~ hotkey,#wheeldown,off
;~ hotkey,#wheelup,off
}
Else
{
TrayTip ,,左Win键已启用
Hotkey,ifwinactive,ahk_class Red Alert 2
Hotkey,LWin UP,Off
;~ Hotkey,ifwinactive
;~ hotkey,#wheeldown,on
;~ hotkey,#wheelup,on
}
IniWrite, %LWin_Switch%,settings\%ProjectSelect%.ini, Default,LWin_Switch
Return
禁用按键:
Return
Button地图全亮补丁:
If Not FileExist(Ra2DIR . "\ra2.exe")
Gosub FileSelectFolder红警目录
If FileExist(Ra2DIR . "\rules.ini")
{
MsgBox 4097,卸载地图全亮补丁,确认卸载地图全亮补丁?
IfMsgBox,Cancel
Return
FileDelete, %Ra2DIR%\rules.ini
}
Else
{
MsgBox 4100,安装地图全亮补丁,红警文件路径: %Ra2DIR%`n`n确认安装地图全亮补丁?`n说明:`n如果联机对战, 必须双方都装补丁`n再次点这按钮可以删除补丁!
IfMsgBox,No
Return
FileCopy, %A_ScriptDir%\Update\地图全亮补丁\rules.ini, %Ra2DIR%\
}
Return
Button简体字补丁:
If Not FileExist(Ra2DIR . "\ra2.exe")
Gosub FileSelectFolder红警目录
If FileExist(Ra2DIR . "\game.fnt")
{
MsgBox 4097,卸载简体补丁,确认卸载简体字补丁?
IfMsgBox,Cancel
Return
FileDelete, %Ra2DIR%\game.fnt
FileDelete, %Ra2DIR%\ra2.csf
FileDelete, %Ra2DIR%\ra2md.csf
}
Else
{
MsgBox 4100,安装简体补丁,红警文件路径: %Ra2DIR%`n`n确认安装简体字补丁?
IfMsgBox,No
Return
FileCopy, %A_ScriptDir%\Update\简体字补丁\game.fnt, %Ra2DIR%\
FileCopy, %A_ScriptDir%\Update\简体字补丁\ra2.csf, %Ra2DIR%\
FileCopy, %A_ScriptDir%\Update\简体字补丁\ra2md.csf, %Ra2DIR%\
FileCopy, %A_ScriptDir%\Update\简体字补丁\xwis.dll, %Ra2DIR%\
FileCopy, %A_ScriptDir%\Update\简体字补丁\xwis.mmx, %Ra2DIR%\
FileCopy, %A_ScriptDir%\Update\简体字补丁\xwis0.dll, %Ra2DIR%\
}
Return
/*
Button地图补丁:
IfInString,Ra2DIR,\ra2.exe
{
mpmodes++
FileDelete,%Ra2DIR%\mpmodes.ini
if (mpmodes&1)
{
FileAppend,
(
; Define the multiplayer game modes
; modeID=Name, rulesOverride, mapFilter, randomMapsAllowed
; Battle is "standard" multiplay with rules.ini changes for modified gameplay
; It is the only one that allows AI players.
[Battle]
1=GUI:Battle, STT:ModeBattle, MPBattle.ini, standard, true
3=GUI:Cooperative, STT:ModeCooperative, MPCoop.ini, cooperative, false
4=GUI:UnholyAlliance, STT:ModeUnholyAlliance, MPUnholy.ini, standard, false
2=GUI:FreeForAll, STT:ModeFreeForAll, MPFreeForAll.ini, standard, true
5=GUI:Megawealth, STT:ModeMegawealth, MPMW.ini, megawealth, false
6=GUI:Duel, STT:ModeDuel, MPDuel.ini, duel, false
7=GUI:MeatGrind, STT:ModeMeatGrind, MPMeat.ini, meatgrind, false
8=GUI:NavalWar, STT:ModeNavalWar, MPNaval.ini, navalwar, false
; ManBattle is battle between MEN! (i.e. no AI's)
[ManBattle]
5=GUI:Megawealth, STT:ModeMegawealth, MPMW.ini, megawealth, false
6=GUI:Duel, STT:ModeDuel, MPDuel.ini, duel, false
7=GUI:MeatGrind, STT:ModeMeatGrind, MPMeat.ini, meatgrind, false
8=GUI:NavalWar, STT:ModeNavalWar, MPNaval.ini, navalwar, false
[FreeForAll]
2=GUI:FreeForAll, STT:ModeFreeForAll, MPFreeForAll.ini, standard, true
[Unholy]
4=GUI:UnholyAlliance, STT:ModeUnholyAlliance, MPUnholy.ini, standard, false
;Removed until UI does or does not support game type.
;[Siege]
;5=GUI:Siege, STT:ModeSiege, MPSeige.ini, siege
[Cooperative]
3=GUI:Cooperative, STT:ModeCooperative, MPCoop.ini, cooperative, false
),%Ra2DIR%\mpmodes.ini
MsgBox,补丁已添加
}
Else
MsgBox,补丁已删除
}
Else
Gosub,ButtonLoadFolder
Return
*/
Button游戏界面补丁:
If Not FileExist(Ra2Dir . "\ra2.exe")
Gosub FileSelectFolder红警目录
If FileExist(Ra2Dir . "\ui.ini")
{
MsgBox 4097,删除游戏界面补丁,确认删除游戏界面补丁?
IfMsgBox,Cancel
Return
FileDelete, %Ra2Dir%\ui.ini
}
Else
{
MsgBox 4100,安装游戏界面补丁,红警文件路径: %Ra2Dir%`n`n确认安装游戏界面补丁?`n说明:`n游戏界面工具栏添加按扭:`n“三队”、“欢呼”、“停止”、“防御”、“移动攻击”
IfMsgBox,No
Return
FileAppend,
(
[AdvancedCommandBar]
ButtonList=Team01,Team02,Team03,Cheer,TypeSelect,Stop,Deploy,Guard,PlanningMode,AttackMove,AutoDeploy
[MultiplayerAdvancedCommandBar]
ButtonList=Team01,Team02,Team03,Cheer,TypeSelect,Stop,Deploy,Guard,PlanningMode,AttackMove,Beacon,AutoDeploy
),%Ra2DIR%\ui.ini
}
Return
Button单机地图补丁:
If Not FileExist(Ra2Dir . "\ra2.exe")
Gosub FileSelectFolder红警目录
If FileExist(Ra2Dir . "\mpmodes.ini")
{
MsgBox 4097,删除单机地图补丁,确认删除单机地图补丁?
IfMsgBox,Cancel
Return
FileDelete, %Ra2Dir%\mpmodes.ini
}
Else
{
MsgBox 4100,安装单机地图补丁,红警文件路径: %Ra2Dir%`n`n确认安装单机地图补丁?`n说明:`n单机支持“邪恶联盟”“巨富”“海战”等模式
IfMsgBox,No
Return
FileAppend,
(
; Define the multiplayer game modes
; modeID=Name, rulesOverride, mapFilter, randomMapsAllowed
; Battle is "standard" multiplay with rules.ini changes for modified gameplay
; It is the only one that allows AI players.
[Battle]
1=GUI:Battle, STT:ModeBattle, MPBattle.ini, standard, true
3=GUI:Cooperative, STT:ModeCooperative, MPCoop.ini, cooperative, false
4=GUI:UnholyAlliance, STT:ModeUnholyAlliance, MPUnholy.ini, standard, false
2=GUI:FreeForAll, STT:ModeFreeForAll, MPFreeForAll.ini, standard, true
5=GUI:Megawealth, STT:ModeMegawealth, MPMW.ini, megawealth, false
6=GUI:Duel, STT:ModeDuel, MPDuel.ini, duel, false
7=GUI:MeatGrind, STT:ModeMeatGrind, MPMeat.ini, meatgrind, false
8=GUI:NavalWar, STT:ModeNavalWar, MPNaval.ini, navalwar, false
; ManBattle is battle between MEN! (i.e. no AI's)
[ManBattle]
5=GUI:Megawealth, STT:ModeMegawealth, MPMW.ini, megawealth, false
6=GUI:Duel, STT:ModeDuel, MPDuel.ini, duel, false
7=GUI:MeatGrind, STT:ModeMeatGrind, MPMeat.ini, meatgrind, false
8=GUI:NavalWar, STT:ModeNavalWar, MPNaval.ini, navalwar, false
[FreeForAll]
2=GUI:FreeForAll, STT:ModeFreeForAll, MPFreeForAll.ini, standard, true
[Unholy]
4=GUI:UnholyAlliance, STT:ModeUnholyAlliance, MPUnholy.ini, standard, false
;Removed until UI does or does not support game type.
;[Siege]
;5=GUI:Siege, STT:ModeSiege, MPSeige.ini, siege
[Cooperative]
3=GUI:Cooperative, STT:ModeCooperative, MPCoop.ini, cooperative, false
),%Ra2DIR%\mpmodes.ini
}
Return
Button红警很卡补丁:
If Not FileExist(Ra2Dir . "\ra2.exe")
Gosub FileSelectFolder红警目录
If FileExist(Ra2Dir . "\Ra2备份.ini")
{
MsgBox 4097,删除红警很卡补丁,确认删除红警很卡补丁?
IfMsgBox,Cancel
Return
FileMove, %Ra2Dir%\Ra2备份.ini,%Ra2Dir%\Ra2.ini,1
}
Else
{
MsgBox 4100,安装红警很卡补丁,红警文件路径: %Ra2Dir%`n`n确认安装红警很卡补丁?`n说明:`n主要是修正一些新机, 或高配置,独立显卡, Win7之类`n玩红警反而出现比老机更卡, 尤其是核弹,辐射,爆炸时之类时卡得更明显`n文件将自动备份, 再次点击此按钮可恢复补丁
IfMsgBox,No
Return
FileMove, %Ra2Dir%\Ra2.ini,%Ra2Dir%\Ra2备份.ini,1
;~ FileDelete, %Ra2Dir%\Ra2.ini
FileAppend,
(
[Intro]
Play=no
[MultiPlayer]
ObserverMode=0
PhoneIndex=-1
WOLLimitResolution=no
LastNickSlot=-1
Handle=45,6e,69,67,6d,61,
Color=1
ColorEx=-1
Side=Arabs
SideEx=-1
GameMode=1
SendDelay=no
PortNumberOverride=0
[Skirmish]
GameMode=1
ScenIndex=180
GameSpeed=0
Credits=10000
UnitCount=10
ShortGame=yes
SuperWeaponsAllowed=no
BuildOffAlly=yes
MCVRepacks=yes
CratesAppear=yes
Slot01=4,-2,-2
Slot02=4,-2,-2
Slot03=4,-2,-2
Slot04=4,-2,-2
Slot05=4,-2,-2
Slot06=4,-2,-2
Slot07=4,-2,-2
[LAN]
GameMode=1
ScenIndex=170
GameSpeed=0
Credits=10000
UnitCount=10
ShortGame=yes
SuperWeaponsAllowed=no
BuildOffAlly=no
MCVRepacks=yes
CratesAppear=yes
Slot01=6,-2,-2
Slot02=6,-2,-2
Slot03=6,-2,-2
Slot04=6,-2,-2
Slot05=6,-2,-2
Slot06=6,-2,-2
Slot07=6,-2,-2
[WonlinePref]
GameMode=1
ScenIndex=0
GameSpeed=0
Credits=10000
UnitCount=10
ShortGame=yes
SuperWeaponsAllowed=yes
BuildOffAlly=yes
MCVRepacks=yes
CratesAppear=yes
Slot01=2,-2,-2
Slot02=2,-2,-2
Slot03=2,-2,-2
Slot04=2,-2,-2
Slot05=2,-2,-2
Slot06=2,-2,-2
Slot07=2,-2,-2
[Options]
GameSpeed=0
Difficulty=2
ScrollMethod=0
ScrollRate=1
AutoScroll=yes
DetailLevel=2
SidebarCameoText=yes
UnitActionLines=yes
ShowHidden=yes
ToolTips=yes
[Video]
ScreenWidth=1024
ScreenHeight=768
StretchMovies=no
AllowHiResModes=yes
VideoBackBuffer=no
AllowVRAMSidebar=no
[Audio]
SoundVolume=0.600000
VoiceVolume=0.900000
ScoreVolume=1.000000
IsScoreRepeat=no
IsScoreShuffle=no
SoundLatency=9
InGameMusic=yes
[Network]
Socket=65535
NetCard=0
NetID=ffce,ffcf,ffdf,ffcf,
[SerialDefaults]
CallWaitStringIndex=3
InitStringIndex=-1
DialMethod=T
Baud=-1
IRQ=-1
Port=0h
Compression=0
ErrorCorrection=0
),%Ra2DIR%\Ra2.ini
}
Return
Button冰天雪地(全亮)图:
If Not FileExist(Ra2Dir . "\ra2.exe")
Gosub FileSelectFolder红警目录
If FileExist(Ra2Dir . "\Enigma_冰天雪地(全亮).mpr")
{
MsgBox 4097,删除冰天雪地(全亮)图,确认删除冰天雪地(全亮)图?
IfMsgBox,Cancel
Return
FileDelete, %Ra2Dir%\Enigma_冰天雪地(全亮).mpr
}
Else
{
MsgBox 4100,安装冰天雪地(全亮)地图,红警文件路径: %Ra2Dir%`n`n确认安装冰天雪地(全亮)地图?`n说明:`n游戏重启后,自订战役→下拉选地图`n地图名: Bing Tian Xue Di!
IfMsgBox,No
Return
FileCopy, %A_ScriptDir%\Update\enigma_冰天雪地(钱).mpr, %Ra2Dir%\
FileCopy, %A_ScriptDir%\Update\Enigma_冰天雪地(全亮).mpr, %Ra2Dir%\
FileCopy, %A_ScriptDir%\Update\Enigma_1.mmx, %Ra2Dir%\
FileCopy, %A_ScriptDir%\Update\Enigma_2.mmx, %Ra2Dir%\
FileCopy, %A_ScriptDir%\ra2.csf, %Ra2Dir%\
}
Return
Button蓝色皮肤:
If Not FileExist(Ra2Dir . "\ra2.exe")
Gosub FileSelectFolder红警目录
If FileExist(Ra2Dir . "\expand15.mix")
{
MsgBox 4097,删除蓝色皮肤,确认删除蓝色皮肤?
IfMsgBox,Cancel
Return
FileDelete, %Ra2Dir%\expand15.mix
}
Else
{
MsgBox 4100,安装蓝色皮肤,红警文件路径: %Ra2Dir%`n`n确认安装蓝色皮肤?`n说明:`n蓝色皮肤 换换口味
IfMsgBox,No
Return
FileCopy, %A_ScriptDir%\Update\expand15.mix, %Ra2Dir%\
}
Return
}
CreateRa2GUI_Tab_3()
{
global
Gui,Font,s9,%CustomFont%
Gui, Add,TreeView,xm-1 ym+22 BackgroundF0F0F0 c0000ff w485 h480 vHKTree1 gHKTree1
Gui,Font,bold
Gui, Add, Text,xm+493 ym+30 section, 窗口类型:
Gui, Add, DropDownList,ys-5 w150 vWingetDDL gHKOptions,新建窗口类型|全局通用热键|红色警戒
Gui,Font,,宋体
Gui, Add, Text,xm+493 ym+2 section ,偏移量:
Gui, Add, Edit,Number x+4 ys-4 w38 h20
Gui, Add, UpDown,section vScreenPosUpDown gScreenPosUpDown Range1-100, %ScreenPosUpDown%
Gui, Add, DropDownList,x+1 ys w122 vScreenPos gHKOptions,|︰屏幕上方(左)|︰屏幕上方(右)|︰屏幕左侧(上)|︰屏幕左侧(下)|︰屏幕右侧(上)|︰屏幕右侧(下)
Gui, Font,cRed
Gui, Add, Checkbox,xm+492 ym+58 section h20 v_Block gHKOptions,劫持
Gui, Font,cDefault
Gui, Add, Radio,Checked h20 x+2 ys section vMyRadioGroup1 gHKOptions Group, 标准
Gui, Add, Radio,x+4 ys h20 vMyRadioGroup2 gHKOptions, 特殊
Gui, Add, Radio,x+4 ys h20 vMyRadioGroup3 gHKOptions, 高级
Gui, Add, DropDownList,xm+492 ym+88 section r32 w90 v_Keylist1 gHKOptions,|%_KeyList%
Gui, Add, Text,x+10 ys+5 v_KeylistText,+
Gui, Add, DropDownList,x+10 ys r32 w90 v_Keylist2,|%_KeyList%
Gui, Add, Hotkey,x+-160 ys-2 h20 w158 vHK_Normal gHKOptions ;标准
Gui, Add, Edit,xp yp h20 w158 vHK_Edit ;高级
Gui, Add, Checkbox,xs section h30 v_Win gHKOptions,Win
Gui, Add, Checkbox,x+3 ys h30 v_Ctrl gHKOptions,Ctrl
Gui, Add, Checkbox,x+3 ys h30 v_Shift gHKOptions,Shift
Gui, Add, Checkbox,x+3 ys h30 v_Alt gHKOptions,Alt
Gui, Add, Checkbox,xs h30 section v_DoubleClick gHKOptions,双击
Gui,Add,Text,x+20 ys+8,按键延迟:
Gui,Add,Edit,x+5 ys+6 w35 h16 v_KeyDelay g_KeyDelay
Gui,Add,Text,ys+9,ms
Gui, Add, Checkbox,Check3 xm+690 ym+205 h13 w13 vCheck3View g切换按键设置视图
Gui, Font,cb54cd8
Gui, Add, Checkbox,xm+492 ym+197 h30 w47 section v_Remap gHKOptions,映射
Gui, Add, Text,x+9 ys+7,←﹦双击增减列表﹦→
Gui, Font,cDefault
Gui, Add, Radio,Checked h20 xs+50 ym+223 section vRemapMyRadioGroup1 gHKOptions Group, 标准
Gui, Add, Radio,x+5 ys vRemapMyRadioGroup2 h20 gHKOptions, 特殊
Gui, Add, Radio,x+5 ys vRemapMyRadioGroup3 h20 gHKOptions, 高级
Gui, Add, DropDownList,xm+492 y+3 section r32 w90 vRemap_Keylist1 gHKOptions,|%_KeyList%
Gui, Add, Text,x+10 ys+5 vRemap_KeylistText,+
Gui, Add, DropDownList,x+10 ys r32 w90 vRemap_Keylist2 gHKOptions,|%_KeyList%
Gui, Add, Hotkey,x+-160 ys-1 h20 w158 vRemapHK_Normal gHKOptions
Gui,Add,Edit,xp yp h20 w158 vRemapHK_Edit gHKOptions
Gui, Add, Checkbox,xs section h20 vRemap_Win gHKOptions,Win
Gui, Add, Checkbox,x+3 ys h20 vRemap_Ctrl gHKOptions,Ctrl
Gui, Add, Checkbox,x+3 ys h20 vRemap_Shift gHKOptions,Shift
Gui, Add, Checkbox,x+3 ys h20 vRemap_Alt gHKOptions,Alt
Gui, Add, Checkbox,xs y+5 h20 section vRemapKeyDown gHKOptions,按下
Gui, Add, Checkbox,ys h20 gHKOptions vRemapKeyUp,弹起
Gui,Add,Text,xs y+8 section vRemaptextcount,按键次数:
Gui,Add,Edit,x+5 ys-2 w20 h16 Number vRemapHKClickCount,1
Gui,Add,Text,x+10 ys vRemaptextdelay,延迟(毫秒):
Gui,Add,Edit,x+5 ys-2 w35 h16 Number vRemap_KeyDelay,0
Gui, Add, Button,xm+492 ym+355 v启用已设按键 gReload,启用已设按键
Gui, Add, Button,xm+610 ym+355 vRemapHKCurrentAdd gRemapHKCurrentAdd,添加
Gui, Add, Button,xm+663 ym+355 section vHKCurrentSave gHKCurrentSave,保存
Gui, Add, Button,xm+890 ym-3 vRemapHKCurrentDel gRemapHKCurrentDel,清空列表
Gui, Add, Text,xm+710 ym+1, 〔备用按键库〕
Gui,Font,s9 norm,%CustomFont%
Gui, Add, Text,xm+492 ym+382 h117 w210 section 0x1000 vRemapTextPrint
Gui, Add, ListView,xm+710 ym+22 w250 h480 vRemapListView gRemapListView Hidden,发送热键|次数|延迟(毫秒)
LV_ModifyCol(1,135)
LV_ModifyCol(2,40)
LV_ModifyCol(3,70)
;~ Gui, Add, Text,xm+840 ym+1, ---双击添加到列表---
Gui, Font,s9 cgreen norm,%CustomFont%
Gui, Add, TreeView,xm+710 ym+22 w250 h480 vHKTree2 gHKTree2
; Gui, Add, DropDownList,xs ym+434 w108,↖屏幕上方(左)|↑屏幕(左上)|↑屏幕(右上)|↗←→↙↓↘
Return
;=========按键设置=======Gui, Tab, 3=======================================================================================
HKOptions:
Gui,Submit,NoHide
If MyRadioGroup1=1
{
HKName:=_Block%_Block% . _Win%_Win% . HKChangeCN(HK_Normal) . ScreenPos . _DoubleClick%_DoubleClick%
}
If MyRadioGroup2=1
{
If _Keylist2
{
_Keylist2:="+" . _Keylist2
HKName:=_Block%_Block% . _Keylist1 . _Keylist2 . ScreenPos . _DoubleClick%_DoubleClick%
}
Else
HKName:=_Block%_Block% . _Shift%_Shift% . _Ctrl%_Ctrl% . _Alt%_Alt% . _Win%_Win% . _Keylist1 . _Keylist2 . ScreenPos . _DoubleClick%_DoubleClick%
}
If _Remap=1
{
TVName:=":映射" . HKName
If RemapMyRadioGroup1=1
{
HKName:=Remap_Win%Remap_Win% . HKChangeCN(RemapHK_Normal)
}
If RemapMyRadioGroup2=1
{
If Remap_Keylist2
{
Remap_Keylist2:="+" . Remap_Keylist2
HKName:=Remap_Keylist1 . Remap_Keylist2
}
Else
HKName:=Remap_Shift%Remap_Shift% . Remap_Ctrl%Remap_Ctrl% . Remap_Alt%Remap_Alt% . Remap_Win%Remap_Win% . Remap_Keylist1 . Remap_Keylist2
}
If _Block
_Blockstr=拦截
Else
_Blockstr=附加
}
Else
{
TVName:=HKTree1Text1
}
Gosub,HKGuiControl
Return
;------HKTree2 HKTree1----------------------------HKChangeCN(
HKTree1:
Gui,TreeView, HKTree1
If A_GuiEvent=S
{
TVItemID:=A_EventInfo
n:=TVItemID
TVNameC=
while,n
{
m:=n
n:=TV_GetParent(n)
TV_GetText(TVText,n)
If TVText=游戏内置按键
TVNameC=游戏内置按键
}
TV_GetText(TVNameF1, m)
GuiControl,Choose,WingetDDL,%TVNameF1%
TV_GetText(HKTree1ParentText, TV_GetParent(TVItemID)) ;上一级名
TV_GetText(HKTree1Text, TVItemID)
stringsplit,HKTree1Text,HKTree1Text,=
TV_Modify(A_EventInfo ,"Bold")
TV_Modify(TV_HKTree1PreviousID ,"-Bold")
TV_HKTree1PreviousID:=A_EventInfo
if TVNameC=游戏内置按键
{
GuiControlCheck=游戏内置按键
GuiControl,Hide,_Win
GuiControl,Hide,_Block
GuiControl,Hide,_DoubleClick
GuiControl,Hide,_Remap
GuiControl,Hide,_KeyDelay
GuiControl,Hide,MyRadioGroup2
GuiControl,Hide,MyRadioGroup3
GuiControl,Hide,_Keylist1
GuiControl,Hide,_Keylist2
GuiControl,Hide,HK_Edit
GuiControl,Hide,启用已设按键
GuiControl,Show,HK_Normal
GuiControl,,MyRadioGroup1,1
GuiControl,Choose,WingetDDL,红色警戒
GuiControl,Focus,HK_Normal
Return
}
Else
GuiControl,Show,启用已设按键
IfInString,HKTree1Text,映射
{
_Remap:=1
HK_Normal:=HKChangeEN(HKTree1Text1)
}
Else
{
_Remap:=0
}
TVName:=HKTree1Text1
HKName:=HKTree1Text2
/*
If _Remap=1
{
IfInString,HKTree1Text,映射
TVItemID:=A_EventInfo
}
Else
StringSplit,HKTree1Text,HKTree1Text,=
If !(_Remap ^ InStr(HKTree1Text,"映射"))
{
TVName:=HKTree1Text1
HKName:=HKTree1Text2
}
*/
}
If A_GuiEvent=DoubleClick
{
If (TV_GetChild(A_EventInfo) || TVName%TVItemID%="游戏内置按键")
return
TV_Delete(A_EventInfo)
IniDelete,Settings\%ProjectSelect%.ini,%TVNameF1%,%HKTree1Text1%
Gui, TreeView,HKTree2
TV_Add(HKTree1Text,%TVNameF1%TVID2)
Return
}
Gosub,GuiControl_
Gosub,HKGuiControl
Return
HKTree2:
Gui, TreeView,HKTree2
If A_GuiEvent=S
{
TV_Modify(A_EventInfo ,"Bold")
TV_Modify(TV_HKTree2PreviousID ,"-Bold")
TV_HKTree2PreviousID:=A_EventInfo
}
If A_GuiEvent=DoubleClick
{
n:=A_EventInfo
while,n
{
m:=n
n:=TV_GetParent(n)
}
TV_GetText(TVNameF2, m)
TV_GetText(HKTree2Text, A_EventInfo)
StringSplit,HKTree2Text,HKTree2Text,=
if HKTree2Text0>1
{
TV_Delete(A_EventInfo)
Gui, TreeView,HKTree1
TV_Add(HKTree2Text,%TVNameF2%TVID,"Select")
;~ MsgBox,%HKTree2Text1%=%HKTree2Text2%---%TVNameF2%
IniWrite %HKTree2Text2%,settings\%ProjectSelect%.ini,%TVNameF2%,%HKTree2Text1%
}
}
Return
GuiControl_:
GuiControl,,_Remap,%_Remap%
GuiControl,,HK_Normal,%HK_Normal%
Return
;================================================================HKGuiControl================================================================;
HKGuiControl:
; -----标准
; MsgBox,% MyRadioGroup
If MyRadioGroup1=1
{
GuiControl,Show,HK_Normal
}
Else
{
GuiControl,Hide,HK_Normal
}
; -----鼠标
If MyRadioGroup2=1
{
If (InStr(_Keylist1, "滚轮") || InStr(_Keylist2, "滚轮"))
GuiControl,Hide,CheckClickCount
Else
GuiControl,Show,CheckClickCount
If (_Shift || _Ctrl || _Alt || _Win || !_Keylist1 || InStr(_Keylist1, "滚轮"))
{
GuiControl,Hide,_KeylistText
GuiControl,Hide,_Keylist2
}
Else
{
GuiControl,Show,_KeylistText
GuiControl,Show,_Keylist2
}
GuiControl,Show,_Keylist1
GuiControl,Show,_Ctrl
GuiControl,Show,_Shift
GuiControl,Show,_Alt
}
Else
{
GuiControl,Hide,_Ctrl
GuiControl,Hide,_Shift
GuiControl,Hide,_Alt
GuiControl,Hide,_Keylist1
GuiControl,Hide,_KeylistText
GuiControl,Hide,_Keylist2
}
; -----高级
If MyRadioGroup3=1
{
GuiControl,Hide,_Win
GuiControl,Hide,_Block
GuiControl,Show,HK_Edit
}
Else
{
GuiControl,Show,_Block
GuiControl,Show,_Win
GuiControl,Hide,HK_Edit
}
If _Remap=1
{
GuiControl,Hide,HKTree2
If RemapMyRadioGroup1=1
{
GuiControl,Show,RemapHK_Normal
}
Else
{
GuiControl,Hide,RemapHK_Normal
}
; -----鼠标
If RemapMyRadioGroup2=1
{
If (Remap_Shift || Remap_Ctrl || Remap_Alt || Remap_Win || !Remap_Keylist1 || InStr(Remap_Keylist1, "滚轮"))
{
GuiControl,Hide,Remap_KeylistText
GuiControl,Hide,Remap_Keylist2
}
Else
{
GuiControl,Show,Remap_KeylistText
GuiControl,Show,Remap_Keylist2
}
GuiControl,Show,Remap_Keylist1
GuiControl,Show,Remap_Ctrl
GuiControl,Show,Remap_Shift
GuiControl,Show,Remap_Alt
}
Else
{
GuiControl,Hide,Remap_Ctrl
GuiControl,Hide,Remap_Shift
GuiControl,Hide,Remap_Alt
GuiControl,Hide,Remap_Keylist1
GuiControl,Hide,Remap_KeylistText
GuiControl,Hide,Remap_Keylist2
}
; -----高级
If RemapMyRadioGroup3=1
{
GuiControl,Hide,Remap_Win
GuiControl,Show,RemapHK_Edit
}
Else
{
GuiControl,Show,Remap_Win
GuiControl,Hide,RemapHK_Edit
}
GuiControl,Show,RemapMyRadioGroup1
GuiControl,Show,RemapMyRadioGroup2
GuiControl,Show,RemapMyRadioGroup3
GuiControl,Show,RemapKeyDown
GuiControl,Show,RemapKeyUp
GuiControl,Show,RemapHKClickCount
GuiControl,Show,Remap_KeyDelay
GuiControl,Show,RemapHKCurrentDel
GuiControl,Show,RemapHKCurrentAdd
GuiControl,Show,Remaptextcount
GuiControl,Show,Remaptextdelay
GuiControl,Show,RemapListView
}
Else
{
GuiControl,Hide,RemapMyRadioGroup1
GuiControl,Hide,RemapMyRadioGroup2
GuiControl,Hide,RemapMyRadioGroup3
GuiControl,Hide,Remaptextcount
GuiControl,Hide,Remaptextdelay
GuiControl,Hide,RemapKeyDown
GuiControl,Hide,RemapKeyUp
GuiControl,Hide,RemapHKClickCount
GuiControl,Hide,Remap_KeyDelay
GuiControl,Hide,RemapHKCurrentDel
GuiControl,Hide,RemapHKCurrentAdd
GuiControl,Hide,Remap_Win
GuiControl,Hide,Remap_Ctrl
GuiControl,Hide,Remap_Alt
GuiControl,Hide,Remap_Shift
GuiControl,Hide,RemapHK_Normal
GuiControl,Hide,RemapHK_Edit
GuiControl,Hide,Remap_KeylistText
GuiControl,Hide,Remap_Keylist1
GuiControl,Hide,Remap_Keylist2
GuiControl,Hide,RemapListView
GuiControl,Show,HKTree2
}
GuiControl,,RemapTextPrint,
(
%TVName%
============
%HKName%
)
Return
RemapListview:
Gui,TreeView,
If A_GuiEvent=DoubleClick,RemapListview
LV_Delete(A_EventInfo)
Return
RemapHKCurrentDel:
Gui,ListView,RemapListView
LV_Delete()
Return
RemapHKCurrentAdd:
Gui,Submit,NoHide
Gui,ListView,RemapListView
; MsgBox,%HKName%=%TVName%
If RemapMyRadioGroup1=1
{
LV_ModifyCol(1, "Center",TVName)
LV_Add("",HKName,RemapHKClickCount,Remap_KeyDelay)
}
If RemapMyRadioGroup2=1
{
LV_ModifyCol(1, "Center", ":映射" . TVName)
LV_Add("",HKName,RemapHKClickCount,Remap_KeyDelay)
}
Return
HKCurrentSave:
Gui,Submit,NoHide
if GuiControlCheck=游戏内置按键
{
Gui,ListView,HKTree1
TV_Modify(TVItemID, "",HKTree1Text1 . "=" . HKChangeCN(HK_Normal))
IniWrite,% HKRePlaceNum(HK_Normal),%Ra2Dir%\Keyboard.ini,Hotkey,% %HKTree1Text1%en
GuiControl,Focus,HK_Normal
Return
}
If WingetDDL=
{
ToolTip ,未选择窗口
SoundPlay,Sound\出错声音.wav
Return
}
If ((MyRadioGroup1=1 && !HK_Normal) || (MyRadioGroup2=1 && !_Keylist1))
{
ToolTip ,未输入原按键
SoundPlay,Sound\出错声音.wav
Return
}
IF _Remap
{
Gui,ListView,RemapListView
If !LV_GetCount()
{
ToolTip ,未添加映射按键
SoundPlay,Sound\出错声音.wav
Return
}
HKName=
Loop,% LV_GetCount()
{
LV_GetText(LVText1,A_Index, 1)
If LVText1
{
LV_GetText(LVText2,A_Index, 2)
LV_GetText(LVText3,A_Index, 3)
HKName.="《" . LVText1 . "﹍次数" . LVText2 . "﹍延时" . LVText3 . "》"
}
}
}
Gui,ListView,HKTree1
;~ MsgBox,%HKName%
If _Remap
TVItemID:=TV_GetSearchStrItemID(TVName)
;~ MsgBox,% TVItemID
If !TVItemID
TV_Add(TVName . "=" . HKName, %WingetDDL%TVID)
Else
TV_Modify(TVItemID, "",TVName . "=" . HKName)
IniWrite,%HKName%,Settings\%ProjectSelect%.ini,%WingetDDL%,%TVName%
Return
/*
HKTree1Save:
SoundPlay,Sound\Complete.wav
Gui,ListView,HKTree1
ItemID = 0
Loop
{
ItemID := TV_GetNext(ItemID, "Full")
if not ItemID
break
If TV_GetParent(ItemID)
{
TV_GetText(OutputVar, TV_GetParent(ItemID))
TV_GetText(ItemText, ItemID)
StringGetPos,n,ItemText,=
StringLeft,ItemText1,ItemText,n
StringTrimLeft,ItemText2,ItemText,n+1
; MsgBox,%OutputVar%
IniWrite,%ItemText2%,Settings\%ProjectSelect%.ini,%OutputVar%,%ItemText1%
}
}
IniWrite,%_KeyDelay%,Settings\%ProjectSelect%.ini,Default,_KeyDelay
IniWrite,%ScreenPosUpDown%,Settings\%ProjectSelect%.ini,Default,ScreenPosUpDown
ToolTip,已保存~
Reload
Return
保存红警快捷键:
Loop,Parse,%Name%,CSV
{
Name1:=%A_LoopField%
If Name1
{
Name=%A_LoopField%
GoSub,保存红警快捷键
}
Else
{
IniRead %A_LoopField%en,红警快捷键目录.ini,TreeView_Ra2HKTree2,%A_LoopField%
en:=%A_LoopField%en
; MsgBox,%en%
IniRead var,%Ra2Dir%\Keyboard.ini,Hotkey,%en%
If var=Error
TV_Modify(%A_LoopField%TVID,"Expand",A_LoopField . "-----(无)")
Else
{
%en%:=Asckey(var)
TV_Modify(%A_LoopField%TVID,"Expand",A_LoopField . "-----" . HKRePlaceStr(%en%))
}
}
}
Return
*/
MyRadioGroup:
Gui,Submit,NoHide
IniWrite,%MyRadioGroup%,Settings\%ProjectSelect%.ini,Default,MyRadioGroup
MyRadioGroup_:
Return
}
QQWinRun:
WinRun:
GuiControlGet,%A_ThisLabel%
if A_ThisLabel=QQWinRun
{
If QQBattleZoneDir
IniWrite % QQWinRun%QQWinRun%,%QQBattleZoneDir%\QBGames.ini,Game10,Param
Else
{
MsgBox,4096,没有找到QQ平台!
return
}
}
If (WinRun || QQWinRun)
str:=16
else
str:=RegExReplace(Display_BIT, "[^0-9]" )
NumPut(str,dM,104, "UInt") ;-----颜色
DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
GuiControl,choose,Display_BIT,% str "位"
IniWrite, % %A_ThisLabel%,settings\%ProjectSelect%.ini, Default,%A_ThisLabel%
/*
struct_devicemode_size = 156
VarSetCapacity( device_mode, struct_devicemode_size, 0 )
EncodeInteger( struct_devicemode_size, 2, &device_mode, 36 )
success := DllCall( "EnumDisplaySettings", "uint", 0, "uint", -1, "uint", &device_mode )
current?width := DecodeInteger( "uint4", &device_mode, 108, false )
current?height := DecodeInteger( "uint4", &device_mode, 112, false )
current?quality := DecodeInteger( "uint4", &device_mode, 104, false )
current?frequency := DecodeInteger( "uint4", &device_mode, 120, false )
If current?quality<>16
DispChangeSettings("16",current?width,current?height,current?frequency)
*/
Return
displayHIDDEN:
GuiControlGet,displayHIDDEN
if displayHIDDEN<>0
{
GuiControl,hide,display_WH
GuiControl,hide,display_bit
GuiControl,hide,display_hz
GuiControl,hide,display_ra2
GuiControl,hide,winrun
GuiControl,hide,qqwinrun
}
else
{
GuiControl,show,display_WH
GuiControl,show,display_bit
GuiControl,show,display_hz
GuiControl,show,display_ra2
GuiControl,show,winrun
GuiControl,show,qqwinrun
}
Gui,show,autosize
IniWrite, %displayHIDDEN%,settings\%ProjectSelect%.ini, Default,displayHIDDEN
Return
display_:
GuiControlDisplay(A_GuiControl)
GuiControlGet,display_WH
StringSplit,str,display_WH,x
GuiControlGet,display_bit
StringTrimRight,display_bit,display_bit,1
if display_bit<>16
{
WinRun:=0
QQWinRun:=0
GuiControl,,WinRun,0
GuiControl,,QQWinRun,0
IniWrite "",%QQBattleZoneDir%\QBGames.ini,Game10,Param
IniWrite,0,settings\%ProjectSelect%.ini, Default,WinRun
IniWrite,0,settings\%ProjectSelect%.ini, Default,QQWinRun
}
GuiControlGet,display_Hz
StringTrimRight,display_Hz,display_Hz,2
ChangeDisplaySettings(display_bit,str1,str2,display_Hz)
;~ if A_GuiControl=display_WH
;~ {
;~ GuiControlGet,display_WH
;~ GuiControl,,display_bit,% "|" display_Change(%display_WH%bit,display_bit,A_GuiControl)
;~ GuiControlGet,display_Hz
;~ GuiControl,,display_Hz,% "|" display_Change(%display_WH%Hz,display_Hz)
;~ }
;~ if A_GuiControl=display_bit
;~ {
;~ GuiControlGet,display_bit
;~ GuiControl,,display_WH,% "|" display_Change(%display_bit%WH,display_WH)
;~ }
;~ if A_GuiControl=display_Hz
;~ {
;~ GuiControlGet,display_WH
;~ IfInString,%display_WH%bit,%display_bit%
;~ StringReplace, %display_WH%bit, %display_WH%bit, %display_bit%|, %display_bit%||, All
;~ else
;~ StringReplace, %display_WH%bit, %display_WH%bit,|,||
;~ GuiControl,,display_bit,% "|" %display_WH%bit
;~ GuiControlGet,display_Hz
;~ IfInString,%display_WH%bit,%display_Hz%
;~ StringReplace, %display_WH%Hz, %display_WH%Hz, %display_Hz%|, %display_Hz%||, All
;~ else
;~ StringReplace, %display_WH%Hz, %display_WH%Hz,|,||
;~ GuiControl,,display_Hz,% "|" %display_WH%Hz
;~ }
Return
Display_Ra2:
GuiControlGet,Display_Ra2
StringSplit,Display_Ra2,Display_Ra2,x
If FileExist(Ra2DIR . "\ra2.ini")
{
IniWrite, %Display_Ra21%,%Ra2DIR%\ra2.ini, Video, ScreenWidth
IniWrite, %Display_Ra22%,%Ra2DIR%\ra2.ini, Video, ScreenHeight
}
Else
Gosub,FileSelectFolder红警目录
Return
QQ平台启动游戏:
;~ MsgBox,%QQBattleZoneDir%
DetectHiddenWindows,on
IfWinExist,ahk_Class QQBattle_MainFrame
{
ControlGet, i,Enabled,,Button12,ahk_class QQBattle_MainFrame
If i
{
Process, Exist, Game.exe
If ErrorLevel
WinActivate,ahk_class Red Alert 2
Else
ControlClick,Button12,ahk_class QQBattle_MainFrame,,,, NA
WinHide,ahk_Class QQBattle_MainFrame
}
}
else
Run %QQBattleZoneDir%\QQBattleZone.exe,,UseErrorLevel
/*
{
If QQBattleZoneDir<>Error
Run %QQBattleZoneDir%\QQBattleZone.exe,,UseErrorLevel
{
Run %QQBattleZoneDir%\QQBattleZone.exe,,UseErrorLevel
WinWaitActive,ahk_Class QQBattle_MainFrame,,3
WinActivate,ahk_Class QQBattle_MainFrame
ControlGet, i,Visible,,Button12,ahk_class QQBattle_MainFrame
If i
{
Process, Exist, Game.exe
If !ErrorLevel
{
ControlClick,Button12,ahk_class QQBattle_MainFrame
Sleep,3000
WinHide ahk_Class QQBattle_MainFrame
}
}
}
}
ControlGet, i,Enabled,,Button12,ahk_class QQBattle_MainFrame
If i
{
Process, Exist, Game.exe
If ErrorLevel
WinActivate,ahk_class Red Alert 2
Else
ControlClick,Button12,ahk_class QQBattle_MainFrame,,,, NA
}
*/
Return
FileSelectFolder红警目录:
FileSelectFolder, Folder,, 0, 请选择红警目录:
if not Folder
Return
If Not FileExist(Folder . "\ra2.exe")
{
MsgBox 4096, ,选择有误 请重新选择
Goto FileSelectFolder红警目录
}
Ra2Dir:=Folder
IniWrite, %Ra2Dir%,Settings\%ProjectSelect%.ini, Default,Ra2Dir
Return
AddTree(Name,PID=0)
{
global
Loop,Parse,Name,CSV
{
Temp = %A_LoopField%
If %Temp% =
{
If _%Temp%<>有
%Temp%TVID2:=TV_Add(Temp . "=" . ︰%Temp%,PID)
}
Else
{
PID2 := TV_Add(Temp,PID)
%Temp%TVID2:=PID2
;~ MsgBox,% Temp . "TV2ID:=" . PID2
AddTree(%Temp%,PID2)
}
}
}
/*
AddTree(Name,PID=0)
{
global
Loop,Parse,Name,CSV
{
Temp = %A_LoopField%
If %Temp% =
{
If % LV_%Temp%
%Temp%TVID:=TV_Add(Temp . "=" . LV_%Temp%,PID)
Else
%Temp%TVID:=TV_Add(Temp,PID)
}
Else
{
PID2 := TV_Add(Temp,PID)
%Temp%TVID:=PID2
;~ MsgBox,% Temp . "TVID:=" . PID2
AddTree(%Temp%,PID2)
}
}
}
*/
RB_Notifications:
If (A_GuiEvent = "N")
If (RB.OnNotify(A_EventInfo, MX, MY, BandID))
ShowChevronMenu(BandID, MX, MY)
Return
ShowChevronMenu(Band, X, Y)
{
Global TB
HidBtns := TB.GetHiddenButtons()
Loop, % HidBtns.MaxIndex()
Menu, TestMenu, Add, % HidBtns[A_Index].Text, % HidBtns[A_Index].Label
Menu, TestMenu, Show, %X%, %Y%
Menu, TestMenu, DeleteAll
}
; ========== Toolbar ==========
; http://www.autohotkey.com/board/topic/94750-class-toolbar-create-and-modify
DefineToolbar:
ILA := IL_Create(2, 2, 1)
IL_Add(ILA, "wmploc.dll", 202)
IL_Add(ILA, "wmploc.dll", 201)
IL_Add(ILA, "wmploc.dll", 154)
TB := New Toolbar(hToolbar)
TB.SetImageList(ILA)
TB.Add("", "Back=Back:1", "Forward=Forward:2", "", "Refresh=Refresh:3")
TB.SetMaxTextRows(0)
TB.SetExStyle(0x10)
OnMessage(0x111, "TB_Messages")
return
TB_Messages(wParam, lParam)
{
Global
TB.OnMessage(wParam)
}
; =============================
Go:
Gui, Submit, NoHide
WB.Navigate(WebURL)
; IELoad(WB)
RB.ShowBand(1)
; GuiControl, Move, WB,w%CurrentGuiSizeW% h%CurrentGuiSizeH%
; Gui, Show,, % WB.LocationName
return
Back:
WB.GoBack
IELoad(WB)
Gui, Show,, % WB.LocationName
return
Forward:
WB.GoForward
IELoad(WB)
Gui, Show,, % WB.LocationName
return
Refresh:
WB.Refresh
IELoad(WB)
Gui, Show,, % WB.LocationName
return
IELoad(Pwb)
{
If !Pwb
Return False
While !(Pwb.busy)
Sleep, 100
While (Pwb.busy)
Sleep, 100
While !(Pwb.document.Readystate = "Complete")
Sleep, 100
Return True
}
;---------------------切换输入法
ToggleCheckOnTopCheck:
if GameFrame1=0
{
Menu, HelpMenu, Add, 窗口最前, MenuHandler ;窗口最前
if ToggleCheckOnTop
{
;~ MsgBox,%GameFrame1%
Menu, HelpMenu, Check, 窗口最前
Gui,+AlwaysOnTop
}
SetTimer,ToggleCheckOnTopCheck,Off
}
return
Get红警游戏界面pos:
IfWinActive,ahk_Class Red Alert 2
{
WinGetPos, , , 红警游戏界面_Width,,ahk_Class Red Alert 2
if (WidthLast<>红警游戏界面_Width)
{
WidthLast:=红警游戏界面_Width
Build_x1:=红警游戏界面_Width-Build_X
Build_x2:=Build_x1+Build_W
Build_y2:=Build_y1+Build_H
WidthCheck:=0
}
else
WidthCheck+=1
if WidthCheck>5
{
Build_x1:=红警游戏界面_Width-Build_X
Build_x2:=Build_x1+Build_W
Build_y2:=Build_y1+Build_H
SetTimer,Get红警游戏界面pos,Off
WidthCheck:=0
}
}
return
WindowCheck_Alert:
;~ IfWinActive,ahk_group 红警大厅界面
IfWinActive ahk_Class Red Alert 2,Gui:Players
{ GameFrame1=3
loop 5
{
ControlGetPos,X,Y,W,H,ListBox%A_Index%
if (W=204 || W=224)
{
ListBoxGameList=ListBox%A_Index%
;~ tooltip, %ListBoxGameList%
;~ If W=204
;~ {
;~ X+=214
;~ Y+=H-30
;~ ControlClick, x%X% y%Y%,A,,,1, NA
;~ }
}
}
IfWinActive ahk_Class Red Alert 2,Gui:OK
ControlSend,Gui:OK,{Space}
}
else ifWinActive ahk_Class Red Alert 2,Gui:None
GameFrame1=2
;~ Else IfWinActive ahk_class Red Alert 2
else ifWinActive ahk_Class Red Alert 2
GameFrame1=1
else
GameFrame1=0
;~ tooltip,%GameFrame1%
if (GameFrame2<>GameFrame1)
{
GameFrame2:=GameFrame1
if GameFrame1>0
{
IME:=DllCall("GetKeyboardLayout","UINT",DllCall("GetWindowThReadProcessId","UINT",WinActive("ahk_Class Red Alert 2"),"UINTP",0),UInt)
Process, wait, game.exe, 0.5
gamepid = %ErrorLevel%
if GameFrame1>1
;~ IfWinActive,ahk_group 红警大厅界面
{
;~ tooltip,%IME%
if (IME<>IME_CN)
PostMessage, 0x50, 0, %IME_CN% ,,ahk_Class Red Alert 2
if !A_IsSuspended
Suspend,On
}
else
{
if (IME<>IME_EN)
PostMessage, 0x50, 0, %IME_EN%,,ahk_Class Red Alert 2
IfWinNotActive,ahk_group 红警大厅界面
if A_IsSuspended
Suspend,Off
}
if GameFrame1=1
SetTimer,Get红警游戏界面pos,500
else if GameFrame1=2
SetTimer,ComboBoxCheck,500
else if GameFrame1=3
loop,5
{
ControlGetPos,,,width, ,ListBox%A_Index%,ahk_Class Red Alert 2
if width=442 ;----- (i=442 || i=429)
{
RedAlert_ChatFocus=ListBox%A_Index%
ControlFocus,%RedAlert_ChatFocus%,A
break
;~ ControlGet, listboxHwnd442, Hwnd,, %listbox135%,ahk_class Red Alert 2
}
}
/*
{
;~ IfWinActive ahk_class Red Alert 2,GUI:HostScreen ;;自己建立游戏
Sleep,500
Loop,8
{
controlget,v,Enabled,,ComboBox%A_Index%
if v=1
{
if A_Index=1 ;--------====自己开的游戏
{
controlget,v,Enabled,,ComboBox22
If v=0
{
if OpenObserve ;------------开启观察
{
SendMessage, 0x147, 0, 0, ComboBox8,A
ChoicePos := ErrorLevel+1
If ChoicePos<>2
Control Choose,2,ComboBox8
}
}
SendMessage, 0x146, 0, 0,ComboBox8,A
if ErrorLevel>4
ComboBoxn:=23
else
ComboBoxn:=22
}
else ;------------进入别人游戏
ComboBoxn:=A_Index+8*2
break
}
}
SetTimer,ComboBoxCheck,1000
;tooltip,%v%=%n%
}
else If GameFrame1=3
{
Sleep,300
loop,5 ;----- (i=442 |ChatFocus| i=429)width=135=ID
{
controlgetpos,,,width, ,ListBox%a_index%,ahk_class Red Alert 2
listbox%width%=ListBox%a_index%
}
ControlGet, listboxHwnd135, Hwnd,, %listbox135%,ahk_class Red Alert 2
if GameIDDisable=1
winset,disable,,ahk_id %listboxHwnd135%
Else if GameIDDisable=-1
WinHide,ahk_id %listboxHwnd135%
ControlFocus,%listbox442%,ahk_class Red Alert 2
If width=135 ;----- (i=442 || i=429)width=135
{
listbox%width%=ListBox%a_index%
ControlGet, listboxHwnd135, Hwnd,, %listbox135%,ahk_class Red Alert 2
}
}
WinGet, ControlList, ControlList,ahk_class Red Alert 2
Loop,Parse,controlList,`n
{
IfInString,A_LoopField,ListBox
{
ControlGetPos,,,i,,%A_LoopField%
If i=135 ;----- (i=442 || i=429)
{
listbox135=%A_LoopField%
ControlGet, listboxHwnd135, Hwnd,,%listbox135%,ahk_class Red Alert 2
}
;~ ToolTip, %listboxHwnd135%=%GameIDDisable%
if GameIDDisable=1
winset,disable,,ahk_id %listboxHwnd135%
if GameIDDisable=-1
WinHide,ahk_id %listboxHwnd135%
If (i=442 || i=429)
{
红警游戏界面_ChatFocus:=A_LoopField
Loop
{
ControlFocus,%红警游戏界面_ChatFocus%,ahk_class Red Alert 2
if ErrorLevel
Sleep,200
else
break
}
Break
}
}
}
}
*/
}
else
Suspend,off
}
if (GameFrame1>1 && !A_IsSuspended)
Suspend,On
return
ComboBoxCheck:
ControlFocus,ListBox1,A
if GameFrame1<>2
SetTimer,ComboBoxCheck,Off
if OpenObserve ;------------开启观察
{
loop 24
{
ControlGet,ComboBoxv,Enabled,,ComboBox%A_Index%,A
;~ tooltip,=%ComboBoxv%=
if ComboBoxv=1
{
if A_Index=1 ;--------====自己开的游戏
{
SendMessage, 0x146, 0, 0,ComboBox8,A
if ErrorLevel>4
{
SendMessage, 0x147, 0, 0, ComboBox8,A
;~ tooltip,=%ErrorLevel%=
if ErrorLevel<>1
Control Choose,2,ComboBox8,A
ComboBoxn=ComboBox23
}
else
ComboBoxn=ComboBox22 ;------------判断单机游戏
break
}
else
{
ControlGetPos, , , w, , ComboBox%A_Index%,A
;~ tooltip,=%w%=
if w<100
{
ComboBoxn=ComboBox%A_Index%
break
}
}
}
}
ControlGet,Boxv,Enabled,,%ComboBoxn%,A
SendMessage, 0x147, 0, 0, %ComboBoxn%,A
;~ tooltip,=%ErrorLevel%=%ComboBoxn%
if (ErrorLevel=0 && Boxv) ; 如果没有选中的条目, 那么它会为 -1.
Control Choose,2,%ComboBoxn%,A
else
SetTimer,ComboBoxCheck,Off
;~ tooltip ComboBoxn=%ComboBoxn% ;`nChoicePos=%ChoicePos%`nOpenObserve=%OpenObserve%
}
return
FileSearch:
if FileExist(A_ScriptDir . "\update\Filesearch.exe")
{
TrayTip,,请稍候...`n初始化运行`n文件搜索中
Gui,ListView,ListViewShortCut
LV_Delete()
LV_Add("","初始化运行-搜索中...")
LV_ModifyCol()
Process, Exist,Filesearch.exe
if !ErrorLevel
{
Run,update\Filesearch.exe,,Hide
Process, WaitClose, Filesearch.exe
SoundPlay,Sound\CompleteD.wav,wait
Reload
TrayTip
LV_Delete(1)
loop
{
IniRead,str,default.ini,Program,P%A_Index%
if str=ERROR
break
StringGetPos, n,str,=
StringTrimLeft,ProgramDir,str,n+1
StringLeft,ProgramName,str,n
SplitFileNameIcon(ProgramDir)
LV_Add("Icon" . IconNumber, ProgramName,ProgramDir)
LV_ModifyCol()
SoundPlay,Sound\CompleteD.wav,wait
Reload
}
}
}
return
;---------------------------Menu子程序---------------------------;
Website_:
Run,% %A_GuiControl%,,UseErrorLevel
return
WebsiteCNBBS:
Run,http://bbs.myra2.com/forum-8-1.html
return
WebsiteQQBBS:
Run,http://qqbattle.gamebbs.qq.com/forum.php?mod=forumdisplay&fid=11227&filter=typeid&typeid=30
return
WebsiteFAQ:
WebURL=http://user.qzone.qq.com/50786729/blog/1243250406
GuiControl,,WebURL,%WebURL%
ComObjError(false)
WB.Silent:="true"
WB.Navigate(WebURL)
MySubroutine=功能说明
GuiControl, Choose, MySubroutine,功能说明
gosub,MySubroutine
return
WebsiteHelp:
WebURL=http://hi.baidu.com/cgx5871/item/2acfe71b7785f00cd0d66d9e
GuiControl,,WebURL,%WebURL%
ComObjError(false)
WB.Silent:="true"
WB.Navigate(WebURL)
MySubroutine=功能说明
GuiControl, Choose, MySubroutine,功能说明
gosub,MySubroutine
;~ RunWait,http://pan.baidu.com/share/link?shareid=65739&uk=1896339698
return
WebsiteDownLoad:
WebURL=http://pan.baidu.com/share/link?shareid=65739&uk=1896339698
GuiControl,,WebURL,%WebURL%
ComObjError(false)
WB.Silent:="true"
WB.Navigate(WebURL)
MySubroutine=功能说明
GuiControl, Choose, MySubroutine,功能说明
gosub,MySubroutine
;~ RunWait,http://pan.baidu.com/share/link?shareid=65739&uk=1896339698
return
ReLoad:
【重启软件】:
Suspend ,Permit
Reload
return
MenuExit:
ExitApp
WinHiddenWindows:
Gui,Hide
return
;---------------------------网页类子程序---------------------------;
UpdateCheck:
QQMessage:
;---------------------------Gui子程序---------------------------;
GuiSize:
if MySubroutine=功能说明
{
CurrentGuiSizeW:=A_GuiWidth-20
CurrentGuiSizeH:=A_GuiHeight-38
GuiControl, Move, WB,w%CurrentGuiSizeW% h%CurrentGuiSizeH%
}
return
GuiEscape:
GuiClose:
WinGetPos , GuiShowPosX,GuiShowPosY
IniWrite,%GuiShowPosX%,default.ini, default,GuiShowPosX
IniWrite,%GuiShowPosY%,default.ini, default,GuiShowPosY
IniWrite,%CurrentGuiSizeW%,default.ini, default,CurrentGuiSizeW
IniWrite,%CurrentGuiSizeH%,default.ini, default,CurrentGuiSizeH
;~ MsgBox,w%CurrentGuiSizeW%========= h%CurrentGuiSizeH%
if ToggleCheckHidden
Gui,Hide
else
ExitApp
return
GuiContextMenu:
IfInString A_GuiControl,CustoMButton
{
loop Parse,LV%A_GuiControl%_2,CSV
{
StringGetPos,n,A_LoopField,=,R
StringLeft,m,A_LoopField,n
StringRight,n,A_LoopField,1
;~ MsgBox,=%m%
; If m=E:\Script\AHK\红警2助手工具\红警2助手工具09.11.03+\红警2工具\新文件夹
; MsgBox,9
if n=1
{
;~ MsgBox,=%m%
Run,%m%,,UseErrorLevel
Sleep,%CustoMButton延迟%
}
}
}
if A_GuiControl = ListViewShortCut
{
Gui, ListView, ListViewShortCut
; MsgBox,% FileName
LV_GetText(RowText2,A_EventInfo,2)
IfInString,RowText2,ra2.exe
{
if (RowText2=Ra2Dir . "\ra2.exe")
{
; MsgBox,%Ra2Dir%=%FileName%
Menu,MyContextMenuRa2,Check, 设为主要红警
Menu,MyContextMenuRa2,default, 设为主要红警
}
else
{
Menu,MyContextMenuRa2,UnCheck, 设为主要红警
Menu,MyContextMenuRa2,default, 运行
}
Menu, MyContextMenuRa2, Show, %A_GuiX%, %A_GuiY%
}
else
Menu, MyContextMenu, Show, %A_GuiX%, %A_GuiY%
}
return
CustomButton:
Gui,Submit,NoHide
loop Parse,LV%A_GuiControl%_1,CSV
{
StringGetPos,n,A_LoopField,=,R
StringLeft,m,A_LoopField,n
StringRight,n,A_LoopField,1
; MsgBox,=%m%
; If m=E:\Script\AHK\红警2助手工具\红警2助手工具09.11.03+\红警2工具\新文件夹
; MsgBox,9
if n=1
{
IfInString,m , QQBattleZone.exe
gosub,QQ平台启动游戏
else
Run,%m%,,UseErrorLevel
Sleep,%CustoMButton延迟%
}
}
return
删除分辨率:
MsgBox,8
return
更换游戏ID:
SplitPath, Filename, , OutDir
;~ _IniReadVar(ProjectSelect . ".ini","MultiPlayer")
;~ n:= _Section%_IniKeyCount%
FocusedRowNumber := LV_GetNext(0, "F")
if not FocusedRowNumber
return
LV_GetText(FileName, FocusedRowNumber, 2)
;~ MsgBox,%OutDir%
;~ MsgBox,% %A_ThisMenuItem%
n=% %A_ThisMenuItem%
;~ MsgBox,%n%
IniWrite,%n%, %OutDir%\RA2.ini,MultiPlayer,Handle
return
WinGetDDL:
Gui,Submit,NoHide
IniWrite, %WinGetDDL%,settings\%ProjectSelect%.ini, default,WinGetDDL
return
;~ 管理游戏ID列表:
;~ 保存当前游戏ID:
;~ 导入键盘:
;~ 导出键盘:
FileAdd:
FileDel:
桌面分辨率:
EditControl:
return
;---------------------------按键设置子程序---------------------------;
KeyBoardCGX:
if F10check=1
{
BlockInput,Send
ControlClick,Gui:ResetAll,ahk_Class Red Alert 2,,,1,NA
Sleep,400
Control Choose,3,ComboBox1,ahk_Class Red Alert 2
Control Choose,7,ListBox1,ahk_Class Red Alert 2
ControlClick,Gui:Assign,ahk_Class Red Alert 2,,,1,NA
}
loop,Parse,Hotkeystr,`n
{
StringGetPos, n,A_LoopField,=
StringTrimLeft,var,A_LoopField,n+1
StringLeft,Key,A_LoopField,n
if Key
%Key%:=% Asckey(var)
;~ if var=67
;~ MsgBox,% key . "=" . %Key% . CenterView
}
AssignKey1:=0
loop,Parse,游戏内置按键,CSV
{
AssignKey1++
m:=A_LoopField
AssignKey2:=0
%m%TVID:=TV_Add(m,游戏内置按键TVID)
loop,Parse,%m%,CSV
{
AssignKey2++
;~ MsgBox,%CenterView%
keyen:=%A_LoopField%en
if (%keyen%)
{
keyen:=%keyen%
%A_LoopField%:=keyen
;~ if keyen=
;~ MsgBox,% A_LoopField ;. %A_LoopField%
;~ StringTrimRight,keycn,keyen,1
;~ StringReplace,keycn,keycn,`{
}
;~ MsgBox,% A_LoopField . "=" . keyen . "="
%A_LoopField%TVID:=TV_Add(A_LoopField . "=" . HKChangeCN(keyen),%m%TVID)
;~ keyen:=%keyen%
;~ MsgBox,%keyen%
if F10check=1
{
if (A_LoopField="同盟" || A_LoopField="前往雷達通報事件現場" || A_LoopField="卷軸列向上" || A_LoopField="卷軸列向上換頁" || A_LoopField="卷軸列向下" || A_LoopField="卷軸列向下換頁" || A_LoopField="遊戲選項" || A_LoopField="建築物列表向上換頁" || A_LoopField="建築物列表向下換頁" || A_LoopField="建築物列表向下卷動" || A_LoopField="列出部隊" || A_LoopField="列出建築物" || A_LoopField="部隊列表向上換頁" || A_LoopField="部隊列表向下換頁" || A_LoopField="部隊列表向下卷動" || A_LoopField="叫囂1" || A_LoopField="叫囂2" || A_LoopField="叫囂3" || A_LoopField="叫囂4" || A_LoopField="叫囂5" || A_LoopField="叫囂6" || A_LoopField="叫囂7" || A_LoopField="叫囂8" || keyen="")
continue
;~ MsgBox,% A_LoopField . "=" . %A_LoopField%
Control Choose,%AssignKey1%,ComboBox1,A
Control Choose,%AssignKey2%,ListBox1,A
Send,%keyen%
ControlClick,Gui:Assign,ahk_Class Red Alert 2,,,1,NA
}
}
}
BlockInput,Off
return
; --------------------------------------------------------------红警大厅界面
/*
*/
; --------------------------------------------------------------HKExpression
屏幕上方(左)()
{
global
CoordMode,Mouse,Screen
WinGetPos, , , Width, Height,A
if (A_ScreenWidth=Width) && (A_ScreenHeight=Height)
return
MouseGetPos,CurrentClickX,CurrentClickY
if ((CurrentClickX<A_ScreenWidth/2) && (CurrentClickY<ScreenPosUpDown))
return 1
}
屏幕上方(右)()
{
global
WinGetPos, , , Width, Height,A
if (A_ScreenWidth=Width) && (A_ScreenHeight=Height)
return
MouseGetPos,CurrentClickX,CurrentClickY
if ((CurrentClickX>A_ScreenWidth/2) && (CurrentClickY<ScreenPosUpDown))
return 1
}
屏幕左侧(上)()
{
global
CoordMode,Mouse,Screen
WinGetPos, , , Width, Height,A
if (A_ScreenWidth=Width) && (A_ScreenHeight=Height)
return
MouseGetPos,CurrentClickX,CurrentClickY
if ((CurrentClickX<ScreenPosUpDown) && (CurrentClickY<A_ScreenHeight/2))
return 1
}
屏幕左侧(下)()
{
global
CoordMode,Mouse,Screen
WinGetPos, , , Width, Height,A
if (A_ScreenWidth=Width) && (A_ScreenHeight=Height)
return
MouseGetPos,CurrentClickX,CurrentClickY
if ((CurrentClickX<ScreenPosUpDown) && (CurrentClickY>A_ScreenHeight/2))
return 1
}
屏幕右侧(上)()
{
global
CoordMode,Mouse,Screen
WinGetPos, , , Width, Height,A
if (A_ScreenWidth=Width) && (A_ScreenHeight=Height)
return
MouseGetPos,CurrentClickX,CurrentClickY
if (Width-CurrentClickX<ScreenPosUpDown && (CurrentClickY<A_ScreenHeight/2))
return 1
}
屏幕右侧(下)()
{
global
CoordMode,Mouse,Screen
WinGetPos, , , Width, Height,A
if (A_ScreenWidth=Width) && (A_ScreenHeight=Height)
return
MouseGetPos,CurrentClickX,CurrentClickY
if (Width-CurrentClickX<ScreenPosUpDown && (CurrentClickY<A_ScreenHeight/2))
return 1
}
双击()
{
if (A_PriorHotkey <> A_ThisHotkey || A_TimeSincePriorHotkey > 400)
{
KeyWait,%A_ThisHotkey%
return
}
return 1
}
;=======GuiMenu=======================================GuiMenu===============================================;
;---------------------------GuiControlAss子程序---------------------------;
GuiControlAss:
GuiControl,Choose,IME_Choice,% IMEName%IME_CN%
;~ If (IME_CN="ERROR")
;~ {
;~ GuiControl,,IME_Choice,|%IME_List%|^_~:你没有选择游戏中聊天的中文输入法
;~ GuiControl,Choose,IME_Choice,^_~:你没有选择游戏中聊天的中文输入法
;~ }
GuiControl,,WinRun,%WinRun%
GuiControl,,QQWinRun,%QQWinRun%
gosub,QQWinRun ;红警窗口化 不能用gosub,WinRun
GuiControl,,displayHIDDEN,%displayHIDDEN%
if displayHIDDEN<>0
{
GuiControl,hide,display_WH
GuiControl,hide,display_bit
GuiControl,hide,display_hz
GuiControl,hide,display_ra2
GuiControl,hide,winRun
GuiControl,hide,qqwinRun
}
else
{
GuiControl,show,display_WH
GuiControl,show,display_bit
GuiControl,show,display_hz
GuiControl,show,display_ra2
GuiControl,show,winRun
GuiControl,show,qqwinRun
}
;视图收缩
GuiControl,,returnBack,%returnBack%
GuiControl,,ClickOK,%ClickOK%
GuiControl,,GameIDDisable,%GameIDDisable% ;禁用ID
GuiControl,,ShiftClickBuild,%ShiftClickBuild%
GuiControl,,LButtonClickBuild,%LButtonClickBuild%
GuiControl,,RButtonRepair,%RButtonRepair%
GuiControl,,OpenObserve,%OpenObserve%
GuiControl,,Ra2_switch,%Ra2_switch%
GuiControl,,Ra2Move_switch,%Ra2Move_switch%
GuiControl,,LWin_switch,%LWin_switch%
GuiControl,,UpdateCheck,%UpdateCheck%
GuiControl,,ShowGui,%ShowGui%
GuiControl,Choose,ProjectChoice,%ProjectSelect%
GuiControl,,SW_HotStr,%SW_HotStr%
GuiControl,,SW_UDLR,%SW_UDLR%
str=% ViewTypeArray%ViewChoise%
GuiControl, +%str%, ListViewShortCut
; GuiControl,Hide,HK_Normal
GuiControl,Hide,HK_DDL
GuiControl,Hide,HK_Edit
/*; ---------------------取得所有小节名
GuiControlAss2nd:
GuiControl,,_KeyDelay,%_KeyDelay%
If MyRadioGroup=1
GuiControl,,标准,1
Else If MyRadioGroup=2
GuiControl,,鼠标,1
Else If MyRadioGroup=3
GuiControl,,高级,1
FileRead,str,Settings\%ProjectSelect%.ini
Pos=0
TreeView_Ra2HK_3=全局通用热键,红色警戒
loop
{
FoundPos :=RegExMatch(str, "(?<!=)\[(?<Name>(?!(Default|红色警戒|全局通用热键))([^\]]*?))\](?!=)(\s*)", SubPat,Pos+1)
If !FoundPos
Break
Pos+=FoundPos
TreeView_Ra2HK_3.=","SubPatName
; MsgBox,=%SubPatName%`n=%FoundPos%`n=%Pos%
}
全局通用热键TVID:=TV_Add("全局通用热键",0,"Expand")
工具助手(显示/隐藏)TVID:=TV_Add("工具助手(显示/隐藏)",全局通用热键TVID)
红色警戒TVID:=TV_Add("红色警戒",0,"Expand")
; AAAAA:=A_TickCount
; BBBBB:=A_TickCount
; MsgBox,% BBBBB-AAAAA
*/
gosub,HKTree1Label
Gui,TreeView,HKTree2
GuiControl, -Redraw,HKTree2
AddTree(TreeView_HK_1,PID=0)
TV_Modify(TV_GetNext(),"Expand") ;;Open第一个父项
TV_Modify(红色警戒TVID2,"Expand") ;;Open第二个父项
TV_Modify(界面热键TVID2,"Expand")
TV_Modify(控制热键TVID2,"Expand")
TV_Modify(建造热键TVID2,"Expand")
GuiControl, +Redraw,HKTree2
GuiControl,Choose,WinGetDDL,%WinGetDDL%
GuiControl, ,_KeyDelay,%_KeyDelay%
GuiControl,,_KeyDelaytext,%_KeyDelay%ms
/*
; ---------------------------自定义快捷键
; -------------非Tree的其他控件控制
Gosub HKGuiControl
GuiControl,,Check3view,%Check3view%
If Check3View=1
GuiControl,Hide,HKTree2
Else If Check3View=-1
{
GuiControl,Hide,HKTree2
GuiControl,Move,HKTree3,H255,X15 Y54 W295
}
*/
; -------------增编部队
;~ Name=游戏内置按键
;~ gosub TreeAdd
Hotkey, IfWinActive,ahk_group 红警游戏界面
loop 10
{
;~ str1:=% 選擇%A_Index%隊
;~ StringTrimRight,str1,選擇%A_Index%隊,1
;~ MsgBox %key1%
;~ StringReplace,str1,str1,`{
str1:=% 選擇%A_Index%隊
key1=~%str1%
;~ MsgBox,%key1%
Hotkey,%key1%,選擇%A_Index%隊,UseErrorLevel
;~ str2:=% 新增選擇%A_Index%隊
;~ StringTrimRight,str2,新增選擇%A_Index%隊,1
;~ StringReplace,str2,str2,`{
str2:=% 新增選擇%A_Index%隊
key2=~%str2%
Hotkey,%key2%,新增選擇%A_Index%隊,UseErrorLevel
;~ MsgBox %key1%=%key2%
}
;~ Name=游戏内置按键
;~ gosub TreeAdd
;~ MsgBox,%部署物件%=%下一個物件%
;~ MsgBox,%IMECN%=%下一個物件%
Hotkey, Space,, UseErrorLevel
if ErrorLevel not in 5,6
Hotkey,^Space,禁用按键
Hotkey,^Shift,禁用按键
Hotkey,+Ctrl,禁用按键
return
; -----------------------------------HKTree1
HKTree1Label:
Gui,TreeView,HKTree1
GuiControl, -Redraw,HKTree1 ;取消重绘提高性能
loop, Parse,TreeView_HK_1,CSV
{
_WinTitle:=A_LoopField
m:=TV_Add(_WinTitle,0,"Expand")
%_WinTitle%TVID:=m
TVName%m%:=_WinTitle
IniRead,str,Settings\%ProjectSelect%.ini,%_WinTitle%
if _WinTitle=全局通用热键
Hotkey, IfWinActive
else if _WinTitle<>红色警戒
Hotkey, IfWinActive,%_WinTitle%
else
{
建造热键TVID:=TV_Add("建造热键",红色警戒TVID)
TVName%建造热键TVID%=建造热键
建筑页面_QTVID:=TV_Add("建筑页面_Q",建造热键TVID)
防御页面_WTVID:=TV_Add("防御页面_W",建造热键TVID)
步兵页面_ETVID:=TV_Add("步兵页面_E",建造热键TVID)
车辆页面_RTVID:=TV_Add("车辆页面_R",建造热键TVID)
}
loop, Parse, str, `n, `r
{
StringSplit,Str,A_LoopField,=
if _WinTitle=红色警戒
{
IfInString,Str1,〖
Hotkey, IfWinActive,ahk_group 红警大厅界面
else
Hotkey, IfWinActive,ahk_group 红警游戏界面
}
StringGetPos, Pos, Str1,:映射
if pos >= 0
{
StringTrimLeft,HK,Str1,Pos+3
:映射%HK%:=Str2
Hotkey,% HKChangeEN(HK),红色警戒热键映射,UseErrorLevel
}
else ifInString,Str1,〈
{
StringLeft,M,Str2,1
if M=Q
M=建筑页面_Q
if M=W
M=防御页面_W
if M=E
M=步兵页面_E
if M=R
M=车辆页面_R
%Str2%=%Str1%
n:=TV_Add(A_LoopField,%M%TVID)
%Str1%TVID:=n
TVName%n%:=Str1
_%Str1%=有
continue
}
else
{
n:=-1
loop, Parse,Str2,︰
{
n++
%Str1%_%n%:=A_LoopField
}
HK:=HKChangeEN(%Str1%_0)
%Str1%_0:=n
;~ MsgBox,%_WinTitle%=%hk%
Hotkey,%HK%,%Str1%,UseErrorLevel
}
n:=TV_Add(A_LoopField,%_WinTitle%TVID)
;~ MsgBox,%_WinTitle%=%A_LoopField%
%Str1%TVID:=n
TVName%n%:=Str1
_%Str1%=有
}
;~ MsgBox,%_WinTitle%=%str%
}
;~ MsgBox,%Ra2Dir%
;-----------~ 游戏内置按键
游戏内置按键TVID:=TV_Add("游戏内置按键",红色警戒TVID)
TVName%游戏内置按键TVID%:=游戏内置按键
if !FileExist(Ra2Dir . "\ra2.exe")
{
TV_Add("┏ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ┓",游戏内置按键TVID)
TV_Add("┃ 没有找到红警, 请选择一个红警图标,用右键设为主要红警 ┃",游戏内置按键TVID)
TV_Add("┗ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ┛",游戏内置按键TVID)
}
else
TV_Add("红警路径:" . Ra2Dir . "\ra2.exe",游戏内置按键TVID)
IniRead Hotkeystr,%Ra2Dir%\Keyboard.ini,Hotkey
;~ MsgBox,%Hotkeystr%
F10check:=0
gosub,KeyBoardCGX
GuiControl, +Redraw,HKTree1
;----------------------------------------------------提示信息
str1:="鼠标左键:"
str2:="`n鼠标右键:"
loop,4
{
m:=A_Index
loop,2
{
loop,Parse,LVCustoMButton%m%_%A_Index%,CSV
{
IfInString,A_LoopField,=1
{
IfInString,A_LoopField,http
{
StringGetPos,n,A_LoopField,://
StringTrimLeft,str,A_LoopField,n+3
StringGetPos,n,str,/
StringLeft,str,str,n
}
else
{
StringTrimRight,str,A_LoopField,2
StringGetPos,n,str,\,R
StringTrimLeft,str,str,n+1
}
break
}
}
CustoMButton%m%_TT.=str%A_Index% . str
}
}
return
;~ 游戏内置按键
/*
Loop,Parse,ItemTextstr,CSV
{
If (A_LoopField=Name1)
TV_Add(
}
PID2 := TV_Add(Temp,PID)
AddTree(%Temp%,PID2)
Temp = %A_LoopField%
If %Temp% =
{
If % LV_%Temp%
%Temp%TVID:=TV_Add(Temp . "=" . LV_%Temp%,PID)
Else
%Temp%TVID:=TV_Add(Temp,PID)
}
Else
{
PID2 := TV_Add(Temp,PID)
%Temp%TVID:=PID2
;MsgBox,% Temp . "TVID:=" . PID2
AddTree(%Temp%,PID2)
If %Temp% =
{
If % LV_%Temp%
%Temp%TVID:=TV_Add(Temp . "=" . LV_%Temp%,PID)
Else
%Temp%TVID:=TV_Add(Temp,PID)
}
Else
{
PID2 := TV_Add(Temp,PID)
%Temp%TVID:=PID2
;MsgBox,% Temp . "TVID:=" . PID2
AddTree(%Temp%,PID2)
Return
*/
TreeAdd: ;创建树
loop,Parse,%Name%,CSV
{
Name:=A_LoopField
if (%Name%)
gosub,TreeAdd
else
{
IniRead var,%Ra2Dir%\Keyboard.ini,Hotkey,% %Name%en
%Name%:=Asckey(var)
;~ MsgBox,% %Name%
}
}
return
/*
读取红警快捷键:
MsgBox,%Name%
Loop,Parse,%Name%,CSV
{
Name:=%A_LoopField%
MsgBox,%Name%
If %Name%=
{
MsgBox,%Name%
Name=%A_LoopField%
GoSub,读取红警快捷键
}
else
GoSub,读取红警快捷键
}
Return
IniRead %A_LoopField%en,红警快捷键目录.ini,TreeView_Ra2HKTree2,%A_LoopField%
en:=%A_LoopField%en
; MsgBox,%en%
IniRead var,%Ra2Dir%\Keyboard.ini,Hotkey,%en%
If var=Error
TV_Modify(%A_LoopField%TVID,"Expand",A_LoopField . "-----(无)")
Else
{
%en%:=Asckey(var)
TV_Modify(%A_LoopField%TVID,"Expand",A_LoopField . "-----" . HKRePlaceStr(%en%))
}
*/
HKSwicthTS:
Gui,SubMit,NoHide
IniWrite %IME_TS% ,settings\%ProjectSelect%.ini, default,IME_TS
return
SetRa2_Switch:
Gui,Submit,NoHide
if Ra2_switch
TrayTip ,,共和国之辉已启用
else
TrayTip ,,共和国之辉已取消
IniWrite %Ra2_switch%,settings\%ProjectSelect%.ini, default,Ra2_switch
return
;~ #IfWinActive 红警工具
;~ ~LButton::
;~ While,GetKeyState("lbutton","p")
;~ PostMessage, 0xA1, 2
;~ PostMessage, 0xA1, 2,,, A
;~ Return
#Hotstring Z ? * O B0
#IfWinActive ahk_Class Red Alert 2,Gui:Players
:B:/9::
Suspend Permit
;~ Send ﹩ ------十字架
; 48887----3/4 %
; 47851------0e
; 45783-----雪花
; 43213-----两小点
;~ SetKeyDelay,0
Send,{Alt Down}{Numpad4}{Numpad3}{Numpad2}{Numpad1}{Numpad3}{Alt Up}{BackSpace}
;...................1234567afdkjf
Send,{Alt Down}{Numpad4}{Numpad5}{Numpad7}{Numpad8}{Numpad3}{Alt Up}{Left}{BackSpace}{Right}
Send,{Alt Down}{Numpad4}{Numpad3}{Numpad2}{Numpad1}{Numpad3}{Alt Up}{BackSpace}
return
:B:/8::
Suspend Permit
Send,{Alt Down}{Numpad4}{Numpad5}{Numpad7}{Numpad8}{Numpad3}{Alt Up}{Left}{BackSpace}
return
~WheelUp::
Suspend Permit
;~ SendMessage, 0x197,10, 0, %ListBoxGameList%, A
;~ return
MouseGetPos, , , , Control,A
IfInString,Control,ListBox
{
ControlGetPos,X,Y,W,H,%Control%,A
if W=204
{
X+=214
Y+=10
ControlClick, x%X% y%Y%,A,,,1, NA
}
else if W=425
{
X+=435
Y+=10
ControlClick, x%X% y%Y%,A,,,1, NA
}
else if W=195
{
X+=205
Y+=10
ControlClick, x%X% y%Y%,A,,,1, NA
}
;~ ToolTip,%ErrorLevel%
;~ return
;~ SendMessage, 0x18b, 0, 0, %ListBoxGameList%, A ; 0x18b is LB_GETCOUNT (for a ListBox).
;~ SendMessage, 390, (ErrorLevel-1), 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position ' one'
}
;~ tooltip % InStr(control,ListBox)
;~ If ((W<>195 && W<>215 && W<>425 && W<>445) || (InStr(control,"ListBox")=false))
if (W<>195 && W<>215 && W<>425 && W<>445)
{
;~ LastTick:=A_TickCount
;~ Loop 5
;~ {
;~ ControlGetPos,X,Y,W,H,ListBox%A_Index%
;~ If (W=204 || W=224)
;~ {
;~ ListBoxGameList=ListBox%A_Index%
;~ If W=204
;~ {
;~ X+=214
;~ Y+=30
;~ ControlClick, x%X% y%Y%,A,,,1, NA
;~ }
;~ }
;~ }
;~ SendMessage, 0x188, 0, 0, %ListBoxGameList%, A ; 0x18b is LB_GETCOUNT (for a ListBox).0x188=当前选择项LB_SETTOPINDEX := 0x197 LB_GETCURSEL := 0x188
;~ LB_CURSEL:=ErrorLevel
SendMessage, 0x18b, 0, 0, %ListBoxGameList%, A ; 0x18b is LB_GETCOUNT (for a ListBox).
SendMessage, 390, 0, 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position 'one'
SendMessage, 0x197,0, 0, %ListBoxGameList%, A
}
else if (A_TickCount - LastTick > 500 && (InStr(Control,"ListBox")=false))
{
SendMessage, 0x188, 0, 0, %ListBoxGameList%, A ; 0x18b is LB_GETCOUNT (for a ListBox).0x188=当前选择项LB_SETTOPINDEX := 0x197 LB_GETCURSEL := 0x188
LB_CURSEL:=ErrorLevel
;~ ToolTip,%LB_CURSEL%
;~ return
if LB_CURSEL<5
SendMessage, 0x197,0, 0, %ListBoxGameList%, A
else
SendMessage, 0x197,(LB_CURSEL-5), 0, %ListBoxGameList%, A
if LB_CURSEL>0
SendMessage, 390, (LB_CURSEL-1), 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position ' one'选定
else
SendMessage, 390, 0, 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position ' one'选定
;~ if ErrorLevel>0
;~ {
;~ SendMessage, 390, (ErrorLevel-1), 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position ' one'选定
;~ SendMessage, 0x197,% ErrorLevel-1, 0, %ListBoxGameList%, A
;~ }
;~ else
;~ {
;~ SendMessage, 0x197, 0, 0, %ListBoxGameList%, A
;~ ControlGetPos,X,Y,W,H,%ListBoxGameList%,A
;~ ControlClick, x%X% y%Y%,A,,,1, NA
;~ }
;~ ControlClick, %ListBoxGameList%,A,,,, NA x234 y10 Pos
;~ tooltip %ErrorLevel%
}
return
~WheelDown::
Suspend Permit
MouseGetPos, , , , Control,A
IfInString,Control,ListBox
{
ControlGetPos,X,Y,W,H,%Control%,A
if W=204
{
X+=214
Y+=H
ControlClick, x%X% y%Y%,A,,,1, NA
}
else if W=425
{
X+=435
Y+=H
ControlClick, x%X% y%Y%,A,,,1, NA
}
else if W=195
{
X+=205
Y+=H
ControlClick, x%X% y%Y%,A,,,1, NA
}
;~ ToolTip,%ErrorLevel%
;~ return
;~ SendMessage, 0x18b, 0, 0, %ListBoxGameList%, A ; 0x18b is LB_GETCOUNT (for a ListBox).
;~ SendMessage, 390, (ErrorLevel-1), 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position ' one'
}
IfInString,Control,BuTTON
{
SendMessage, 0x18b, 0, 0, %ListBoxGameList%, A
LB_COUNT:=ErrorLevel
;~ tooltip,%ErrorLevel%
SendMessage, 390, (LB_COUNT-1), 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position ' one'选定
SendMessage, 0x197,%LB_COUNT%, 0, %ListBoxGameList%, A
ControlClick,Gui:Join,A,,,1,NA
}
;~ else If ((W<>195 && W<>215 && W<>425 && W<>445) || (InStr(control,"ListBox")=false))
else if (W<>195 && W<>215 && W<>425 && W<>445)
{
SendMessage, 0x18b, 0, 0, %ListBoxGameList%, A ; 0x18b is LB_GETCOUNT (for a ListBox).
LB_CURSEL:=ErrorLevel
SendMessage, 390,(LB_CURSEL-1), 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position 'one'
SendMessage, 0x197,(LB_CURSEL-5), 0, %ListBoxGameList%, A
}
else if (A_TickCount - LastTick > 500 && (InStr(Control,"ListBox")=false))
{
SendMessage, 0x188, 0, 0, %ListBoxGameList%, A ; 0x18b is LB_GETCOUNT (for a ListBox).0x188=当前选择项
LB_CURSEL:=ErrorLevel
;~ ToolTip,%LB_CURSEL%
;~ return
if LB_CURSEL<5
SendMessage, 0x197,0, 0, %ListBoxGameList%, A
else
SendMessage, 0x197,(LB_CURSEL-3), 0, %ListBoxGameList%, A
;~ if LB_CURSEL>0
SendMessage, 390, (LB_CURSEL+1), 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position ' one'选定
;~ else
;~ SendMessage, 390, 0, 0, %ListBoxGameList%, A ; LB_SETCURSEL = 390 - position ' one'选定
}
return
~LButton::
Suspend Permit
MouseGetPos,LastClickX,LastClickY
if (A_TickCount-LButtonAtick>2000)
{
LButtonAtick:=A_TickCount
loop,5
{
ControlGetPos,,,width, ,ListBox%A_Index%,ahk_Class Red Alert 2
if width=442 ;----- (i=442 || i=429)
{
RedAlert_ChatFocus=ListBox%A_Index%
ControlFocus,%RedAlert_ChatFocus%,A
break
}
}
}
if LastClickX<50
{
;~ SetKeyDelay,1
Send,ga{Space}
Send,b{Space}
Send,g{Space}
Send,wh{Space}
Send,usr{Space}
Send,iyca{Space}
SendInput,.{Space}
Send,{Enter}
Sleep,100
Send,r{Space}
Send,iyca{Space}
Send,ghdh{Space}
Send,fjtf{Space}
Send,k{Space}
SendInput,.{Space}
Send,{Enter}
Sleep,200
;~ SetKeyDelay , -1, -1
}
if (LastClickX>Build_x1)
{
;~ Send,e{Space}
;~ Send,w{Space}
;~ Send,go{Space}
;~ Send,imya{Space}
;~ Send,usr{Space}
;~ Send,fblt{Space}
;~ Send,im{Space}
;~ SendInput,?{Space}
Send,22{Enter}
;~ Send,{Enter}
}
if LastClickY<20
{
;~ WinGet, ControlList, ControlList,A
;~ Loop,Parse,controlList,`n
;~ {
;~ IfInString,A_LoopField,ListBox
;~ {
;~ ControlGetPos,,,i,,%A_LoopField%
;~ If i=442
;~ {
;~ RedAlert_ChatFocus:=A_LoopField
;~ Loop
;~ {
;~ ControlFocus,%RedAlert_ChatFocus%,A
;~ if ErrorLevel
;~ Sleep,200
;~ else
;~ break
;~ }
;~ }
;~ }
;~ }
if (A_PriorHotkey <> "~LButton" or A_TimeSincePriorHotkey > 400)
{
KeyWait,LButton
WinGetPos , , , RedAlert_Width,,A
if (LastClickX>RedAlert_Width/2)
{
IfInString,IMEName%IME_CN%,五笔
{
Send 22{Enter}
Sleep,30
Send e{Space}w{Space}22im{Space}?{Enter}
}
else
{
Send 22{Enter}
Sleep,30
Send you{Space}ren{Space}22mei{Space}?{Enter}
}
}
else
{
IfInString,IMEName%IME_CN%,五笔
{
Send 11{Enter}
Sleep,30
Send e{Space}w{Space}11im{Space}?{Enter}
}
else
{
Send 11{Enter}
Sleep,30
Send you{Space}ren{Space}11mei{Space}?{Enter}
}
}
Sleep,30
return
}
Send 3{Enter}
Sleep,100
Send 2{Enter}
Sleep,100
Send 1{Enter}
Sleep,100
ControlClick,Gui:New,A,,,1,NA
Sleep,200
}
else if (A_PriorHotkey <> "~LButton" or A_TimeSincePriorHotkey > 400)
{
KeyWait,LButton
return
}
else
{
WinWaitActive,ahk_group 红警大厅界面,Gui:OK,0.5
if !ErrorLevel
{
ControlSend,Gui:OK,{Space}
;~ ControlFocus,%RedAlert_ChatFocus%,ahk_class Red Alert 2
;~ WinGet, ControlList, ControlList,ahk_class Red Alert 2
;~ Loop,Parse,controlList,`n
;~ {
;~ IfInString,A_LoopField,ListBox
;~ {
;~ ControlGetPos,,,i,,%A_LoopField%
;~ If i=442
;~ {
;~ RedAlert_ChatFocus:=A_LoopField
;~ Loop
;~ {
;~ ControlFocus,%RedAlert_ChatFocus%,ahk_class Red Alert 2
;~ if ErrorLevel
;~ Sleep,200
;~ else
;~ break
;~ }
;~ }
;~ }
;~ }
}
}
return
;~ #IfWinActive ahk_class Red Alert 2,GUI:Assign
;~ ~WheelUp::
;~ Suspend Permit
;~ MouseGetPos, , , , control,A
;~ ControlGetPos,X,Y,W,H,%control%,A
;~ X+=W+10
;~ Y+=10
;~ ControlClick, x%X% y%Y%,Red Alert,,,1, NA
;~ Return
;~ ~WheelDown::
;~ Suspend Permit
;~ Critical
;~ MouseGetPos, , , , control,A
;~ ControlGetPos,X,Y,W,H,%control%,A
;~ X+=W+10
;~ Y+=H
;~ ControlClick, x%X% y%Y%,Red Alert,,,1, NA
;~ Return
#IfWinActive ,ahk_Class Red Alert 2,Gui:None ;-----------------开始游戏0
~LButton::
Suspend Permit
MouseGetPos,mx , , , Control,A
ControlGet, OutputVar, Enabled, ,%Control%,A
if !OutputVar
return
IfInString,Control,ComboBox
{
ControlGetPos, x, , w, , %Control%,A
SendMessage, 0x146, 0, 0,%Control%,A
ChoiceCount := ErrorLevel
SendMessage, 0x147, 0, 0,%Control%,A
ChoicePos:=ErrorLevel+1
;~ tooltip % x+w-mx ;mx=%mx%x=%x%w=%w%%control%
if (x+w-mx>19)
{
;~ tooltip,mx=%mx%`nx=%x%`nw=%w%`nChoicePos=%ChoicePos%`ncontrol=%control%
if (w=151 || w=152)
{
if ChoicePos=1
{
if ChoiceCount>4
Control Choose,2,%Control%,A ;------关闭或观察(联网)
else
Control Choose,%ChoiceCount%,%Control%,A ;------冷酷的敌人(单机)
}
else
Control Choose,1,%Control%,A ;------开放(联网) 无(单机)
}
if (w=118 || w=119)
{
if ChoicePos<>8
Control Choose,8,%Control%,A ;------伊拉克
else
Control Choose,4,%Control%,A ;------法国
}
if (w=54 || w=55)
{
if ChoicePos<>2
Control Choose,2,%Control%,A ;------大色
else
Control Choose,%ChoiceCount%,%Control%,A ;------观察色
;~ tooltip,%ChoiceCount%=%control%mx=%mx%x=%x%w=%w%
}
}
}
;~ Else
;~ {
;~ send,g{enter 2}
;~ }
return
~WheelUp::
Suspend Permit
MouseGetPos,, , , Control,A
ControlGet, OutputVar, Enabled, ,%Control%,A
;~ tooltip,control=%control%
if !OutputVar
return
IfInString,Control,ComboBox
{
;~ Control ShowDropDown,,%control%
SendMessage, 0x146, 0, 0,%Control%,A
ChoiceCount := ErrorLevel
SendMessage, 0x147, 0, 0,%Control%,A
ChoicePos := ErrorLevel
ControlGetPos, , , w, , %Control%,A
if ((w=54 || w=55) && ChoicePos=1) ;;---------颜色
return
if ChoicePos=0
return
;~ tooltip,%ChoicePos%
Control Choose,%ChoicePos%,%Control%,A
}
return
~WheelDown::
Suspend Permit
MouseGetPos, , , , Control,A
ControlGet, OutputVar, Enabled, ,%Control%,A
;~ tooltip,control=%control%
if !OutputVar
return
IfInString,Control,ComboBox
{
;~ Control ShowDropDown,,%control%
SendMessage, 0x146, 0, 0,%Control%,A
ChoiceCount := ErrorLevel
SendMessage, 0x147, 0, 0,%Control%,A
ChoicePos := ErrorLevel+2
if (ChoicePos>ChoiceCount)
return
;~ tooltip ErrorLevel=%ErrorLevel%`nChoicePos=%ChoicePos%`nChoiceCount=%ChoiceCount%
Control Choose,%ChoicePos%,%Control%,A
}
return
/*
;~ if A_Index=1 ;--------====自己开的游戏
;~ {
;~ SendMessage, 0x146, 0, 0,ComboBox9,A
;~ if ErrorLevel>4
;~ {
;~ SendMessage, 0x147, 0, 0, ComboBox8,A
;~ tooltip,=%ErrorLevel%=
;~ If ErrorLevel<>1
;~ ComboBoxn=ComboBox23
;~ }
;~ else
;~ ComboBoxn=ComboBox22 ;------------判断单机游戏
;~ Else
;~ {
;~ ControlGetPos, , , w, , ComboBox%A_Index%,A
;~ tooltip,=%w%=
;~ if w<100
;~ {
;~ ComboBoxn=ComboBox%A_Index%
;~ break
;~ }
;~ }
;~ }
}
controlget,Boxv,Enabled,,%ComboBoxn%,A
SendMessage, 0x147, 0, 0, %ComboBoxn%,A
;~ tooltip,=%ErrorLevel%=%ComboBoxn%
if (ErrorLevel=0 && Boxv) ; 如果没有选中的条目, 那么它会为 -1.
Control Choose,2,%ComboBoxn%,A
else
SetTimer,ComboBoxCheck,Off
;~ tooltip ComboBoxn=%ComboBoxn% ;`nChoicePos=%ChoicePos%`nOpenObserve=%OpenObserve%
Control Choose,1,%control%,A
return
*/
~F1::
~F2::
~F3::
~F4::
~F5::
~F6::
~F7::
~F8::
~F9::
~F10::
Suspend Permit
StringRight,str,A_ThisHotkey,1
if str=0
StringRight,str,A_ThisHotkey,2
loop 24
{
ControlGet,ComboBoxv,Enabled,,ComboBox%A_Index%,A
if ComboBoxv=1
{
n:=A_Index+8
ComboBoxn=ComboBox%n%
break
}
}
Control Choose,%str%,%ComboBoxn%,A
;~ Control Choose,%str%,%ComboBoxn%,A
return
#IfWinActive ahk_group 红警大厅界面
F1::
;~ Control, Enabled,,%listbox135%,ahk_class Red Alert 2
return
~RButton::
Suspend Permit
MouseGetPos, , , , Control,A
IfInString,Control,ListBox
{
ControlGetPos,,,W,,%Control%,A
;~ tooltip,%w%
if (W=224 || W=204)
{
Click,2
WinWaitActive,ahk_group 红警大厅界面,Gui:OK,0.5
if !ErrorLevel
ControlSend,Gui:OK,{Space}
return
}
}
if returnBack
{
IfWinActive,ahk_group 红警大厅界面,Gui:ResumeMission
ControlClick, Gui:ResumeMission,ahk_group 红警大厅界面,,,1,NA
IfWinActive,ahk_group 红警大厅界面,Gui:continue
ControlClick, Gui:continue,ahk_group 红警大厅界面,,,1,NA
IfWinActive,ahk_group 红警大厅界面,Gui:Network
ControlClick, Gui:Network,ahk_group 红警大厅界面,,,1,NA
IfWinActive,ahk_group 红警大厅界面,Gui:return
ControlClick, Gui:return,ahk_group 红警大厅界面,,,1,NA
IfWinActive,ahk_group 红警大厅界面, Gui:MainMenu
ControlClick, Gui:MainMenu,ahk_group 红警大厅界面,,,1,NA
IfWinActive,ahk_group 红警大厅界面,Gui:Back
ControlClick, Gui:Back,ahk_group 红警大厅界面,,,1,NA
}
return
:B://::
Suspend,Permit
ControlClick, Gui:MainMenu,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:Options,30
ControlClick, Gui:Options ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:Keyboard,30
ControlClick, Gui:Network ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:SocketNumber,30
ControlSend, ListBox3,{BS 4},ahk_Class Red Alert 2
Sleep,300
Send,{Tab}
Sleep,300
ControlClick, Gui:Ok ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:MainMenu,30
ControlClick, Gui:MainMenu,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2,Gui:ExitGame,30
ControlClick, Gui:Network ,ahk_Class Red Alert 2,,,1,NA
return
:B:/.::
Suspend,Permit
ControlClick, Gui:MainMenu,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:Options,5
ControlClick, Gui:Options ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:Keyboard,5
ControlClick, Gui:Network ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:SocketNumber,5
ControlSend, ListBox3,{BS 5}%gamecode1%,ahk_Class Red Alert 2
Sleep,250
Send,{Tab}
Sleep,200
Send,{Tab}
Sleep,200
ControlClick, Gui:Ok ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:MainMenu,5
ControlClick, Gui:MainMenu,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2,Gui:ExitGame,5
ControlClick, Gui:Network ,ahk_Class Red Alert 2,,,1,NA
return
:B:/,::
Suspend,Permit
ControlClick, Gui:MainMenu,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:Options,5
ControlClick, Gui:Options ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:Keyboard,5
ControlClick, Gui:Network ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:SocketNumber,5
ControlSend, ListBox3,{BS 5}%gamecode2%,ahk_Class Red Alert 2
Sleep,250
Send,{Tab}
Sleep,200
Send,{Tab}
Sleep,200
ControlClick, Gui:Ok ,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2, Gui:MainMenu,5
ControlClick, Gui:MainMenu,ahk_Class Red Alert 2,,,1,NA
WinWaitActive,ahk_Class Red Alert 2,Gui:ExitGame,5
ControlClick, Gui:Network ,ahk_Class Red Alert 2,,,1,NA
return
#IfWinActive ahk_group 红警游戏界面
~NumpadEnter::
~Enter::
Suspend,Permit
IME:=DllCall("GetKeyboardLayout","UINT",DllCall("GetWindowThReadProcessId","UINT",WinActive("A"),"UINTP",0),UInt)
if GameFrame1=1
{
Critical
SetCapsLockState, Off
if IsChatting()
{
if (IME<>IME_EN)
PostMessage, 0x50, 0, %IME_EN%,,A
if A_IsSuspended
Suspend,Off
}
else
{
if (IME<>IME_CN)
PostMessage, 0x50, 0, %IME_CN%,,A
if !A_IsSuspended
Suspend,On
}
SetTimer ReadMemorycheck,On
}
else
{
if (IME<>IME_CN)
PostMessage, 0x50, 0, %IME_CN%,,A
if !A_IsSuspended
Suspend,On
}
return
ReadMemorycheck:
IfWinActive ahk_Class Red Alert 2
{
IME:=DllCall("GetKeyboardLayout","UINT",DllCall("GetWindowThReadProcessId","UINT",WinActive("A"),"UINTP",0),UInt)
if ReadMemory(0x00865FF8,gamepid)
{
if (IME<>IME_CN)
PostMessage, 0x50, 0, %IME_CN%,,A
if !A_IsSuspended
Suspend,On
}
else
{
if (IME<>IME_EN)
PostMessage, 0x50, 0, %IME_EN%,,A
if A_IsSuspended
Suspend,Off
}
if GetKeyState("RButton","P")
SetTimer,ReadMemorycheck,Off
}
return
;---------------------函数
ReadMemory(MADDRESS,gamepid)
{
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", gamepid, "UInt") ;-----备份 gamepid
;~ ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", DllCall("GetCurrentProcessId"), "UInt")
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("CloseHandle", "int", ProcessHandle)
;~ tooltip,==%MVALUE%==
return, MVALUE
}
~+LButton::
if ShiftClickBuild
{
MouseGetPos LastClickX,LastClickY
if ((LastClickX>Build_x1) And (LastClickY>Build_y1))
Click,% ClickBuildNum-1
}
return
~+RButton::
if ShiftClickBuild
{
MouseGetPos LastRClickX,LastRClickY
if ((LastRClickX>Build_x1) And (LastRClickY>Build_y1))
{
ControlClick,x%LastRClickX% y%LastRClickY%,A,,Right,30,NA
Sleep,0
}
}
return
~LButton::
MouseGetPos,LastRClickX,LastRClickY
;~ ToolTiP,%LastRClickX%=%Build_x1%
StartTime := A_TickCount
if ((A_PriorHotkey <> "~LButton") or A_TimeSincePriorHotkey > 400)
{
LButtonx1:=LastRClickX
LButtony1:=LastRClickY
while GetKeyState("LButton","P")
{
;~ tooltip 78888
if ((LastRClickX>Build_x1) && (LastRClickY>Build_y1))
{
if (LButtonClickBuild && (A_TickCount - StartTime > 500))
Click 1
}
else if (GetKeyState("RButton","P"))
{
gosub ,心灵信标
;~ tooltip 7
break
return
}
}
KeyWait, LButton
return
}
MouseGetPos,LButtonx2,LButtony2
if ((LButtonx1=LButtonx2) && (LButtony1=LButtony2))
{
ImageSearch, A,B,LButtonx1-20,LButtony1-16, LButtonx1+23, LButtony1+16,*TransBlack Images\禁止.bmp
if ErrorLevel =0
{
KeyWait, LButton,T0.5
Send %選擇種類%
;~ tooltip,=%選擇種類%
}
}
return
~RButton::
MouseGetPos,LastRClickX,LastRClickY
;~ ImageSearch, ,,LastRClickX-300,LastRClickY-300,LastRClickX, LastRClickY,*TransBlack Images\受伤.bmp
ImageSearch, ,,LastRClickX-300,LastRClickY-300,LastRClickX, LastRClickY,*TransWhite Images\受伤.bmp
ImageSearchErrorLevel:=ErrorLevel
;~ tooltip,=%ImageSearchErrorLevel%=
StartTime := A_TickCount
if ((LastRClickX>Build_x1) && (LastRClickY>Build_y1) && LButtonClickBuild)
{
while GetKeyState("RButton","P")
if (A_TickCount - StartTime > 500)
Click Right
}
else if RButtonRepair=1
{
while GetKeyState("RButton","P")
;~ if (A_TickCount - StartTime > 300)
;~ return
;~ tooltip,9
MouseGetPos,LButtonx2,LButtony2
if ((LastRClickX=LButtonx2) && (LastRClickY=LButtony2))
{
;~ ImageSearch, A,B,LastRClickX-300,LastRClickY-300,LastRClickX, LastRClickY,*TransWhite Images\受伤.bmp
if ImageSearchErrorLevel =0
{
;~ KeyWait,RButton
;~ Send,t
;~ Sleep,100
;~ Send,{LButton}
;~ Sleep,100
;~ Send,t
;~ KeyWait,RButton
Send,%修護模式%
Sleep,100
Send,{LButton}
Sleep,100
Send,%修護模式%
;~ tooltip,好的
}
;~ tooltip,好的
}
;~ Else
;~ tooltip,不对
}
return
;~ !s::!i
;~ !d::!o
~q::
LastQWER:=1
if Ra2_switch
{
MouseGetPos ClickX,ClickY
if ((ClickX<Build_x1) || (ClickY<Build_y1))
{
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,*Trans00FFFF Images\伊军就绪.bmp
if ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,*Trans00FFFF Images\盟军就绪.bmp
if ErrorLevel=0
ControlClick,x%ClickX% y%ClickY%,A,,,1,NA
}
}
return
~w::
LastQWER:=2
if Ra2_switch
{
MouseGetPos ClickX,ClickY
if ((ClickX<Build_x1) || (ClickY<Build_y1))
{
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,*Trans00FFFF Images\伊军就绪.bmp
if ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,*Trans00FFFF Images\盟军就绪.bmp
if ErrorLevel=0
ControlClick,x%ClickX% y%ClickY%,A,,,1,NA
}
}
return
!w::
;~ MouseGetPos,X,Y
;~ ToolTip,%Build_x1%=%Build_y1%---%X%=%Y% 18 67 26 16
;~ MouseMove,Build_x1+50,% Build_y1-10
if LastQWER<>2
{
x:=Build_x1+50
y:=Build_y1-10
ControlClick,x%x% y%y%,A,,,1,NA
Sleep,100
}
;~ ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\伊军就绪.bmp
;~ If ErrorLevel
;~ ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\盟军就绪.bmp
;~ If ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\空降部队.bmp
if ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\铁幕装置【施放】.bmp
if ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\超时空传送仪【施放】.bmp
if ErrorLevel=0
{
ControlClick,x%ClickX% y%ClickY%,A,,,1,NA
Sleep,50
}
return
~e Up::
LastQWER:=3
;~ tooltip,% A_PriorHotkey
If(A_PriorHotkey<>"::qe" && A_PriorHotkey<>"::we" && A_PriorHotkey<>"::ee" && A_PriorHotkey<>"::re")
Send ,9
return
~r Up::
LastQWER:=4
If(A_PriorHotkey<>"::qr" && A_PriorHotkey<>"::wr" && A_PriorHotkey<>"::er" && A_PriorHotkey<>"::rr")
Send ,0
return
::e2::
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\警犬【盟】.bmp
if ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\警犬【苏】.bmp
if ErrorLevel=0
{
ControlClick x%ClickX% y%ClickY%,A,,,2,NA
Sleep,50
LastClickX:=ClickX
LastClickY:=ClickY
}
else SoundPlay,%A_ScriptDir%\Sound\Menu Popup.wav
return
::e3::
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\警犬【盟】.bmp
if ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\警犬【苏】.bmp
if ErrorLevel=0
{
ControlClick x%ClickX% y%ClickY%,A,,,3,NA
Sleep,50
LastClickX:=ClickX
LastClickY:=ClickY
}
else SoundPlay,%A_ScriptDir%\Sound\Menu Popup.wav
return
::r2::
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\灰熊坦克.bmp
if ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\犀牛坦克.bmp
if ErrorLevel=0
{
ControlClick x%ClickX% y%ClickY%,A,,,2,NA
Sleep,50
LastClickX:=ClickX
LastClickY:=ClickY
}
else SoundPlay,%A_ScriptDir%\Sound\Menu Popup.wav
return
::r3::
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\灰熊坦克.bmp
if ErrorLevel
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\犀牛坦克.bmp
if ErrorLevel=0
{
ControlClick x%ClickX% y%ClickY%,A,,,3,NA
Sleep,50
LastClickX:=ClickX
LastClickY:=ClickY
}
else SoundPlay,%A_ScriptDir%\Sound\Menu Popup.wav
return
MButton::
Send, {Ctrl Down}
loop
{
if GetKeyState("LButton", "P") || GetKeyState("RButton", "P")
break
;~ while not GetKeyState("LButton", "P")
;~ {
Click
Sleep,50
}
Send, {Ctrl Up}
Send,%物件停止%
;~ KeyWait,LButton,Up
;~ KeyWait,RButton,Up
;~ Sleep,500
;~ Send,%物件停止%
return
::qe::
::qr::
::qd::
::qf::
::qc::
::qv::
::qt::
::qg::
::qb::
::qb::
::we::
::wr::
::wd::
::wf::
::wc::
::wv::
::wt::
::wg::
::wb::
::ee::
::er::
::ed::
::ef::
::ec::
::ev::
::et::
::eg::
::eb::
::re::
::rr::
::rd::
::rf::
::rc::
::rv::
::rt::
::rg::
::rb::
::rh::
::ra::
::rs::
::rz::
::rx::
StringTrimLeft, OutputVar, A_ThisHotkey,2
StringLeft, OutputVar4, OutputVar,1
if (%OutputVar%)
{
StringLeft,OutputVar3,OutputVar,1
StringRight, OutputVar2, OutputVar,1
;~ tooltip,% A_ThisHotkey
OutputVar:=%OutputVar%
ImageSearchErrorLevel:=1
;~ tooltip,% %OutputVar%︰ . "======"
loop,Parse, %OutputVar%︰,CSV
{
Imag:=A_LoopField
;~ MsgBox,% Imag ;名
;~ tooltip,% OutputVar4 ;首字母
if (OutputVar4="e" || OutputVar4="r")
{
;; 优先建造等待中的
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\(等待).bmp
if ErrorLevel=0
{
ControlClick x%ClickX% y%ClickY%,A,,,,NA
Sleep,20
LastControlClickX:=ClickX
LastControlClickY:=ClickY
ImageSearchErrorLevel:=0
}
else
{
; 包含建造中的
loop,2
{
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\%Imag%%A_Index%.bmp
;~ MsgBox,%Imag%%A_Index% ;图片名
if ErrorLevel=0
{
ControlClick x%ClickX% y%ClickY%,A,,,,NA
Sleep,20
LastControlClickX:=ClickX
LastControlClickY:=ClickY
ImageSearchErrorLevel:=0
break
}
}
}
}
else
{
ImageSearch,ClickX,ClickY,Build_x1,Build_y1,Build_x2,Build_y2,Images\%Imag%.bmp
if ErrorLevel=0
{
ControlClick x%ClickX% y%ClickY%,A,,,,NA
Sleep,20
LastControlClickX:=ClickX
LastControlClickY:=ClickY
ImageSearchErrorLevel:=0
}
}
if ImageSearchErrorLevel=0
break
}
if ImageSearchErrorLevel
SoundPlay,%A_ScriptDir%\Sound\Menu Popup.wav
Lastclick_:
if (OutputVar3<>"q" || OutputVar3<>"w")
{
Input, UserInput,I T3 V,qweras,%OutputVar2%
if UserInput = %OutputVar2%
{
;~ ToolTip,%UserInput%
ControlClick x%LastControlClickX% y%LastControlClickY%,A,,,,NA
Sleep,20
goto,LastClick_
}
;~ SetTimer,Lastclick_
}
}
else
{
StringRight, OutputVar4, OutputVar,1
Send,%OutputVar4%
;~ if (OutputVar4="e" || OutputVar4="r")
;~ {
}
return
#IfWinActive ahk_Class QQBattle_MainFrame
~LButton::
MouseGetPos ,,,,OutputVaRControl
if OutputVaRControl=Afx:400000:31
{
TrayTip,,双击挤厅
KeyWait, LButton ,, t0.5
if ErrorLevel=1
return
else
KeyWait, LButton, d, t0.1
if ErrorLevel = 0
SetTimer,QQ对战平台
}
if OutputVaRControl=Button12
{
Sleep,1000
WinHide ahk_Class QQBattle_MainFrame
}
return
QQ对战平台:
MouseGetPos ,,,,OutputVaRControl
IfWinNotExist,QQ对战平台
{
SetTimer,QQ对战平台,Off
TrayTip,,QQ平台已退出
}
IfWinExist, QQ对战平台,对不起
ControlClick,确定,QQ对战平台,对不起
else ifWinExist, 错误,确定
{
ControlClick,确定,错误
WinWaitClose,错误,确定,10
ControlClick,Afx:400000:31,ahk_Class QQBattle_MainFrame,,,1,NA
}
else if OutputVaRControl<>Afx:400000:31
{
SetTimer,QQ对战平台,Off
SoundPlay,Sound\Science Menu command.wav
TrayTip,,挤厅已停止
}
return
;~ #IfWinActive 登录失败
;~ ~LButton::
;~ Sleep,500
;~ Run C:\windows\System32\rasphone.exe -h "宽带连接"
;~ Sleep,500
;~ Run C:\windows\System32\rasphone.exe -d "宽带连接"
;~ Return
#IfWinActive,,FolderView
#H::
RegRead,value,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\, Hidden
If(value=1)
value = 2
else
value = 1
RegWrite, Reg_DWORD, HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\, Hidden, %Value%
RegWrite, Reg_DWORD, HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\, ShowSuperHidden, %Value%-1
SendInput +{F10}e
return
#L::
RegRead,Value,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\,HideFileExt
If(value=0)
value = 1
else
value = 0
RegWrite, Reg_DWORD,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\,HideFileExt, %Value%
SendInput +{F10}e
return
^!C::
clipold=%Clipboard%
Clipboard=
SendInput ^c
ClipWait, 0.5
if ErrorLevel
{
Clipboard=%clipold%
return
}
Clipboard=%Clipboard%
ToolTip,%Clipboard%
Sleep,1000
ToolTip,
return
;;------------------全局熱鍵
#IfWinActive
+^F11::
Suspend Permit
MouseGetPos, , , id, Control
WinGetTitle, title, ahk_id %id%
WinGetClass, Class, ahk_id %id%
ToolTip, ahk_id %id%`nahk_Class %Class%`n%title%`nControl: %Control%
Sleep,5000
ToolTip
return
;~ Red Alert 2 +5 TRAiNERRed Alert 2 +5 TRAiNER
~NumpadAdd & NumpadSub::
Suspend Permit
IfExist,%A_ScriptDir%\Update\Ra2Trainer.exe
{
IfWinNotExist,ahk_Class TForm1
{
Run,%A_ScriptDir%\Update\Ra2Trainer.exe
WinWaitActive,ahk_Class TForm1,,10
SetTimer,WinActivateRa2,500
}
else
{
WinClose,ahk_Class TForm1
SoundPlay,Sound\download-complete.wav
}
}
return
~NumpadAdd & Numpad6::
Suspend Permit
IfWinActive ,ahk_Class Red Alert 2
{
IfExist,%A_ScriptDir%\Update\RA2Trn +5(v1.006).exe
{
;~ Run,%A_ScriptDir%\Update\RA2Trn +5(v1.006).exe,Hide
IfWinNotExist,Red Alert 2 +5 TRAiNER
{
Run,%A_ScriptDir%\Update\RA2Trn +5(v1.006).exe,,Min
WinWait,Red Alert 2 +5 TRAiNER,,10
Sleep, 500
WinHide
SoundPlay,Sound\shake.wav
SetTimer,WinActivateRa2,500
Hotkey,IfWinActive,ahk_Class Red Alert 2
Hotkey,F5,禁用按键
Hotkey,F6,禁用按键
Hotkey,F7,禁用按键
Hotkey,F9,一键观战
}
else
{
WinClose,Red Alert 2 +5 TRAiNER
SoundPlay,Sound\CompleteD.wav
}
}
}
return
WinActivateRa2:
Sleep,1000
if (WinExist("ahk_Class Red Alert 2") && !WinActive("ahk_Class Red Alert 2"))
WinActivate,ahk_Class Red Alert 2
else
;~ MsgBox,,有
SetTimer,WinActivateRa2,Off
;~ #WheelUp::
;~ Suspend Permit
;~ 音量("+")
;~ Return
;~ #WheelDown::
;~ Suspend Permit
;~ 音量("-")
;~ Return
#If MouseIsOver("ahk_Class Shell_TrayWnd")
WheelUp::
MouseGetPos ,,Y
if A_ScreenHeight-Y<30
{
if A_OSVersion Not in WIN_XP,WIN_2003
{
master_v := Floor(VA_GetMasterVolume())
master_v += 1
if(master_v > 100)
master_v := 100
VA_SetMasterVolume(master_v)
ToolTip,%master_v%
SetTimer,removeToolTip,-1000
}
else
SoundSet ,+2
}
return
WheelDown::
MouseGetPos ,,Y
if A_ScreenHeight-Y<30
{
if A_OSVersion Not in WIN_XP,WIN_2003
{
master_v :=Floor(VA_GetMasterVolume())
master_v -= 1
if(master_v > 100)
master_v := 100
;~ ToolTip,% master_v
VA_SetMasterVolume(master_v)
ToolTip,%master_v%
SetTimer,removeToolTip,-1000
}
else
SoundSet ,-2
}
return
/*
;~ 游戏列表:----------------------------------------
GameAssign:
GuiControlGet,GameAssign
Return
GameListGuiClose:
Settimer,CheckGameList,Off
Gui, GameList:Default
;~ MsgBox,%A_GuiX%
WinGetPos,GameListPosX,GameListPosY,,,A
IniWrite,%GameListPosX%,Default.ini,Default,GameListPosX
IniWrite,%GameListPosY%,Default.ini,Default,GameListPosY
Gui,Destroy
Gui, 1:Default
Return
GameListLButtonUp:
WinGetPos,GameListPosX,GameListPosY,,,ahk_id %GameListhwnd%
IniWrite,%GameListPosX%,Default.ini,Default,GameListPosX
IniWrite,%GameListPosY%,Default.ini,Default,GameListPosY
Return
GameListGuiContextMenu:
menu,GameListMenu,show
Return
GameListMenuLabel:
GameListJoin:=!GameListJoin
If GameListJoin=1
{
Settimer,CheckGameList,1000
menu,GameListMenu,Rename,开始,取消
}
Else
menu,GameListMenu,Rename,取消,开始
Return
CheckGameList:
;~ if GameFrame1=3
if GameFrame1<1
{
Loop 5
{
ControlGetPos,X,Y,W,H,ListBox%A_Index%,ahk_class Red Alert 2,GUI:Players
If (W=204 || W=224) ;游戏列表
{
ListBoxGameList=ListBox%A_Index%
;~ If W=204
;~ {
;~ X+=214
;~ Y+=H-30
;~ ControlClick, x%X% y%Y%,ahk_class Red Alert 2,,,1, NA
;~ }
}
If (W=195 || W=215) ;ID列表
{
ListBoxIDList=ListBox%A_Index%
}
}
SendMessage, 390, 0, 0, %ListBoxGameList%, ahk_class Red Alert 2 ; LB_SETCURSEL = 390 - position 'one'选择首行
SendMessage, 0x18b, 0, 0, %ListBoxGameList%, ahk_class Red Alert 2 ; 0x18b is LB_GETCOUNT (for a ListBox).计算行数
GameListN:=ErrorLevel-1
SendMessage, 0x18b, 0, 0, %ListBoxIDList%, ahk_class Red Alert 2 ; 0x18b is LB_GETCOUNT (for a ListBox).
IDListN:=ErrorLevel
StatusBarStr=大厅人数: %IDListN% 游戏数: %GameListN%
;~ tooltip,%GameListN%
Gui, GameList:Default
SB_SetText(StatusBarStr)
;~ MsgBox,%str%
;~ Guicontrol,,GameListN,当前人数: %IDListN%`t游戏数: %GameListN%
if( GameListJoin=1 && (IDListN<>IDListN_))
{
;~ tooltip,有
SoundPlay,Sound\click.wav
IDListN_:=IDListN
SendMessage, 0x18b, 0, 0, %ListBoxGameList%, ahk_class Red Alert 2 ; 0x18b is LB_GETCOUNT (for a ListBox).计算行数
SendMessage, 390, (ErrorLevel-1), 0, %ListBoxGameList%, ahk_class Red Alert 2 ; LB_SETCURSEL = 390 - position ' one'
ControlClick,GUI:Join,ahk_class Red Alert 2,,,1,NA
SetTimer,WinActivateRa2,500
WinWait,ahk_class Red Alert 2,GUI:OK,0.5
if !ErrorLevel
ControlSend,GUI:OK,{Space},ahk_class Red Alert 2
WinWait,ahk_class Red Alert 2,GUI:None,1
if !ErrorLevel
{
;~ tooltip,有
;~ WinActivate,ahk_class Red Alert 2
;~ SetTimer,WinActivateRa2,500
if GameAssign=1
ControlClick,GUI:Assign,ahk_class Red Alert 2,,,1,NA
;~ if GameFrame1=1
Settimer,CheckGameList,Off
menu,GameListMenu,Rename,取消,开始
GameListJoin:=!GameListJoin
;~ WinGetPos,GameListPosX,GameListPosY,,,A
;~ IniWrite,%GameListPosX%,Default.ini,Default,GameListPosX
;~ IniWrite,%GameListPosY%,Default.ini,Default,GameListPosY
}
}
}
Return
*/
MouseIsOver(WinTitle) ;==========函数
{
MouseGetPos,,y, Win
;~ MsgBox,% WinTitle . " ahk_id " . Win
if (WinExist(WinTitle . " ahk_id " . Win) || A_ScreenHeight-y<10)
return 1
}
积分不够,评论来凑。