├── README.md └── AetherGazer.ahk /README.md: -------------------------------------------------------------------------------- 1 | 2 | 免责声明: 3 | 4 | 这是ahk按键脚本,而不是外挂,没有注入和修改数据,只是模拟键盘鼠标,所以说不会被封。目前脚本发布至今没有因使用脚本被封号的案例,但仍有风险,勇士对按键脚本的态度可能改变,所以如果造成封号或其他问题,本工具作者不承担任何责任。 5 | 6 | --- 7 | 8 | [视频教程](https://www.bilibili.com/video/BV1ZxxmeDEdn/) 9 | 10 | 11 | 12 | 1.请确保游戏分辨率设置为1280x720 13 | 14 | 2.自定义战斗界面如果有自定义,使用脚本时请还原为默认(部分角色自动战斗需要识别按键状态来出招,改变按键位置会导致出招异常。游戏中有4个按键布局预设) 15 | 16 | 3.初次使用请在托盘图标右键→快捷键设置:设置快捷键与你游戏内快捷键对应。默认状态下与游戏默认按键相同,如果没改过默认按键可跳过这步。 17 | 18 | 4.多维刷分要求解锁20难度,解锁角色真红,解锁信标:赏金猎人、孤狼之道、残酷天平。(考虑到大部分玩家都已解锁,增加这些设置能让刷分速度大幅提高。) 19 | 20 | 5.多维如果运行不正确,退出深空之眼脚本,用管理员权限试半识别模式.exe,若仍不能正常运行,试用不识别模式.exe(不识别模式只模拟点击和延时,战斗固定设置1分钟,所以战斗完会卡在选择珍宝画面不动一会儿请耐心等待。)。 21 | 22 | 如果以上操作多维仍不可以正常刷分,尝试在windows显示设置中将缩放调整到100%,再行尝试。或将游戏画面设置调整为:帧数60,阴影等级高,后处理高,抗锯齿开,垂直同步开,超分辨率1.0 23 | 24 | --- 25 | 默认设置:可在托盘菜单自行更改键位 26 | 27 | 小键盘1:金乌自动出招 28 | 29 | 小键盘2:多维变量自动刷分 30 | 31 | 小键盘3:陵光自动出招 32 | 33 | 小键盘4:托特/哈迪斯/雷前鬼/水姆自动出招 34 | 35 | 小键盘5:娜美自动出招 36 | 37 | 小键盘6:薇儿/光赫拉/瓦吉特/执明自动出招(薇儿的自动战斗适用于潜质觉醒中所有薇儿变体的自动战斗,包括神能训练,意志训练,技巧训练,侵蚀抵抗)。 38 | 39 | 小键盘7:闲暇时刻自动烤肉 40 | 41 | 小键盘9:简易按键连点器(右ctrl+任意键=连点该键) 42 | 43 | Ctrl+小键盘1:梵天自动出招,注意:队友帕尔瓦蒂必须放2号位(最左边),且不安装惊澜芯片,否则会扰乱输出循环 44 | 45 | Ctrl+小键盘2:诗寇蒂自动出招 46 | 47 | Ctrl+小键盘3:樱切自动出招 48 | 49 | Ctrl+小键盘4:亚莉莎自动出招 50 | 51 | 小键盘0:停止运行中的操作 52 | 53 | 自动刷熟练度:点开游戏键位设置,将继续挑战快捷键设置为技能1按键,选择历战回响第一关,从第一层开始按小键盘6自动刷角色熟练度。 54 | -------------------------------------------------------------------------------- /AetherGazer.ahk: -------------------------------------------------------------------------------- 1 | ; ---------------------------------------------------------------------------- 2 | ; Script Name: 深空之眼 3 | ; Version: 3.1 4 | ; Author: qstdnx 5 | ; Contact: https://github.com/qstdnx/AetherGazer-ahk/issues 6 | ; ---------------------------------------------------------------------------- 7 | #Persistent ;~让脚本持久运行 8 | #SingleInstance,Force ;~运行替换旧实例 9 | ListLines,Off ;~不显示最近执行的脚本行 10 | SetBatchLines,-1 ;~脚本全速执行(默认10ms) 11 | CoordMode,Menu,Window ;~坐标相对活动窗口 12 | ;------------------------------------------------获取管理员权限 ↓↓↓ 13 | if !A_IsAdmin ; 如果不是管理员权限 14 | { 15 | try ; 尝试以管理员身份重新启动脚本 16 | { 17 | if A_IsCompiled ; 如果是编译后的 .exe 18 | Run *RunAs "%A_ScriptFullPath%" %1% %2% %3% %4% %5% %6% %7% %8% %9% 19 | else ; 如果是 .ahk 脚本 20 | Run *RunAs "%A_AhkPath%" "%A_ScriptFullPath%" %1% %2% %3% %4% %5% %6% %7% %8% %9% 21 | ExitApp ; 退出当前非管理员实例 22 | } 23 | catch ; 如果用户拒绝了 UAC 弹窗 24 | { 25 | MsgBox "管理员权限请求被拒绝,3.5版本后深空之眼需要使用管理员权限运行脚本" 26 | ExitApp 27 | } 28 | } 29 | 30 | ;------------------------------------------------设置 ↓↓↓ 31 | ; 初始化快捷键 32 | global UPKey := "w" 33 | global DOWNKey := "s" 34 | global LEFTKey := "a" 35 | global RIGHTKey := "d" 36 | global AttackKey := "j" 37 | global Skill1Key := "u" 38 | global Skill2Key := "i" 39 | global Skill3Key := "o" 40 | global DodgeKey := "Space" 41 | global UltimateKey := "r" 42 | global Teammate1Key := "1" 43 | global Teammate2Key := "2" 44 | global JinwuKey := "Numpad1" 45 | global DimensionKey := "Numpad2" 46 | global LingguangKey := "Numpad3" 47 | global TuoteKey := "Numpad4" 48 | global NameiKey := "Numpad5" 49 | global WeierKey := "Numpad6" 50 | global KaorouKey := "Numpad7" 51 | global LiandianKey := "Numpad9" 52 | global FantianKey := "^Numpad1" 53 | global ShikoudiKey := "^Numpad2" 54 | global FengqianfangtiangouKey := "^Numpad3" 55 | global YalishaKey := "^Numpad4" 56 | global StopscriptKey := "Numpad0" 57 | global ScriptDir := A_ScriptDir 58 | IniFilePath := ScriptDir . "\settings.ini" 59 | 60 | ; 定义所有需要检查的键值对 61 | KeyMappings := { "UpKey": UPKey 62 | , "DownKey": DOWNKey 63 | , "LeftKey": LEFTKey 64 | , "RightKey": RIGHTKey 65 | , "AttackKey": AttackKey 66 | , "Skill1Key": Skill1Key 67 | , "Skill2Key": Skill2Key 68 | , "Skill3Key": Skill3Key 69 | , "DodgeKey": DodgeKey 70 | , "UltimateKey": UltimateKey 71 | , "Teammate1Key": Teammate1Key 72 | , "Teammate2Key": Teammate2Key 73 | , "JinwuKey": JinwuKey 74 | , "DimensionKey": DimensionKey 75 | , "LingguangKey": LingguangKey 76 | , "TuoteKey": TuoteKey 77 | , "NameiKey": NameiKey 78 | , "WeierKey": WeierKey 79 | , "KaorouKey": KaorouKey 80 | , "LiandianKey": LiandianKey 81 | , "FantianKey": FantianKey 82 | , "ShikoudiKey": ShikoudiKey 83 | , "FengqianfangtiangouKey": FengqianfangtiangouKey 84 | , "YalishaKey": YalishaKey 85 | , "StopscriptKey": StopscriptKey } 86 | 87 | ; 检查INI文件是否存在,不存在则创建 88 | if !FileExist(IniFilePath) { 89 | ; 创建新的INI文件并写入所有默认值 90 | for key, value in KeyMappings { 91 | IniWrite, %value%, %IniFilePath%, Hotkeys, %key% 92 | } 93 | } else { 94 | ; 检查INI文件中是否有缺失的键,有则补充 95 | for key, defaultValue in KeyMappings { 96 | IniRead, ReadValue, %IniFilePath%, Hotkeys, %key% 97 | if (ReadValue = "ERROR") { 98 | IniWrite, %defaultValue%, %IniFilePath%, Hotkeys, %key% 99 | ReadValue := defaultValue 100 | } 101 | ; 更新全局变量 102 | %key% := ReadValue 103 | } 104 | } 105 | 106 | ; 设置热键 107 | Hotkey, %JinwuKey%, Jinwu 108 | Hotkey, %DimensionKey%, Dimension 109 | Hotkey, %LingguangKey%, Lingguang 110 | Hotkey, %TuoteKey%, Tuote 111 | Hotkey, %NameiKey%, Namei 112 | Hotkey, %WeierKey%, Weier 113 | Hotkey, %KaorouKey%, Kaorou 114 | Hotkey, %LiandianKey%, Liandian 115 | Hotkey, %FantianKey%, Fantian 116 | Hotkey, %ShikoudiKey%, Shikoudi 117 | Hotkey, %FengqianfangtiangouKey%, Fengqianfangtiangou 118 | Hotkey, %YalishaKey%, Yalisha 119 | Hotkey, %StopscriptKey%, Stopscript 120 | 121 | Menu, Tray, NoStandard 122 | Menu, Tray, Add, 快捷键设置, ShowSettingsGui 123 | Menu, Tray, Add, 退出程序, ExitScript 124 | ShowSettingsGUI() { 125 | global 126 | Gui, New 127 | Gui, Add, Tab3,,按键设置|自动操作 128 | GUI, Tab, 按键设置 129 | Gui, Add, Text,, 设置与你游戏内按键对应 130 | Gui, Add, Text,, 移动(前) 131 | Gui, Add, Hotkey, vUpKey, %UpKey% 132 | Gui, Add, Text,, 移动(后) 133 | Gui, Add, Hotkey, vDownKey, %DownKey% 134 | Gui, Add, Text,, 移动(左) 135 | Gui, Add, Hotkey, vLeftKey, %LeftKey% 136 | Gui, Add, Text,, 移动(右) 137 | Gui, Add, Hotkey, vRightKey, %RightKey% 138 | Gui, Add, Text,, 普攻 139 | Gui, Add, Hotkey, vAttackKey, %AttackKey% 140 | Gui, Add, Text,, 1 技能 141 | Gui, Add, Hotkey, vSkill1Key, %Skill1Key% 142 | Gui, Add, Text,, 2 技能 143 | Gui, Add, Hotkey, vSkill2Key, %Skill2Key% 144 | Gui, Add, Text,, 3 技能 145 | Gui, Add, Hotkey, vSkill3Key, %Skill3Key% 146 | Gui, Add, Text,, 闪避 147 | Gui, Add, Hotkey, vDodgeKey, %DodgeKey% 148 | Gui, Add, Text,, 奥义 149 | Gui, Add, Hotkey, vUltimateKey, %UltimateKey% 150 | Gui, Add, Text,, 队友1 奥义 151 | Gui, Add, Hotkey, vTeammate1Key, %Teammate1Key% 152 | Gui, Add, Text,, 队友2 奥义 153 | Gui, Add, Hotkey, vTeammate2Key, %Teammate2Key% 154 | Gui, tab, 自动操作 155 | Gui, Add, Text,, 金乌 156 | Gui, Add, Hotkey, vJinwuKey, %JinwuKey% 157 | Gui, Add, Text,, 自动多维变量 158 | Gui, Add, Hotkey, vDimensionKey, %DimensionKey% 159 | Gui, Add, Text,, 陵光 160 | Gui, Add, Hotkey, vLingguangKey, %LingguangKey% 161 | Gui, Add, Text,, 托特/哈迪斯/雷前鬼/水姆 162 | Gui, Add, Hotkey, vTuoteKey, %TuoteKey% 163 | Gui, Add, Text,, 娜美 164 | Gui, Add, Hotkey, vNameiKey, %NameiKey% 165 | Gui, Add, Text,, 薇儿/光赫拉/瓦吉特/执明 166 | Gui, Add, Hotkey, vWeierKey, %WeierKey% 167 | Gui, Add, Text,, 自动烤肉 168 | Gui, Add, Hotkey, vKaorouKey, %KaorouKey% 169 | Gui, Add, Text,, 简易连点器 170 | Gui, Add, Hotkey, vLiandianKey, %LiandianKey% 171 | Gui, Add, Text,, 梵天 172 | Gui, Add, Hotkey, vFantianKey, %FantianKey% 173 | Gui, Add, Text,, 诗寇蒂 174 | Gui, Add, Hotkey, vShikoudiKey, %ShikoudiKey% 175 | Gui, Add, Text,, 樱切(左线) 176 | Gui, Add, Hotkey, vFengqianfangtiangouKey, %FengqianfangtiangouKey% 177 | Gui, Add, Text,, 亚莉莎(左线) 178 | Gui, Add, Hotkey, vYalishaKey, %YalishaKey% 179 | Gui, Add, Text,, 停止脚本 180 | Gui, Add, Hotkey, vStopscriptKey, %StopscriptKey% 181 | Gui, Tab 182 | Gui, Add, Button, default, OK 183 | Gui, Show, , 设置快捷键 184 | return 185 | } 186 | 187 | GuiClose: 188 | GuiEscape: 189 | Gui, Destroy 190 | return 191 | 192 | ButtonOK: 193 | Gui, Submit 194 | FileDelete, %IniFilePath% 195 | for key, value in KeyMappings { 196 | IniWrite, % %key%, %IniFilePath%, Hotkeys, %key% 197 | } 198 | 199 | ; 更新全局变量 200 | for key in KeyMappings { 201 | %key% := %key% 202 | } 203 | 204 | ; 重新设置热键 205 | Hotkey, %JinwuKey%, Jinwu 206 | Hotkey, %DimensionKey%, Dimension 207 | Hotkey, %LingguangKey%, Lingguang 208 | Hotkey, %TuoteKey%, Tuote 209 | Hotkey, %NameiKey%, Namei 210 | Hotkey, %WeierKey%, Weier 211 | Hotkey, %KaorouKey%, Kaorou 212 | Hotkey, %LiandianKey%, Liandian 213 | Hotkey, %FantianKey%, Fantian 214 | Hotkey, %ShikoudiKey%, Shikoudi 215 | Hotkey, %FengqianfangtiangouKey%, Fengqianfangtiangou 216 | Hotkey, %YalishaKey%, Yalisha 217 | Hotkey, %StopscriptKey%, Stopscript 218 | 219 | return 220 | 221 | ;------------------------------------------------深空之眼下才有效果 ↓↓↓ 222 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 223 | SysGet, VirtualWidth, 16 224 | SysGet, VirtualHeight, 17 225 | CoordMode, ToolTip, Screen 226 | ;-------------------------------------------------定义变量 ↓↓↓ 227 | GetColor(x,y) 228 | { 229 | PixelGetColor, color, x, y, RGB 230 | StringRight color,color,10 ; 231 | return color 232 | } 233 | ;这个游戏指针会干扰window spy取色,建议换截图工具取色。 234 | ;------------------------------------------------金乌飞天,小键盘1启动 ↓↓↓ 235 | 236 | 1_Enable= false 237 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 238 | Jinwu: 239 | { 240 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 241 | { 242 | 1_Enable :=!1_Enable 243 | if (1_Enable=false) 244 | { 245 | SetTimer, Press1, Off 246 | ToolTip 247 | } 248 | else 249 | { 250 | Sleep 100 251 | SetTimer, Press1, 10 ; 252 | ToolTip, 金乌:启动, 74, 1021 253 | } 254 | } 255 | } 256 | 257 | Press1: 258 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 259 | { 260 | loop{ 261 | if (GetColor(1161, 692)=="0xFFFFFF") 262 | { 263 | Send, {%Skill3Key%} 264 | Sleep 10 265 | Send, {%Skill3Key%} 266 | } 267 | else 268 | { 269 | break 270 | } 271 | } 272 | Send, {%Skill1Key%} 273 | Sleep 10 274 | Send, {%Skill1Key%} 275 | Sleep 10 276 | Send, {%AttackKey%} 277 | Sleep 10 278 | Send, {%Skill2Key%} 279 | Sleep 10 280 | Send, {%UltimateKey%} 281 | Sleep 10 282 | Send, {%AttackKey%} 283 | Sleep 10 284 | Send, {%Teammate1Key%} 285 | Sleep 10 286 | Send, {%AttackKey%} 287 | Sleep 10 288 | Send, {%Teammate2Key%} 289 | Sleep 10 290 | Send, {%AttackKey%} 291 | Sleep 10 292 | } 293 | else 294 | { 295 | SetTimer, Press1, Off 296 | ToolTip 297 | 1_Enable= false 298 | } 299 | return 300 | 301 | ;------------------------------------------------自动多维变量,要求分辨率1280x720, 小键盘2启动 ↓↓↓ 302 | 2_Enable=false 303 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 304 | Dimension: 305 | { 306 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 307 | { 308 | 2_Enable := !2_Enable 309 | if (2_Enable=false) 310 | { 311 | SetTimer, Press2, Off 312 | ToolTip 313 | } 314 | else 315 | { 316 | ToolTip, 多维变量:启动, 74, 1021 ; 设置ToolTip的显示内容和位置坐标 317 | Sleep 100 318 | Press2() 319 | } 320 | } 321 | } 322 | Press2() 323 | { 324 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 325 | { 326 | #NoEnv 327 | SetWorkingDir %A_ScriptDir% 328 | CoordMode, Mouse, Window 329 | SendMode Input 330 | SetTitleMatchMode 2 331 | #WinActivateForce 332 | SetControlDelay 1 333 | SetWinDelay 0 334 | SetKeyDelay -1 335 | SetMouseDelay -1 336 | loop 337 | { 338 | ;点击开始挑战 339 | Text:="|<>*204$83.zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzjzzzzzwzz003sz7yD8znt7y007lwTwSFzbm7w00DXsbsYWT1aDz7lw1X7010y1CTyDXs36C121w20TwT7sYED647tk0TsyDl00SC8DnU3y003W00QCFzXVbs007AzzsMVw1XDk00CF03011s3YTyDXwW06221l71zwT7sA0D44HbC7zsyDsMwSC8zCQBzXwTkFswQFiQ0ly7szU3lslXAs0XsTly803l30M0EDlzXsO060D0k7kTrzDtwSCAy3zzlzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" 340 | ok:=FindText(X:="wait", Y:=-1, 0,0,0,0,0,0,Text) 341 | if (ok:=FindText(X, Y, 1075-150000, 770-150000, 1075+150000, 770+150000, 0, 0, Text)) 342 | { 343 | FindText().Click(X, Y, "L") 344 | } 345 | ;难度选择 346 | Sleep, 500 347 | Click, 562, 674 Left, Down 348 | Sleep, 78 349 | Click, 563, 659, 0 350 | Click, 563, 650, 0 351 | Sleep, 31 352 | Click, 556, 549, 0 353 | Click, 550, 507, 0 354 | Click, 543, 447, 0 355 | Sleep, 16 356 | Click, 542, 430, 0 357 | Click, 539, 395, 0 358 | Sleep, 16 359 | Click, 530, 128, 0 360 | Sleep, 15 361 | Click, 530, 89, 0 362 | Click, 536, -7, 0 363 | Sleep, 16 364 | Click, 542, -63, 0 365 | Click, 551, -120, 0 366 | Sleep, 15 367 | Click, 593, -169, 0 368 | Sleep, 16 369 | Click, 600, -169, 0 370 | Click, 600, -169 Left, Up 371 | Sleep, 812 372 | Click, 391, 630 373 | Sleep, 500 374 | Click, 1060, 662 375 | Sleep, 1000 376 | ;选择真红 377 | Click, 71, 707 378 | Sleep, 500 379 | t1:=A_TickCount, Text:=X:=Y:="" 380 | Text:="|<>*211$37.0000000000000301U03zzknztzzsNzw0s0zjy7zsTzz30Q7TzVzy3rjUzz1tnkTzVzjwDzkwYY7zsSzz3zwDTzbzzVXb7zzknr0CD0MTUz3sBzwQ0Q6w60000000000004" 381 | if (ok:=FindText(X, Y, 163-150000, 267-150000, 163+150000, 267+150000, 0, 0, Text)) 382 | { 383 | FindText().Click(X, Y, "L") 384 | } 385 | Sleep, 500 386 | Text:="|<>*206$41.0000000000000032000006A00Ty0gM0zzw1MztxqM3zzkngkDyZVbzUPPP3Dz0q6qTNa1gBgyzw0SqMtzs3vgkkA0DaNVUQ03NX3Dz06767jy0AQMz300Mnlnzw0l7U3zs00000000000004" 387 | if (ok:=FindText(X, Y, 162-150000, 416-150000, 162+150000, 416+150000, 0, 0, Text)) 388 | { 389 | FindText().Click(X, Y, "L") 390 | } 391 | Sleep, 500 392 | Click, 235, 702 393 | Sleep, 500 394 | Text:="|<>*117$71.0Dzzzzzzzza00jzzzzzzzzi00PzzzzzzzzA0MbzzzzzzzzM1kCzTzzzxzzk348gjzzzzzzUCE03DzzjzzzETU04Izzzzzy1zU0N3yzzzzw3y0Am5nzzzzt7zLng/zzzzzwTzzzTzzzzzyAzzzzzzzzzzwNTzzzzzzzzzvnzzzzzzzzzzmvzzzzzzzzzzpjzzzzzzzzzzbTzzzztzzzzzizzzzznzzzzzzzTzzzXzzvzzzzzzzy7zznzzzzzzzwDzzXzzzzzzzkDzz7zzTzzzvUTzy7zyzzzzq0zzwDzz" 395 | 396 | if (ok:=FindText(X, Y, 161-150000, 436-150000, 161+150000, 436+150000, 0, 0, Text)) 397 | { 398 | FindText().Click(X, Y, "L") 399 | } 400 | Sleep, 500 401 | Click, 1173, 701 402 | Sleep, 500 403 | ;选择信标 404 | Click, 628, 562 Left, Down 405 | Sleep, 125 406 | Click, 628, 549, 0 407 | Click, 628, 546, 0 408 | Sleep, 16 409 | Click, 628, 521, 0 410 | Click, 628, 508, 0 411 | Sleep, 16 412 | Click, 628, 457, 0 413 | Click, 628, 436, 0 414 | Sleep, 15 415 | Click, 628, 362, 0 416 | Click, 628, 335, 0 417 | Sleep, 16 418 | Click, 626, 240, 0 419 | Click, 626, 224, 0 420 | Sleep, 15 421 | Click, 619, -9, 0 422 | Click, 618, -54, 0 423 | Sleep, 16 424 | Click, 618, -110, 0 425 | Sleep, 16 426 | Click, 618, -110 Left, Up 427 | Sleep, 812 428 | Click, 170, 492 429 | Sleep, 500 430 | Click, 483, 221 431 | Sleep, 500 432 | Click, 805, 221 433 | Sleep, 500 434 | Click, 1183, 702 435 | Sleep, 500 436 | ;选珍宝 437 | Text:= "|<>*167$45.zzzzzzzzzzzzzzzzzrzzzzzzwTwzXzw10DXwTzU81wDXzyCADlwTzlU0zTXzyA07zwTzk00kTXzw28a3sTzUE0sT1zsG07XsDz2E0wT1zsG8bWl7zmE0w68zyG07U3Xzk3Aw0QDy0NbW7kzk30yFz7zws7yTxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzw" 438 | ok:=FindText(X:="wait", Y:=-1, 0,0,0,0,0,0,Text) 439 | if (ok:=FindText(X, Y, 886-150000, 742-150000, 886+150000, 742+150000, 0, 0, Text)) 440 | { 441 | Click, 642, 400 442 | Sleep, 500 443 | FindText().Click(X, Y, "L") 444 | } 445 | Sleep, 500 446 | Click, 864, 643 447 | ;选关卡 448 | Sleep, 1687 449 | Send, {w Down} 450 | Sleep, 3300 451 | Send, {d Down} 452 | Sleep, 1200 453 | Send, {d Up} 454 | Sleep, 400 455 | Send, {w Up} 456 | Sleep, 1000 457 | Click, 889, 490 458 | Sleep, 500 459 | ;打完只有一个珍宝时,确认默认被选中时的图片 460 | text1:="|<>*202$43.zzzzzzzzzzzzzzzzrzzzzzzlztyDz0M3sT7zU81yDXzwMEz3lzyM0DnszyA03zwTz001UyDz0W8kT3zUE0QDVzV80D7UzkYF7XkDwG8Xls7z901s8lzYU0w0MzkF4S4SDs1WD4T3w0k7YDlzws7zDwzzzzzzzzzzzzzzzzzzzzzzzzzzzzzk" 461 | 462 | ;打怪 463 | loop 464 | { 465 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 466 | Send, {%Skill1Key%} 467 | Sleep, 10 468 | Send, {%Skill3Key%} 469 | Sleep, 10 470 | Send, {%AttackKey%} 471 | Sleep, 10 472 | Send, {%Skill2Key%} 473 | Sleep, 10 474 | Send, {%Skill3Key%} 475 | Sleep, 10 476 | Send, {%AttackKey%} 477 | Sleep, 10 478 | Send, {%UltimateKey%} 479 | Sleep, 10 480 | Send, {%Skill3Key%} 481 | Sleep, 10 482 | Send, {%AttackKey%} 483 | Sleep, 10 484 | if (ok:=FindText(X, Y, 886-150000, 742-150000, 886+150000, 742+150000, 0, 0, Text)) 485 | { 486 | break 487 | } 488 | if (ok:=FindText(X, Y, 886-150000, 742-150000, 886+150000, 742+150000, 0, 0, Text1)) 489 | { 490 | break 491 | } 492 | } 493 | Click, 642, 400 494 | Sleep, 500 495 | Click, 745, 643 496 | Sleep, 1000 497 | ;退出 498 | Send, {Alt} 499 | Sleep, 500 500 | Click, 1229, 74 501 | Sleep, 500 502 | Click, 1000, 692 503 | Sleep, 500 504 | Send, {Enter} 505 | Text:="|<>*202$39.zzzzzzzzzzzzzvzzzwzyA0DzbzkU1wwsz0TDbb7wU1wwszw0Dbb7kXtw00w40DU07kU0w00z4F7zbzsW1swwT4ED7bXsUEswwT07b7bXk3ws00QE03003nU0s00Tzzzzzbzzzzzzw" 506 | ok:=FindText(X:="wait", Y:=-1, 0,0,0,0,0,0,Text) 507 | if (ok:=FindText(X, Y, 1183-150000, 803-150000, 1183+150000, 803+150000, 0, 0, Text)) 508 | { 509 | FindText().Click(X, Y, "L") 510 | } 511 | Sleep, 1000 512 | } 513 | } 514 | else 515 | { 516 | SetTimer, Press2, Off 517 | ToolTip 518 | 2_Enable=false 519 | } 520 | } 521 | return 522 | ;------------------------------------------------陵光自动操作,小键盘3启动 ↓↓↓ 523 | 3_Enable= false 524 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 525 | Lingguang: 526 | { 527 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 528 | { 529 | 3_Enable :=!3_Enable 530 | if (3_Enable=false) 531 | { 532 | SetTimer, Press3, Off 533 | ToolTip 534 | } 535 | else 536 | { 537 | Sleep 100 538 | SetTimer, Press3, 10 ; 539 | ToolTip, 陵光:启动, 74, 1021 540 | } 541 | } 542 | } 543 | 544 | Press3: 545 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 546 | { 547 | Send, {%AttackKey%} 548 | Sleep 250 549 | Send, {%Skill1Key%} 550 | Sleep 250 551 | Send, {%UltimateKey%} 552 | Send, {%Teammate1Key%} 553 | Send, {%Teammate2Key%} 554 | } 555 | else 556 | { 557 | SetTimer, Press3, Off 558 | ToolTip 559 | 1_Enable= false 560 | } 561 | return 562 | 563 | ;------------------------------------------------托特或哈迪斯自动战斗,小键盘4启动 ↓↓↓ 564 | 565 | 4_Enable= false 566 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 567 | Tuote: 568 | { 569 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 570 | { 571 | 4_Enable :=!4_Enable 572 | if (4_Enable=false) 573 | { 574 | SetTimer, Press4, Off 575 | ToolTip 576 | } 577 | else 578 | { 579 | Sleep 100 580 | SetTimer, Press4, 10 ; 581 | ToolTip, 托特/哈迪斯/雷前鬼/水姆:启动, 74, 1021 582 | } 583 | } 584 | } 585 | 586 | Press4: 587 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 588 | { 589 | Send, {%AttackKey% Down} 590 | Sleep, 500 591 | Send, {%AttackKey% Up} 592 | Send, {%Skill3Key%} 593 | Sleep 10 594 | Send, {%Skill3Key%} 595 | Sleep 10 596 | Send, {%AttackKey%} 597 | Sleep 10 598 | Send, {%Skill1Key%} 599 | Sleep 10 600 | Send, {%Skill1Key%} 601 | Sleep 10 602 | Send, {%AttackKey%} 603 | Sleep 10 604 | Send, {%Skill2Key%} 605 | Sleep 10 606 | Send, {%UltimateKey%} 607 | Sleep 10 608 | Send, {%AttackKey%} 609 | Sleep 10 610 | Send, {%Teammate1Key%} 611 | Sleep 10 612 | Send, {%Teammate2Key%} 613 | Sleep 10 614 | } 615 | else 616 | { 617 | SetTimer, Press4, Off 618 | ToolTip 619 | 4_Enable= false 620 | } 621 | return 622 | ;------------------------------------------------娜美自动战斗,小键盘5启动 ↓↓↓ 623 | 5_Enable= false 624 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 625 | Namei: 626 | { 627 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 628 | { 629 | 5_Enable :=!5_Enable 630 | if (5_Enable=false) 631 | { 632 | SetTimer, Press5, Off 633 | ToolTip 634 | } 635 | else 636 | { 637 | Sleep 100 638 | Send, {%Skill1Key%}{%AttackKey%} 639 | SetTimer, Press5, 10 ; 640 | ToolTip, 娜美:启动, 74, 1021 641 | } 642 | } 643 | } 644 | 645 | Press5: 646 | if WinActive("ahk_exe AetherGazer.exe") 647 | { 648 | if (GetColor(1174, 684)=="0xFFFFFF") 649 | { 650 | Send, {%DodgeKey%} 651 | Sleep 400 652 | Send, {%AttackKey%} 653 | Sleep 300 654 | Send, {%AttackKey%} 655 | Sleep 700 656 | Send, {%AttackKey%} 657 | Sleep 600 658 | Send, {%Skill3Key%} 659 | Sleep 1400 660 | Send, {%Skill2Key%}{%Skill1Key%} 661 | } 662 | Sleep 10 663 | Send, {%AttackKey%} 664 | if (GetColor(1090, 672)=="0xFFFFFF") 665 | { 666 | Sleep 150 667 | Send, {%Skill2Key%} 668 | } 669 | Sleep 10 670 | Send, {%AttackKey%} 671 | if (GetColor(1016, 697)=="0xFFFFFF") 672 | { 673 | Sleep 150 674 | Send, {%Skill1Key%} 675 | } 676 | Send, {%UltimateKey%} 677 | Sleep 10 678 | Send, {%AttackKey%} 679 | Sleep 10 680 | Send, {%Teammate1Key%} 681 | Sleep 10 682 | Send, {%Teammate2Key%} 683 | Sleep 10 684 | } 685 | else 686 | { 687 | SetTimer, Press5, Off 688 | ToolTip 689 | 5_Enable= false 690 | } 691 | return 692 | ;------------------------------------------------光薇儿自动战斗,小键盘6启动 ↓↓↓ 693 | 6_Enable= false 694 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 695 | Weier: 696 | { 697 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 698 | { 699 | 6_Enable :=!6_Enable 700 | if (6_Enable=false) 701 | { 702 | SetTimer, Press6, Off 703 | ToolTip 704 | } 705 | else 706 | { 707 | Sleep 100 708 | SetTimer, Press6, 10 ; 709 | ToolTip, 薇儿/光赫拉/瓦吉特/执明:启动, 74, 1021 710 | } 711 | } 712 | } 713 | 714 | Press6: 715 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 716 | { 717 | Send, {%Skill3Key%} 718 | Sleep 5 719 | Send, {%AttackKey%} 720 | Sleep 5 721 | Send, {%Skill1Key%} 722 | Sleep 5 723 | Send, {%UltimateKey%} 724 | Sleep 5 725 | Send, {%AttackKey%} 726 | Sleep 5 727 | Send, {%Skill2Key%} 728 | Sleep 5 729 | Send, {%Teammate1Key%} 730 | Sleep 5 731 | Send, {%Skill1Key%} 732 | Sleep 5 733 | Send, {%Teammate2Key%} 734 | Sleep 5 735 | Send, {%Skill2Key%} 736 | Sleep 5 737 | } 738 | else 739 | { 740 | SetTimer, Press6, Off 741 | ToolTip 742 | 6_Enable= false 743 | } 744 | return 745 | ;------------------------------------------------闲暇时刻自动烤肉,小键盘7启动↓↓↓ 746 | 7_Enable= false 747 | Kaorou: 748 | { 749 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 750 | { 751 | 7_Enable := !7_Enable 752 | if (7_Enable = false) 753 | { 754 | SetTimer, Press7, Off 755 | ToolTip 756 | } 757 | else 758 | { 759 | Sleep 100 760 | SetTimer, Press7, 10 761 | ToolTip, 烤肉:启动, 74, 1021 762 | } 763 | } 764 | } 765 | 766 | Press7: 767 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 768 | { 769 | color := GetColor(691, 180) 770 | if (IsColorClose(color, "0xde6566", 10)) ; 容差设为10 771 | { 772 | Send, i 773 | } 774 | if (IsColorClose(color, "0x4abbf1", 10)) ; 容差设为10 775 | { 776 | Send, u 777 | } 778 | } 779 | else 780 | { 781 | SetTimer, Press7, Off 782 | ToolTip 783 | 7_Enable = false 784 | } 785 | return 786 | 787 | ; 判断两个颜色值是否在容差范围内 788 | IsColorClose(color1, color2, tolerance) 789 | { 790 | color1 := "0x" SubStr(color1, 3) 791 | color2 := "0x" SubStr(color2, 3) 792 | 793 | r1 := (color1 >> 16) & 0xFF 794 | g1 := (color1 >> 8) & 0xFF 795 | b1 := color1 & 0xFF 796 | 797 | r2 := (color2 >> 16) & 0xFF 798 | g2 := (color2 >> 8) & 0xFF 799 | b2 := color2 & 0xFF 800 | 801 | if (Abs(r1 - r2) <= tolerance && Abs(g1 - g2) <= tolerance && Abs(b1 - b2) <= tolerance) 802 | { 803 | return true 804 | } 805 | return false 806 | } 807 | ;--------------------------简易连点器功能,右ctrl+任意键连点,小键盘9启动自定义连点↓↓↓ 808 | 9_Enable := false 809 | Inputkey := "" 810 | RControl:: 811 | Input, Inputkey, L1 I V, {MouseX, MouseY} 812 | 9_Enable := true 813 | loop { 814 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe"){ 815 | if (9_Enable){ 816 | Send, %Inputkey% 817 | Sleep, 50 818 | ToolTip, %Inputkey% 键连点中,按%StopscriptKey%停止 819 | } 820 | if (!9_Enable or Inputkey=""){ 821 | ToolTip 822 | break 823 | } 824 | } else { 825 | 9_Enable := false 826 | ToolTip 827 | break 828 | } 829 | } 830 | return 831 | 832 | ;可记忆版本,容易卡键 833 | ; keyToClick := "" 834 | ; RControl:: 835 | ; Input, Inputkey, L1 I V, {MouseX, MouseY} 836 | ; keyToClick := keyToClick . Inputkey 837 | ; 9_Enable := true 838 | ; Loop { 839 | ; If WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe"){ 840 | ; if (9_Enable){ 841 | ; Send, %keyToClick% 842 | ; Sleep, 50 843 | ; Tooltip, %keyToClick% 键连点中,按%StopscriptKey%停止`n按右alt键暂停,再次点击右ctrl+任意键同时连点暂停前记录的按键 844 | ; } 845 | ; if (!9_Enable or keyToClick=""){ 846 | ; Tooltip 847 | ; break 848 | ; } 849 | ; } else { 850 | ; 9_Enable := false 851 | ; Tooltip 852 | ; break 853 | ; } 854 | ; } 855 | ; return 856 | 857 | ;连点鼠标,导致rctrl失效 858 | ; RControl & LButton:: 859 | ; Loop { 860 | ; If WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe"){ 861 | ; if (9_Enable) 862 | ; Click 863 | ; Sleep, 50 864 | ; ToolTip,鼠标左键连点中,`n间隔50毫秒,按%StopscriptKey%停止 865 | ; } else { 866 | ; 9_Enable := false 867 | ; ToolTip 868 | ; break 869 | ; } 870 | ; } 871 | ; return 872 | 873 | ; RAlt:: 874 | ; 9_Enable := false 875 | ; return 876 | 877 | Liandian: 878 | { 879 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 880 | gosub, 连点弹框输入 881 | return 882 | } 883 | 连点弹框输入: 884 | Gui, MouseClickGui: New 885 | Gui, MouseClickGui: +AlwaysOnTop 886 | Gui, MouseClickGui: Add, Text, , 填写连点的按键:`n同时连按多个按键直接填入即可,例如填入jkio为同时连点jkio四个按键`n特殊按键用{}圈住,例如鼠标左键为{LButton},空格键为{Space},左Shift为{LShift} 887 | Gui, MouseClickGui: Add, Edit, w400 v连点按键, {LButton} 888 | Gui, MouseClickGui: Add, Text, , 连点间隔(单位毫秒): 889 | Gui, MouseClickGui: Add, Edit, w400 v连点间隔, 50 890 | Gui, MouseClickGui: Add, Button, default g连点确认, 确认 891 | Gui, MouseClickGui: Show, , 按键连点 892 | return 893 | 连点确认: 894 | Gui, MouseClickGui: Submit 895 | global WhichButton:= 连点按键 896 | global interval:= 连点间隔 897 | SetTimer, ContinuousClick, %连点间隔% 898 | return 899 | 900 | ContinuousClick: 901 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 902 | Send, %WhichButton% 903 | ToolTip,%WhichButton%键连点中,`n间隔%interval%毫秒,按%StopscriptKey%停止 904 | return 905 | 906 | ;------------------------------------------------梵天自动战斗,Ctrl+小键盘1启动 ↓↓↓ 907 | 11_Enable= false 908 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 909 | Fantian: 910 | { 911 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 912 | { 913 | 11_Enable :=!11_Enable 914 | if (11_Enable=false) 915 | { 916 | SetTimer, Press11, Off 917 | ToolTip 918 | } 919 | else 920 | { 921 | Sleep 100 922 | SetTimer, Press11, 10 ; 923 | ToolTip, 梵天:启动, 74, 1021 924 | } 925 | } 926 | } 927 | 928 | Press11: 929 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 930 | { 931 | if (GetColor(1218, 681)=="0xFFFFFF" and GetColor(910, 683)!=="0xFFFFFF") 932 | { 933 | Send, {%DodgeKey% Down} 934 | Sleep, 500 935 | Send, {%DodgeKey% Up} 936 | } 937 | Send, {%Skill3Key%} 938 | Sleep 5 939 | Send, {%AttackKey%} 940 | Sleep 5 941 | Send, {%Skill1Key%} 942 | Sleep 5 943 | Send, {%UltimateKey%} 944 | Sleep 5 945 | Send, {%AttackKey%} 946 | Sleep 5 947 | Send, {%Skill2Key%} 948 | Sleep 5 949 | Send, {%Teammate2Key%} 950 | Sleep 5 951 | Send, {%Skill1Key%} 952 | Sleep 5 953 | Send, {%AttackKey%} 954 | Sleep 5 955 | Send, {%Skill2Key%} 956 | Sleep 5 957 | } 958 | else 959 | { 960 | SetTimer, Press11, Off 961 | ToolTip 962 | 11_Enable= false 963 | } 964 | return 965 | 966 | ;------------------------------------------------诗寇蒂自动战斗,Ctrl+小键盘2启动 ↓↓↓ 967 | 12_Enable= false 968 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 969 | Shikoudi: 970 | { 971 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 972 | { 973 | 12_Enable :=!12_Enable 974 | if (12_Enable=false) 975 | { 976 | ToolTip 977 | } 978 | else 979 | { 980 | Sleep 100 981 | ToolTip, 诗寇蒂:启动, 74, 1021 982 | gosub, Press12 983 | } 984 | } 985 | } 986 | 987 | Press12: 988 | loop 989 | { 990 | if (!WinActive("ahk_exe AetherGazer.exe") and !WinActive("ahk_exe AetherGazer_Bili.exe") or !12_Enable) 991 | { 992 | ToolTip 993 | break ; 退出循环 994 | } 995 | ; 优先检测技能3 996 | if (GetColor(1157, 683)=="0xFFFFFF" and GetColor(1173, 695)=="0xFFFFFF" and GetColor(770, 609)=="0xFFFFFF") 997 | { 998 | ; 左线、右线神格, 化身槽满, 长按3 999 | Send, {%Skill3Key% Down} 1000 | Sleep, 10000 1001 | Send, {%Skill3Key% Up} 1002 | Sleep, 10 1003 | } 1004 | else if (GetColor(1157, 683)=="0xFFFFFF" or GetColor(1166, 668)=="0xFFFFFF" or GetColor(1143, 677)=="0xFFFFFF") 1005 | { 1006 | ; 化身槽不满, 图标有两种形态,一种是分割状态,一种是和中线一样, 所以同时检测两种图标有一种在就按3兼容三条神格 1007 | Send, {%Skill3Key%} 1008 | Sleep, 10 1009 | } 1010 | ; 其次检测技能2 1011 | else if (GetColor(1097, 701)=="0xFFFFFF" and GetColor(1085, 700)=="0xFFFFFF") 1012 | { 1013 | Send, {%Skill2Key%} 1014 | Sleep, 10 1015 | } 1016 | else { 1017 | Send, {%AttackKey%} 1018 | Sleep, 10 1019 | } 1020 | Send, {%UltimateKey%} 1021 | Sleep, 10 1022 | Send, {%Teammate1Key%} 1023 | Sleep, 10 1024 | Send, {%Teammate2Key%} 1025 | Sleep, 10 1026 | 1027 | } 1028 | 1029 | ;------------------------------------------------樱切(左线)自动战斗,Ctrl+小键盘3启动 ↓↓↓ 1030 | 13_Enable= false 1031 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 1032 | Fengqianfangtiangou: 1033 | { 1034 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 1035 | { 1036 | 13_Enable :=!13_Enable 1037 | if (13_Enable=false) 1038 | { 1039 | ToolTip 1040 | } 1041 | else 1042 | { 1043 | Sleep 100 1044 | ToolTip, 樱切(左线):启动, 74, 1021 1045 | gosub, Press13 1046 | } 1047 | } 1048 | } 1049 | 1050 | Press13: 1051 | loop 1052 | { 1053 | if (!WinActive("ahk_exe AetherGazer.exe") and !WinActive("ahk_exe AetherGazer_Bili.exe") or !13_Enable) 1054 | { 1055 | ToolTip 1056 | break ; 退出循环 1057 | } 1058 | ; 检测1技能是否为樱弥状态,如果是,按3次1技能,然后按3次普攻,按3次2技能,然后按3次普攻,最后按3技能,退出樱弥状态 1059 | if (GetColor(1042, 682)=="0xFFFFFF") 1060 | { 1061 | Send, {%Skill1Key%} 1062 | Sleep, 500 1063 | Send, {%Skill1Key%} 1064 | Sleep, 500 1065 | Send, {%Skill1Key%} 1066 | Sleep, 500 1067 | Send, {%AttackKey%} 1068 | Sleep, 500 1069 | Send, {%AttackKey%} 1070 | Sleep, 500 1071 | Send, {%AttackKey%} 1072 | Sleep, 500 1073 | Send, {%Skill2Key%} 1074 | Sleep, 500 1075 | Send, {%Skill2Key%} 1076 | Sleep, 500 1077 | Send, {%Skill2Key%} 1078 | Sleep, 500 1079 | Send, {%AttackKey%} 1080 | Sleep, 500 1081 | Send, {%AttackKey%} 1082 | Sleep, 500 1083 | Send, {%AttackKey%} 1084 | Sleep, 500 1085 | Send, {%Skill3Key%} 1086 | } 1087 | ; 检测是否在樱弥状态,如果不是,常规出招 1088 | if (GetColor(1042, 682)!="0xFFFFFF" and GetColor(1154, 699)!="0xFFFFFF") 1089 | { 1090 | Send, {%Skill1Key%} 1091 | Sleep, 10 1092 | Send, {%Skill2Key%} 1093 | Sleep, 10 1094 | Send, {%Skill3Key%} 1095 | Sleep, 10 1096 | Send, {%UltimateKey%} 1097 | Sleep, 10 1098 | Send, {%AttackKey%} 1099 | Sleep, 10 1100 | Send, {%Teammate1Key%} 1101 | Sleep, 10 1102 | Send, {%Teammate2Key%} 1103 | Sleep, 10 1104 | Send, {%AttackKey%} 1105 | } 1106 | 1107 | } 1108 | ;---------------------------------------------亚莉莎自动战斗,Ctrl+小键盘4启动 ↓↓↓ 1109 | 14_Enable= false 1110 | #If WinActive("ahk_exe AetherGazer.exe") || WinActive("ahk_exe AetherGazer_Bili.exe") 1111 | Yalisha: 1112 | { 1113 | if WinActive("ahk_exe AetherGazer.exe") or WinActive("ahk_exe AetherGazer_Bili.exe") 1114 | { 1115 | 14_Enable :=!14_Enable 1116 | if (14_Enable=false) 1117 | { 1118 | ToolTip 1119 | } 1120 | else 1121 | { 1122 | Sleep 100 1123 | ToolTip, 亚莉莎(左线):启动, 74, 1021 1124 | gosub, Press14 1125 | } 1126 | } 1127 | } 1128 | 1129 | Press14: 1130 | loop 1131 | { 1132 | if (!WinActive("ahk_exe AetherGazer.exe") and !WinActive("ahk_exe AetherGazer_Bili.exe") or !14_Enable) 1133 | { 1134 | ToolTip 1135 | break ; 退出循环 1136 | } 1137 | ; 检测是否处于枪械模式,如果否,按前进+闪避长按进入枪械模式 1138 | if (GetColor(1145, 672)!="0xFFFFFF" ) 1139 | { 1140 | Send, {%UpKey% Down} 1141 | Send, {%DodgeKey% Down} 1142 | Sleep, 500 1143 | Send, {%DodgeKey% Up} 1144 | Send, {%UpKey% Up} 1145 | } 1146 | ; 否则,开枪 1147 | else 1148 | { 1149 | Send, {%AttackKey%} 1150 | Sleep, 10 1151 | Send, {%UltimateKey%} 1152 | Sleep, 10 1153 | Send, {%AttackKey%} 1154 | Sleep, 10 1155 | Send, {%Teammate1Key%} 1156 | Sleep, 10 1157 | Send, {%Teammate2Key%} 1158 | } 1159 | } 1160 | ;------------------------------------------------强制停止脚本,小键盘0↓↓↓ 1161 | Stopscript: 1162 | Reload 1163 | 1_Enable= False 1164 | 2_Enable= False 1165 | 3_Enable= False 1166 | 4_Enable= False 1167 | 5_Enable= False 1168 | 6_Enable= False 1169 | 7_Enable= False 1170 | 9_Enable= False 1171 | 11_Enable= False 1172 | 12_Enable= False 1173 | 13_Enable= False 1174 | 14_Enable= False 1175 | return 1176 | ;------------------------------------------------退出脚本↓↓↓ 1177 | ExitScript: 1178 | ExitApp 1179 | return 1180 | 1181 | 1182 | 1183 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1184 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1185 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1186 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1187 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1188 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1189 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1190 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1191 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1192 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1193 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1194 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1195 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1196 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1197 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1198 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1199 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1200 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1201 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1202 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1203 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1204 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1205 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1206 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1207 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1208 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1209 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1210 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1211 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1212 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1213 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1214 | ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 1215 | FindText(ByRef x:="FindTextClass", ByRef y:="", args*) 1216 | { 1217 | static init, obj 1218 | if !VarSetCapacity(init) && (init:="1") 1219 | obj:=new FindTextClass() 1220 | return (x=="FindTextClass" && !args.Length()) ? obj : obj.FindText(x, y, args*) 1221 | } 1222 | 1223 | Class FindTextClass 1224 | { ;// Class Begin 1225 | 1226 | Floor(i) 1227 | { 1228 | if i is number 1229 | return i+0 1230 | else return 0 1231 | } 1232 | 1233 | __New() 1234 | { 1235 | this.bits:={ Scan0: 0, hBM: 0, oldzw: 0, oldzh: 0 } 1236 | this.bind:={ id: 0, mode: 0, oldStyle: 0 } 1237 | this.Lib:=[] 1238 | this.Cursor:=0 1239 | } 1240 | 1241 | __Delete() 1242 | { 1243 | if (this.bits.hBM) 1244 | Try DllCall("DeleteObject", "Ptr",this.bits.hBM) 1245 | } 1246 | 1247 | New() 1248 | { 1249 | return new FindTextClass() 1250 | } 1251 | 1252 | help() 1253 | { 1254 | return " 1255 | ( 1256 | )" 1257 | } 1258 | 1259 | FindText(ByRef OutputX:="", ByRef OutputY:="" 1260 | , x1:=0, y1:=0, x2:=0, y2:=0, err1:=0, err0:=0, text:="" 1261 | , ScreenShot:=1, FindAll:=1, JoinText:=0, offsetX:=20, offsetY:=10 1262 | , dir:=0, zoomW:=1, zoomH:=1) 1263 | { 1264 | local 1265 | if (OutputX ~= "i)^\s*wait[10]?\s*$") 1266 | { 1267 | found:=!InStr(OutputX,"0"), time:=this.Floor(OutputY) 1268 | , timeout:=A_TickCount+Round(time*1000), OutputX:="" 1269 | Loop 1270 | { 1271 | ok:=this.FindText(,, x1, y1, x2, y2, err1, err0, text, ScreenShot 1272 | , FindAll, JoinText, offsetX, offsetY, dir, zoomW, zoomH) 1273 | if (found && ok) 1274 | { 1275 | OutputX:=ok[1].x, OutputY:=ok[1].y 1276 | return ok 1277 | } 1278 | if (!found && !ok) 1279 | return 1 1280 | if (time>=0 && A_TickCount>=timeout) 1281 | Break 1282 | Sleep 50 1283 | } 1284 | return 0 1285 | } 1286 | SetBatchLines % (bch:=A_BatchLines)?"-1":"-1" 1287 | x1:=this.Floor(x1), y1:=this.Floor(y1), x2:=this.Floor(x2), y2:=this.Floor(y2) 1288 | if (x1=0 && y1=0 && x2=0 && y2=0) 1289 | n:=150000, x:=y:=-n, w:=h:=2*n 1290 | else 1291 | x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1 1292 | bits:=this.GetBitsFromScreen(x,y,w,h,ScreenShot,zx,zy), x-=zx, y-=zy 1293 | , this.ok:=0, info:=[] 1294 | Loop Parse, text, | 1295 | if IsObject(j:=this.PicInfo(A_LoopField)) 1296 | info.Push(j) 1297 | if (w<1 || h<1 || !(num:=info.Length()) || !bits.Scan0) 1298 | { 1299 | SetBatchLines % bch 1300 | return 0 1301 | } 1302 | arr:=[], info2:=[], k:=0, s:="" 1303 | , mode:=(IsObject(JoinText) ? 2 : JoinText ? 1 : 0) 1304 | For i,j in info 1305 | { 1306 | k:=Max(k, (j[7]=5 && j[8]!=2 ? j[9] : j[2]*j[3])) 1307 | if (mode) 1308 | v:=(mode=1 ? i : j[10]) . "", s.="|" v 1309 | , (v!="") && ((!info2.HasKey(v) && info2[v]:=[]), info2[v].Push(j)) 1310 | } 1311 | sx:=x, sy:=y, sw:=w, sh:=h, (mode=1 && JoinText:=[s]) 1312 | , allpos_max:=(FindAll || JoinText ? 10000:1) 1313 | , VarSetCapacity(s1,k*4), VarSetCapacity(s0,k*4) 1314 | , VarSetCapacity(ss,sw*(sh+3)), VarSetCapacity(allpos,allpos_max*8) 1315 | , ini:={ sx:sx, sy:sy, sw:sw, sh:sh, zx:zx, zy:zy 1316 | , mode:mode, bits:bits, ss:&ss, s1:&s1, s0:&s0 1317 | , allpos:&allpos, allpos_max:allpos_max 1318 | , err1:err1, err0:err0, zoomW:zoomW, zoomH:zoomH } 1319 | Loop 2 1320 | { 1321 | if (err1=0 && err0=0) && (num>1 || A_Index>1) 1322 | ini.err1:=err1:=0.05, ini.err0:=err0:=0.05 1323 | if (!JoinText) 1324 | { 1325 | For i,j in info 1326 | Loop % this.PicFind(ini, j, dir, sx, sy, sw, sh) 1327 | { 1328 | v:=NumGet(allpos,4*A_Index-4,"uint"), x:=(v&0xFFFF)+zx, y:=(v>>16)+zy 1329 | , w:=Floor(j[2]*zoomW), h:=Floor(j[3]*zoomH) 1330 | , arr.Push({1:x, 2:y, 3:w, 4:h, x:x+w//2, y:y+h//2, id:j[10]}) 1331 | if (!FindAll) 1332 | Break 3 1333 | } 1334 | } 1335 | else 1336 | For k,v in JoinText 1337 | { 1338 | v:=StrSplit(Trim(RegExReplace(v, "\s*\|[|\s]*", "|"), "|") 1339 | , (InStr(v,"|")?"|":""), " `t") 1340 | , this.JoinText(arr, ini, info2, v, 1, offsetX, offsetY 1341 | , FindAll, dir, 0, 0, 0, sx, sy, sw, sh) 1342 | if (!FindAll && arr.Length()) 1343 | Break 2 1344 | } 1345 | if (err1!=0 || err0!=0 || arr.Length() || info[1][4] || info[1][7]=5) 1346 | Break 1347 | } 1348 | SetBatchLines % bch 1349 | if (arr.Length()) 1350 | { 1351 | OutputX:=arr[1].x, OutputY:=arr[1].y, this.ok:=arr 1352 | return arr 1353 | } 1354 | return 0 1355 | } 1356 | 1357 | ; the join text object use [ "abc", "xyz", "a1|a2|a3" ] 1358 | 1359 | JoinText(arr, ini, info2, text, index, offsetX, offsetY 1360 | , FindAll, dir, minX, minY, maxY, sx, sy, sw, sh) 1361 | { 1362 | local 1363 | if !(Len:=text.Length()) || !info2.HasKey(key:=text[index]) 1364 | return 0 1365 | zoomW:=ini.zoomW, zoomH:=ini.zoomH, mode:=ini.mode 1366 | For i,j in info2[key] 1367 | if (mode!=2 || key==j[10]) 1368 | Loop % ok:=this.PicFind(ini, j, dir, sx, sy, (index=1 ? sw 1369 | : Min(sx+offsetX+Floor(j[2]*zoomW),ini.sx+ini.sw)-sx), sh) 1370 | { 1371 | if (A_Index=1) 1372 | { 1373 | pos:=[], p:=ini.allpos-4 1374 | Loop % ok 1375 | pos.Push(NumGet(0|p+=4,"uint")) 1376 | } 1377 | v:=pos[A_Index], x:=v&0xFFFF, y:=v>>16 1378 | , w:=Floor(j[2]*zoomW), h:=Floor(j[3]*zoomH) 1379 | , (index=1 && (minX:=x, minY:=y, maxY:=y+h)) 1380 | , minY1:=Min(y, minY), maxY1:=Max(y+h, maxY), sx1:=x+w 1381 | if (index1 || !FindAll) 1388 | return 1 1389 | } 1390 | else 1391 | { 1392 | comment:="" 1393 | For k,v in text 1394 | comment.=(mode=2 ? v : info2[v][1][10]) 1395 | x:=minX+ini.zx, y:=minY1+ini.zy, w:=sx1-minX, h:=maxY1-minY1 1396 | , arr.Push({1:x, 2:y, 3:w, 4:h, x:x+w//2, y:y+h//2, id:comment}) 1397 | if (index>1 || !FindAll) 1398 | return 1 1399 | } 1400 | } 1401 | return 0 1402 | } 1403 | 1404 | PicFind(ini, j, dir, sx, sy, sw, sh) 1405 | { 1406 | local 1407 | static init, MyFunc 1408 | if !VarSetCapacity(init) && (init:="1") 1409 | { 1410 | x32:="VVdWU4HsmAAAAIuEJNQAAAADhCTMAAAAi5wk@AAAAIO8JKwAAAAFiUQkIIuEJPgA" 1411 | . "AACNBJiJRCQ0D4RKBgAAi4Qk6AAAAIXAD45ADwAAiXwkEIu8JOQAAAAx7ccEJAAA"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v0o0cWw+vwI0Uk40EQjnBc2pJg8EIRTnwD4Z9" 1589 | . "AAAAQYsBQYtJBEGDxgKJww+21A+2wMHrEEQp0kQp2A+220Qp64H5@@@@AHazQYnP" 1590 | . "QcHvEEUPtv8Pr9tFD6@@RDn7d7IPtt0Pr9IPr9s52nelD7bJD6@AD6@JOch3mGaQ" 1591 | . "i0QkCEgDfCQQA2wkHEQB4EQ55n5lQYnE6UP@@@8PHwCLRCRIRIt0JBhEievB4xBB" 1592 | . "weIIQQnamU1jzkUJ2ve8JIgBAAAPr4QkOAEAAInBieiZ9@5Ii5QkaAEAAI0EgUKJ" 1593 | . "BIpEifCDwAGJRCQYSIuEJHABAABGiRSI64aLfCRQi0QkCItUJHgBVCRISItUJHBI" 1594 | . "AVQkQAH4ObwkiAEAAH4JiUQkUOmk@v@@i0QkGESLpCRQAQAAD6+EJJABAADB+AqJ" 1595 | . "RCQcSIsEJMdEJEAAAAAARTH@i1gEidgPts8PttPB6BAPtsCJxw+v+InID6@Bibwk" 1596 | . "mAAAAImEJJwAAACJ0A+vwomEJJQAAADpffX@@8dEJEAAAAAAx0QkHAAAAABFMf@H" 1597 | . "RCQYAAAAAOn19P@@i5QkWAEAAIXSD4589v@@Q40EZESLdCQIQo0spQAAAAAx9jH@" 1598 | . "SJhIA4QkYAEAAEmJxUWF5H5aSIuUJDABAABJY8ZMY99FMclNAetIjUwCAg8fRAAA" 1599 | . "D7YRSIPBBERr0iYPtlH7a8JLQY0UAkQPtlH6RInQweAERCnQAdDB+AdDiAQLSYPB" 1600 | . "AUU5zH@KQQHuRAHng8YBRAN0JCA5tCRYAQAAdZBIi3wkWDHSQY1sJP9EiXwkSEUx" 1601 | . "0olcJCBBiddIifhIg8ABSIlEJAi4AQAAAEiJxouEJFgBAABIKf6LfCQwSIl0JBBE" 1602 | . "jXD@RYXkD47TAAAASItEJAhNY99Ii3QkKEuNVB0BTo0MGEiLRCQQTAHeTQHpSo0M" 1603 | . "GDHATAHpZi4PH4QAAAAA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AAAACuEJLwAAAAPttIrlCS0AAAAgfv@@@8A" 1633 | . "D4Z0@@@@QYnfQcHvEEUPtv8Pr9JFD6@@RDn6D4dz@@@@D7bXD6@JD6@SOdEPh2L@" 1634 | . "@@8PttMPr8APr9I50A+HUf@@@0WF9nQFg+4BeDtJg8EBSINEJFBYg0QkeBZEOUwk" 1635 | . "IA+Pkf7@@0SLdCRwRIu8JIwAAABEi5wkkAAAAOmu@f@@RYX2dcfrwESLdCRwRIu8" 1636 | . "JIwAAABEi5wkkAAAAOml@P@@i0QkIIt0JByFwA+Eff3@@0Ux0us5OYQkmAAAAHwY" 1637 | . "D6@JOYwknAAAAHwMD6@SOZQklAAAAH0Jg+4BD4hm@P@@SYPCAUQ5VCQgD44@@f@@" 1638 | . "SIuEJGgBAACLVCQoTIuMJDABAABCAxSQSIuEJHABAABCiwSQicGNQgKJTCQwwekQ" 1639 | . "SJgPtslBD7YEASnIjUoBSGPSD6@ASGPJRQ+2DAlIi0wkMA+2zUEpyUSJyUyLjCQw" 1640 | . "AQAAQQ+2FBFED7ZMJDBEKcqB+@@@@wAPh0r@@@8Pr8mNBEAPr9KNBIiNBFA5ww+C" 1641 | . "VP@@@+lY@@@@x0QkHAAAAADHRCQYAAAAAOlF9@@@RDm0JLABAABEifAPjhvx@@+J" 1642 | . "+CuEJMABAABFMdKDwAFBD0jCicGLhCTAAQAAjUQH@0E5w0EPTsOJxkSJ6CuEJLgB" 1643 | . "AACDwAFED0nQi4QkuAEAAEGNRAX@OcUPTsU5zolEJCAPjEH7@@9EieJJY8IPr9FI" 1644 | . "Y9JIAdBIA4QkYAEAAEmJwY1GAYlEJCiLRCQgRCnQSI1wAUQ7VCQgfxNKjRQOTInI" 1645 | . "gCADSIPAAUg50HX0g8EBTANMJFg7TCQoddjp6Pr@@4uMJCgBAACFyQ+FQf@@@+nU" 1646 | . "+v@@kJCQkJCQkJCQkJCQkA==" 1647 | MyFunc:=this.MCode(StrReplace((A_PtrSize=8?x64:x32),"@","/")) 1648 | } 1649 | text:=j[1], w:=j[2], h:=j[3] 1650 | , err1:=this.Floor(j[4] ? j[5] : ini.err1) 1651 | , err0:=this.Floor(j[4] ? j[6] : ini.err0) 1652 | , mode:=j[7], color:=j[8], n:=j[9] 1653 | ok:=(!ini.bits.Scan0 || mode<1 || mode>5) ? 0 1654 | : DllCall(MyFunc.Ptr, "int",mode, "uint",color, "uint",n, "int",dir 1655 | , "Ptr",ini.bits.Scan0, "int",ini.bits.Stride 1656 | , "int",sx, "int",sy, "int",sw, "int",sh 1657 | , "Ptr",ini.ss, "Ptr",ini.s1, "Ptr",ini.s0 1658 | , "Ptr",text, "int",w, "int",h 1659 | , "int",Floor(Abs(err1)*1024), "int",Floor(Abs(err0)*1024) 1660 | , "int",(err1<0||err0<0), "Ptr",ini.allpos, "int",ini.allpos_max 1661 | , "int",Floor(w*ini.zoomW), "int",Floor(h*ini.zoomH)) 1662 | return ok 1663 | } 1664 | 1665 | code() 1666 | { 1667 | return " 1668 | ( 1669 | 1670 | //***** C source code of machine code ***** 1671 | // gcc.exe -m32/-m64 -O2 1672 | 1673 | int __attribute__((__stdcall__)) PicFind( 1674 | int mode, unsigned int c, unsigned int n, int dir 1675 | , unsigned char * Bmp, int Stride 1676 | , int sx, int sy, int sw, int sh 1677 | , unsigned char * ss, unsigned int * s1, unsigned int * s0 1678 | , unsigned char * text, int w, int h 1679 | , int err1, int err0, int more_err 1680 | , unsigned int * allpos, int allpos_max 1681 | , int new_w, int new_h ) 1682 | { 1683 | int ok, o, i, j, k, v, e1, e0, len1, len0, max, pic, shape, sort; 1684 | int x, y, x1, y1, x2, y2, x3, y3, r, g, b, rr, gg, bb, dR, dG, dB; 1685 | int ii, jj, RunDir, DirCount, RunCount, AllCount1, AllCount2; 1686 | unsigned int c1, c2, *cors, *arr; 1687 | unsigned char *ts, *gs; 1688 | ok=0; o=0; v=0; len1=0; len0=0; ts=ss+sw; gs=ss+sw*3; 1689 | arr=allpos+allpos_max; sort=(dir==0); 1690 | //---------------------- 1691 | if (mode==5) 1692 | { 1693 | if (pic=(c==2)) // FindPic 1694 | { 1695 | cors=(unsigned int *)(text+w*h*4); j=(err0>>10)+1; n*=2; 1696 | for (y=0; y>16)&0xFF)-rr; g=((c1>>8)&0xFF)-gg; b=(c1&0xFF)-bb; 1705 | v=(c2<0x1000000) ? (3*r*r+4*g*g+2*b*b<=c2) 1706 | : (r*r<=((c2>>16)&0xFF)*((c2>>16)&0xFF) 1707 | && g*g<=((c2>>8)&0xFF)*((c2>>8)&0xFF) && b*b<=(c2&0xFF)*(c2&0xFF)); 1708 | if (v) goto NoMatch1; 1709 | } 1710 | s1[len1]=(y*new_h/h)*Stride+(x*new_w/w)*4; 1711 | s0[len1++]=rr<<16|gg<<8|bb; 1712 | NoMatch1:; 1713 | } 1714 | } 1715 | c2=cors[1]; r=(c2>>16)&0xFF; g=(c2>>8)&0xFF; b=c2&0xFF; dR=r*r; dG=g*g; dB=b*b; 1716 | } 1717 | else // FindMultiColor or FindColor 1718 | { 1719 | shape=(c==1); // FindShape 1720 | cors=(unsigned int *)text; 1721 | for (i=0; i>16; x=c&0xFFFF; 1724 | s1[len1]=(y*new_h/h)*Stride+(x*new_w/w)*4; 1725 | s0[len1++]=o+cors[o+1]*2; 1726 | } 1727 | cors+=2; 1728 | } 1729 | goto StartLookUp; 1730 | } 1731 | //---------------------- 1732 | // Generate Lookup Table 1733 | for (y=0; y>16; x=c&0xFFFF; 1750 | c=(y*new_h/h)*Stride+(x*new_w/w)*4; 1751 | goto StartLookUp; 1752 | } 1753 | //---------------------- 1754 | // Generate Two Value Image 1755 | o=sy*Stride+sx*4; j=Stride-sw*4; i=0; 1756 | if (mode==1) // Color Mode 1757 | { 1758 | cors=(unsigned int *)(text+w*h); n*=2; 1759 | for (y=0; y>16)&0xFF)-rr; g=((c1>>8)&0xFF)-gg; b=(c1&0xFF)-bb; 1768 | v=(c2<0x1000000) ? (3*r*r+4*g*g+2*b*b<=c2) 1769 | : (r*r<=((c2>>16)&0xFF)*((c2>>16)&0xFF) 1770 | && g*g<=((c2>>8)&0xFF)*((c2>>8)&0xFF) && b*b<=(c2&0xFF)*(c2&0xFF)); 1771 | if (v) break; 1772 | } 1773 | ts[i]=(v) ? 1:0; 1774 | } 1775 | } 1776 | } 1777 | else if (mode==2) // Gray Threshold Mode 1778 | { 1779 | c=(c+1)<<7; 1780 | for (y=0; y>7; 1790 | } 1791 | for (i=0, y=0; yn || gs[i+1]>n 1799 | || gs[i-sw]>n || gs[i+sw]>n 1800 | || gs[i-sw-1]>n || gs[i-sw+1]>n 1801 | || gs[i+sw-1]>n || gs[i+sw+1]>n) ? 1:0; 1802 | } 1803 | } 1804 | //---------------------- 1805 | StartLookUp: 1806 | for (i=0, y=0; y=4) { ss[i]=4; continue; } 1811 | r=ts[i]; g=(x==0 ? 3 : ts[i-1]); b=(x==sw-1 ? 3 : ts[i+1]); 1812 | if (more_err) 1813 | ss[i]=4|(r==2||r==1||g==1||b==1)<<1|(r==2||r==0||g==0||b==0); 1814 | else 1815 | ss[i]=4|(r==2||r==1)<<1|(r==2||r==0); 1816 | } 1817 | } 1818 | if (mode<4 && more_err) sx++; 1819 | err1=(len1*err1)>>10; 1820 | err0=(len0*err0)>>10; 1821 | if (err1>=len1) len1=0; 1822 | if (err0>=len0) len0=0; 1823 | max=(len1>len0) ? len1 : len0; 1824 | w=new_w; h=new_h; x1=0; y1=0; x2=sw-w; y2=sh-h; 1825 | // 1 ==> ( Left to Right ) Top to Bottom 1826 | // 2 ==> ( Right to Left ) Top to Bottom 1827 | // 3 ==> ( Left to Right ) Bottom to Top 1828 | // 4 ==> ( Right to Left ) Bottom to Top 1829 | // 5 ==> ( Top to Bottom ) Left to Right 1830 | // 6 ==> ( Bottom to Top ) Left to Right 1831 | // 7 ==> ( Top to Bottom ) Right to Left 1832 | // 8 ==> ( Bottom to Top ) Right to Left 1833 | // 9 ==> Center to Four Sides 1834 | if (dir==9) 1835 | { 1836 | x=(x1+x2)/2; y=(y1+y2)/2; i=x2-x1+1; j=y2-y1+1; 1837 | AllCount1=i*j; i=(i>j?i:j)+8; 1838 | AllCount2=i*i; RunCount=0; DirCount=1; RunDir=0; 1839 | for (ii=0; RunCount=x1 && x<=x2 && y>=y1 && y<=y2) 1844 | { 1845 | RunCount++; 1846 | goto FindPos; 1847 | FindPos_GoBak:; 1848 | } 1849 | if (RunDir==0) y--; 1850 | else if (RunDir==1) x++; 1851 | else if (RunDir==2) y++; 1852 | else x--; 1853 | } 1854 | if (RunDir & 1) DirCount++; 1855 | RunDir = (++RunDir) & 3; 1856 | } 1857 | goto Return1; 1858 | } 1859 | if (dir<1 || dir>8) dir=1; 1860 | if (--dir>3) { r=y1; y1=x1; x1=r; r=y2; y2=x2; x2=r; } 1861 | for (y3=y1; y3<=y2; y3++) 1862 | { 1863 | for (x3=x1; x3<=x2; x3++) 1864 | { 1865 | y=(dir & 2) ? y1+y2-y3 : y3; 1866 | x=(dir & 1) ? x1+x2-x3 : x3; 1867 | if (dir>3) { r=y; y=x; x=r; } 1868 | //---------------------- 1869 | FindPos: 1870 | e1=err1; e0=err0; o=y*sw+x; 1871 | if (ss[o]<4) goto NoMatch; 1872 | if (mode<4) 1873 | { 1874 | for (i=0; i>16)&0xFF); 1888 | g=Bmp[1+j]-((c>>8)&0xFF); b=Bmp[j]-(c&0xFF); 1889 | v=(c2<0x1000000)?(3*r*r+4*g*g+2*b*b>c2):(r*r>dR||g*g>dG||b*b>dB); 1890 | if (v && (--e1)<0) goto NoMatch; 1891 | } 1892 | } 1893 | else 1894 | { 1895 | for (i=0; i0xFFFFFF, n=s0[i]; j>16)&0xFF)-rr; g=((c1>>8)&0xFF)-gg; b=(c1&0xFF)-bb; 1903 | v=(c2<0x1000000) ? (3*r*r+4*g*g+2*b*b<=c2) 1904 | : (r*r<=((c2>>16)&0xFF)*((c2>>16)&0xFF) 1905 | && g*g<=((c2>>8)&0xFF)*((c2>>8)&0xFF) && b*b<=(c2&0xFF)*(c2&0xFF)); 1906 | if (v) { if (k) goto NoMatch2; goto MatchOK; } 1907 | } 1908 | if (k) goto MatchOK; 1909 | NoMatch2: 1910 | if ((--e1)<0) goto NoMatch; 1911 | MatchOK:; 1912 | } 1913 | } 1914 | } 1915 | else // mode==4 1916 | { 1917 | o=(sy+y)*Stride+(sx+x)*4; j=o+c; rr=Bmp[2+j]; gg=Bmp[1+j]; bb=Bmp[j]; 1918 | for (i=0; in && (--e1)<0) goto NoMatch; 1924 | } 1925 | if (i=allpos_max) goto Return1; 1937 | } 1938 | // Skip areas that may overlap 1939 | if (!sort) 1940 | { 1941 | r=y-h+1; if (r<0) r=0; rr=y+h-1; if (rr>sh-h) rr=sh-h; 1942 | g=x-w+1; if (g<0) g=0; gg=x+w-1; if (gg>sw-w) gg=sw-w; 1943 | for (i=r; i<=rr; i++) 1944 | for (j=g; j<=gg; j++) 1945 | ss[i*sw+j] &= 3; 1946 | } 1947 | NoMatch: 1948 | if (dir==9) goto FindPos_GoBak; 1949 | } 1950 | } 1951 | //---------------------- 1952 | Return1: 1953 | if (!sort || !allpos || w*h==1) 1954 | return ok; 1955 | // Sort by smallest error 1956 | for (i=1; i=0 && arr[j]>k; j--) 1960 | { 1961 | arr[j+1]=arr[j]; allpos[j+1]=allpos[j]; 1962 | } 1963 | arr[j+1]=k; allpos[j+1]=v; 1964 | } 1965 | // Clean up overlapping results 1966 | w*=w; h*=h; k=ok; ok=0; 1967 | for (i=0; i>16; 1970 | for (j=0; j>16)-y1; 1973 | if (x*x 1999 | if RegExMatch(v, "O)<([^>\n]*)>", r) 2000 | v:=StrReplace(v,r[0]), comment:=Trim(r[1]) 2001 | ; You can Add two fault-tolerant in the [], separated by commas 2002 | if RegExMatch(v, "O)\[([^\]\n]*)]", r) 2003 | { 2004 | v:=StrReplace(v,r[0]), r:=StrSplit(r[1] ",", ",") 2005 | , seterr:=1, err1:=r[1], err0:=r[2] 2006 | } 2007 | color:=SubStr(v,1,InStr(v,"$")-1), v:=Trim(SubStr(v,InStr(v,"$")+1)) 2008 | mode:=InStr(color,"##") ? 5 : InStr(color,"#") ? 4 2009 | : InStr(color,"**") ? 3 : InStr(color,"*") ? 2 : 1 2010 | color:=RegExReplace(StrReplace(color,"@","-"), "[*#\s]") 2011 | (mode=1 || mode=5) && color:=StrReplace(color,"0x") 2012 | if (mode=5) 2013 | { 2014 | if !(v~="^[\s\-\w.]+/[\s\-\w.]+/[\s\-\w./,]+$") ; 2015 | { 2016 | if !(hBM:=LoadPicture(v)) 2017 | { 2018 | MsgBox, 4096, Tip, Can't Load Picture ! %v% 2019 | return 2020 | } 2021 | this.GetBitmapWH(hBM, w, h) 2022 | if (w<1 || h<1) 2023 | return 2024 | hBM2:=this.CreateDIBSection(w, h, 32, Scan0) 2025 | this.CopyHBM(hBM2, 0, 0, hBM, 0, 0, w, h) 2026 | DllCall("DeleteObject", "Ptr",hBM) 2027 | if (!Scan0) 2028 | return 2029 | arr:=StrSplit(color "/", "/"), arr.Pop(), n:=arr.Length() 2030 | bmp.Push(buf:=this.Buffer(w*h*4 + n*2*4)), v:=buf.Ptr, p:=v+w*h*4-4 2031 | DllCall("RtlMoveMemory", "Ptr",v, "Ptr",Scan0, "Ptr",w*h*4) 2032 | DllCall("DeleteObject", "Ptr",hBM2), color:=Trim(arr[1],"-") 2033 | For k1,v1 in arr 2034 | c:=StrSplit(Trim(v1,"-") "-" color, "-") 2035 | , x:=this.Floor(c[2]), x:=(x<=0||x>1?0:Floor(9*255*255*(1-x)*(1-x))) 2036 | , NumPut(this.ToRGB(c[1]), 0|p+=4, "uint") 2037 | , NumPut((InStr(c[2],".")?x:this.Floor("0x" c[2])|0x1000000), 0|p+=4, "uint") 2038 | color:=2 2039 | } 2040 | else ; or or 2041 | { 2042 | color:=Trim(StrSplit(color "/", "/")[1], "-") 2043 | arr:=StrSplit(Trim(RegExReplace(v, "i)\s|0x"), ","), ",") 2044 | if !(n:=arr.Length()) 2045 | return 2046 | bmp.Push(buf:=this.Buffer(n*22*4)), v:=buf.Ptr 2047 | shape:=(n>1 && StrLen(StrSplit(arr[1] "//","/")[3])=1 ? 1:0) 2048 | For k1,v1 in arr 2049 | { 2050 | r:=StrSplit(v1 "/","/"), x:=this.Floor(r[1]), y:=this.Floor(r[2]) 2051 | , (A_Index=1) ? (x1:=x2:=x, y1:=y2:=y) 2052 | : (x1:=Min(x1,x), x2:=Max(x2,x), y1:=Min(y1,y), y2:=Max(y2,y)) 2053 | } 2054 | For k1,v1 in arr 2055 | { 2056 | r:=StrSplit(v1 "/","/"), x:=this.Floor(r[1])-x1, y:=this.Floor(r[2])-y1 2057 | , NumPut(y<<16|x, 0|p:=v+(A_Index-1)*22*4, "uint") 2058 | , NumPut(n1:=Min(Max(r.Length()-3,0),(shape?1:10)), 0|p+=4, "uint") 2059 | Loop % n1 2060 | c:=StrSplit(Trim(v1:=r[2+A_Index],"-") "-" color, "-") 2061 | , x:=this.Floor(c[2]), x:=(x<=0||x>1?0:Floor(9*255*255*(1-x)*(1-x))) 2062 | , NumPut(this.ToRGB(c[1])&0xFFFFFF|(!shape&&InStr(v1,"-")=1?0x1000000:0), 0|p+=4, "uint") 2063 | , NumPut((InStr(c[2],".")?x:this.Floor("0x" c[2])|0x1000000), 0|p+=4, "uint") 2064 | } 2065 | color:=shape, w:=x2-x1+1, h:=y2-y1+1 2066 | } 2067 | } 2068 | else 2069 | { 2070 | r:=StrSplit(v ".", "."), w:=this.Floor(r[1]) 2071 | , v:=this.base64tobit(r[2]), h:=StrLen(v)//w 2072 | if (w<1 || h<1 || StrLen(v)!=w*h) 2073 | return 2074 | arr:=StrSplit(color "/", "/"), arr.Pop(), n:=arr.Length() 2075 | , bmp.Push(buf:=this.Buffer(StrPut(v, "CP0") + n*2*4)) 2076 | , StrPut(v, buf.Ptr, "CP0"), v:=buf.Ptr, p:=v+w*h-4 2077 | , color:=this.Floor(color) 2078 | if (mode=1) 2079 | { 2080 | For k1,v1 in arr 2081 | c:=StrSplit(Trim(v1,"-") "-", "-") 2082 | , x:=this.Floor(c[2]), x:=(x<=0||x>1?0:Floor(9*255*255*(1-x)*(1-x))) 2083 | , NumPut(this.ToRGB(c[1]), 0|p+=4, "uint") 2084 | , NumPut((InStr(c[2],".")?x:this.Floor("0x" c[2])|0x1000000), 0|p+=4, "uint") 2085 | } 2086 | else if (mode=4) 2087 | { 2088 | r:=StrSplit(Trim(arr[1],"-") "-", "-") 2089 | , n:=this.Floor(r[2]), n:=(n<=0||n>1?0:Floor(9*255*255*(1-n)*(1-n))) 2090 | , c:=this.Floor(r[1]), color:=(c<1||c>w*h?0:((c-1)//w)<<16|Mod(c-1,w)) 2091 | } 2092 | } 2093 | return info[key]:=[v, w, h, seterr, err1, err0, mode, color, n, comment] 2094 | } 2095 | 2096 | ToRGB(color) ; color can use: RRGGBB, Red, Yellow, Black, White 2097 | { 2098 | static init, tab 2099 | if !VarSetCapacity(init) && (init:="1") 2100 | tab:=Object("Black", "000000", "White", "FFFFFF" 2101 | , "Red", "FF0000", "Green", "008000", "Blue", "0000FF" 2102 | , "Yellow", "FFFF00", "Silver", "C0C0C0", "Gray", "808080" 2103 | , "Teal", "008080", "Navy", "000080", "Aqua", "00FFFF" 2104 | , "Olive", "808000", "Lime", "00FF00", "Fuchsia", "FF00FF" 2105 | , "Purple", "800080", "Maroon", "800000") 2106 | return this.Floor("0x" (tab.HasKey(color)?tab[color]:color)) 2107 | } 2108 | 2109 | Buffer(size, FillByte:="") 2110 | { 2111 | local 2112 | buf:={}, buf.SetCapacity("_key", size), p:=buf.GetAddress("_key") 2113 | , (FillByte!="" && DllCall("RtlFillMemory","Ptr",p,"Ptr",size,"uchar",FillByte)) 2114 | , buf.Ptr:=p, buf.Size:=size 2115 | return buf 2116 | } 2117 | 2118 | GetBitsFromScreen(ByRef x:=0, ByRef y:=0, ByRef w:=0, ByRef h:=0 2119 | , ScreenShot:=1, ByRef zx:=0, ByRef zy:=0, ByRef zw:=0, ByRef zh:=0) 2120 | { 2121 | local 2122 | static init, CAPTUREBLT 2123 | if !VarSetCapacity(init) && (init:="1") ; thanks Descolada 2124 | { 2125 | DllCall("Dwmapi\DwmIsCompositionEnabled", "Int*",i:=0) 2126 | CAPTUREBLT:=i ? 0 : 0x40000000 2127 | } 2128 | if InStr(A_OSVersion, ".") ; thanks QQ:349029755 2129 | Try DllCall("SetThreadDpiAwarenessContext", "Ptr",-3, "Ptr") 2130 | (!IsObject(this.bits) && this.bits:={Scan0:0, hBM:0, oldzw:0, oldzh:0}) 2131 | , bits:=this.bits 2132 | if (!ScreenShot && bits.Scan0) 2133 | { 2134 | zx:=bits.zx, zy:=bits.zy, zw:=bits.zw, zh:=bits.zh 2135 | , w:=Min(x+w,zx+zw), x:=Max(x,zx), w-=x 2136 | , h:=Min(y+h,zy+zh), y:=Max(y,zy), h-=y 2137 | return bits 2138 | } 2139 | bch:=A_BatchLines, cri:=A_IsCritical 2140 | Critical 2141 | bits.BindWindow:=id:=this.BindWindow(0,0,1) 2142 | if (id) 2143 | { 2144 | WinGet, id, ID, ahk_id %id% 2145 | WinGetPos, zx, zy, zw, zh, ahk_id %id% 2146 | } 2147 | if (!id) 2148 | { 2149 | SysGet, zx, 76 2150 | SysGet, zy, 77 2151 | SysGet, zw, 78 2152 | SysGet, zh, 79 2153 | } 2154 | this.UpdateBits(bits, zx, zy, zw, zh) 2155 | , w:=Min(x+w,zx+zw), x:=Max(x,zx), w-=x 2156 | , h:=Min(y+h,zy+zh), y:=Max(y,zy), h-=y 2157 | if (!ScreenShot || w<1 || h<1 || !bits.hBM) 2158 | { 2159 | Critical % cri 2160 | SetBatchLines % bch 2161 | return bits 2162 | } 2163 | if IsFunc(k:="GetBitsFromScreen2") 2164 | && %k%(bits, x-zx, y-zy, w, h) 2165 | { 2166 | ; Get the bind window use bits.BindWindow 2167 | ; Each small range of data obtained from DXGI must be 2168 | ; copied to the screenshot cache using FindText().CopyBits() 2169 | zx:=bits.zx, zy:=bits.zy, zw:=bits.zw, zh:=bits.zh 2170 | Critical % cri 2171 | SetBatchLines % bch 2172 | return bits 2173 | } 2174 | mDC:=DllCall("CreateCompatibleDC", "Ptr",0, "Ptr") 2175 | oBM:=DllCall("SelectObject", "Ptr",mDC, "Ptr",bits.hBM, "Ptr") 2176 | if (id) 2177 | { 2178 | if (mode:=this.BindWindow(0,0,0,1))<2 2179 | { 2180 | hDC:=DllCall("GetDCEx", "Ptr",id, "Ptr",0, "int",3, "Ptr") 2181 | DllCall("BitBlt","Ptr",mDC,"int",x-zx,"int",y-zy,"int",w,"int",h 2182 | , "Ptr",hDC, "int",x-zx, "int",y-zy, "uint",0xCC0020|CAPTUREBLT) 2183 | DllCall("ReleaseDC", "Ptr",id, "Ptr",hDC) 2184 | } 2185 | else 2186 | { 2187 | hBM2:=this.CreateDIBSection(zw, zh) 2188 | mDC2:=DllCall("CreateCompatibleDC", "Ptr",0, "Ptr") 2189 | oBM2:=DllCall("SelectObject", "Ptr",mDC2, "Ptr",hBM2, "Ptr") 2190 | DllCall("UpdateWindow", "Ptr",id) 2191 | ; RDW_INVALIDATE=0x1|RDW_ERASE=0x4|RDW_ALLCHILDREN=0x80|RDW_FRAME=0x400 2192 | ; DllCall("RedrawWindow", "Ptr",id, "Ptr",0, "Ptr",0, "uint", 0x485) 2193 | DllCall("PrintWindow", "Ptr",id, "Ptr",mDC2, "uint",(mode>3)*3) 2194 | DllCall("BitBlt","Ptr",mDC,"int",x-zx,"int",y-zy,"int",w,"int",h 2195 | , "Ptr",mDC2, "int",x-zx, "int",y-zy, "uint",0xCC0020) 2196 | DllCall("SelectObject", "Ptr",mDC2, "Ptr",oBM2) 2197 | DllCall("DeleteDC", "Ptr",mDC2) 2198 | DllCall("DeleteObject", "Ptr",hBM2) 2199 | } 2200 | } 2201 | else 2202 | { 2203 | hDC:=DllCall("GetWindowDC","Ptr",id:=DllCall("GetDesktopWindow","Ptr"),"Ptr") 2204 | DllCall("BitBlt","Ptr",mDC,"int",x-zx,"int",y-zy,"int",w,"int",h 2205 | , "Ptr",hDC, "int",x, "int",y, "uint",0xCC0020|CAPTUREBLT) 2206 | DllCall("ReleaseDC", "Ptr",id, "Ptr",hDC) 2207 | } 2208 | if this.CaptureCursor(0,0,0,0,0,1) 2209 | this.CaptureCursor(mDC, zx, zy, zw, zh) 2210 | DllCall("SelectObject", "Ptr",mDC, "Ptr",oBM) 2211 | DllCall("DeleteDC", "Ptr",mDC) 2212 | Critical % cri 2213 | SetBatchLines % bch 2214 | return bits 2215 | } 2216 | 2217 | UpdateBits(bits, zx, zy, zw, zh) 2218 | { 2219 | local 2220 | if (zw>bits.oldzw || zh>bits.oldzh || !bits.hBM) 2221 | { 2222 | Try DllCall("DeleteObject", "Ptr",bits.hBM) 2223 | bits.hBM:=this.CreateDIBSection(zw, zh, bpp:=32, ppvBits) 2224 | , bits.Scan0:=(!bits.hBM ? 0:ppvBits) 2225 | , bits.Stride:=((zw*bpp+31)//32)*4 2226 | , bits.oldzw:=zw, bits.oldzh:=zh 2227 | } 2228 | bits.zx:=zx, bits.zy:=zy, bits.zw:=zw, bits.zh:=zh 2229 | } 2230 | 2231 | CreateDIBSection(w, h, bpp:=32, ByRef ppvBits:=0) 2232 | { 2233 | local 2234 | VarSetCapacity(bi, 40, 0), NumPut(40, bi, 0, "int") 2235 | , NumPut(w, bi, 4, "int"), NumPut(-h, bi, 8, "int") 2236 | , NumPut(1, bi, 12, "short"), NumPut(bpp, bi, 14, "short") 2237 | return DllCall("CreateDIBSection", "Ptr",0, "Ptr",&bi 2238 | , "int",0, "Ptr*",ppvBits:=0, "Ptr",0, "int",0, "Ptr") 2239 | } 2240 | 2241 | GetBitmapWH(hBM, ByRef w, ByRef h) 2242 | { 2243 | local 2244 | VarSetCapacity(bm, size:=(A_PtrSize=8 ? 32:24), 0) 2245 | , DllCall("GetObject", "Ptr",hBM, "int",size, "Ptr",&bm) 2246 | , w:=NumGet(bm,4,"int"), h:=Abs(NumGet(bm,8,"int")) 2247 | } 2248 | 2249 | CopyHBM(hBM1, x1, y1, hBM2, x2, y2, w, h, Clear:=0) 2250 | { 2251 | local 2252 | if (w<1 || h<1 || !hBM1 || !hBM2) 2253 | return 2254 | mDC1:=DllCall("CreateCompatibleDC", "Ptr",0, "Ptr") 2255 | oBM1:=DllCall("SelectObject", "Ptr",mDC1, "Ptr",hBM1, "Ptr") 2256 | mDC2:=DllCall("CreateCompatibleDC", "Ptr",0, "Ptr") 2257 | oBM2:=DllCall("SelectObject", "Ptr",mDC2, "Ptr",hBM2, "Ptr") 2258 | DllCall("BitBlt", "Ptr",mDC1, "int",x1, "int",y1, "int",w, "int",h 2259 | , "Ptr",mDC2, "int",x2, "int",y2, "uint",0xCC0020) 2260 | if (Clear) 2261 | DllCall("BitBlt", "Ptr",mDC1, "int",x1, "int",y1, "int",w, "int",h 2262 | , "Ptr",mDC1, "int",x1, "int",y1, "uint",MERGECOPY:=0xC000CA) 2263 | DllCall("SelectObject", "Ptr",mDC1, "Ptr",oBM1) 2264 | DllCall("DeleteDC", "Ptr",mDC1) 2265 | DllCall("SelectObject", "Ptr",mDC2, "Ptr",oBM2) 2266 | DllCall("DeleteDC", "Ptr",mDC2) 2267 | } 2268 | 2269 | CopyBits(Scan01,Stride1,x1,y1,Scan02,Stride2,x2,y2,w,h,Reverse:=0) 2270 | { 2271 | local 2272 | if (w<1 || h<1 || !Scan01 || !Scan02) 2273 | return 2274 | static init, MFCopyImage 2275 | if !VarSetCapacity(init) && (init:="1") 2276 | { 2277 | MFCopyImage:=DllCall("GetProcAddress", "Ptr" 2278 | , DllCall("LoadLibrary", "Str","Mfplat.dll", "Ptr") 2279 | , "AStr","MFCopyImage", "Ptr") 2280 | } 2281 | if (MFCopyImage && !Reverse) ; thanks QQ:121507989 2282 | { 2283 | return DllCall(MFCopyImage 2284 | , "Ptr",Scan01+y1*Stride1+x1*4, "int",Stride1 2285 | , "Ptr",Scan02+y2*Stride2+x2*4, "int",Stride2 2286 | , "uint",w*4, "uint",h) 2287 | } 2288 | ListLines % (lls:=A_ListLines)?0:0 2289 | SetBatchLines % (bch:=A_BatchLines)?"-1":"-1" 2290 | p1:=Scan01+(y1-1)*Stride1+x1*4 2291 | , p2:=Scan02+(y2-1)*Stride2+x2*4, w*=4 2292 | , (Reverse) && (p2+=(h+1)*Stride2, Stride2:=-Stride2) 2293 | Loop % h 2294 | DllCall("RtlMoveMemory","Ptr",p1+=Stride1,"Ptr",p2+=Stride2,"Ptr",w) 2295 | SetBatchLines % bch 2296 | ListLines % lls 2297 | } 2298 | 2299 | DrawHBM(hBM, lines) 2300 | { 2301 | local 2302 | mDC:=DllCall("CreateCompatibleDC", "Ptr",0, "Ptr") 2303 | oBM:=DllCall("SelectObject", "Ptr",mDC, "Ptr",hBM, "Ptr") 2304 | oldc:="", brush:=0, VarSetCapacity(rect, 16) 2305 | For k,v in lines ; [ [x, y, w, h, color] ] 2306 | if IsObject(v) 2307 | { 2308 | if (oldc!=v[5]) 2309 | { 2310 | oldc:=v[5], BGR:=(oldc&0xFF)<<16|oldc&0xFF00|(oldc>>16)&0xFF 2311 | DllCall("DeleteObject", "Ptr",brush) 2312 | brush:=DllCall("CreateSolidBrush", "uint",BGR, "Ptr") 2313 | } 2314 | DllCall("SetRect", "Ptr",&rect, "int",v[1], "int",v[2] 2315 | , "int",v[1]+v[3], "int",v[2]+v[4]) 2316 | DllCall("FillRect", "Ptr",mDC, "Ptr",&rect, "Ptr",brush) 2317 | } 2318 | DllCall("DeleteObject", "Ptr",brush) 2319 | DllCall("SelectObject", "Ptr",mDC, "Ptr",oBM) 2320 | DllCall("DeleteObject", "Ptr",mDC) 2321 | } 2322 | 2323 | ; Bind the window so that it can find images when obscured 2324 | ; by other windows, it's equivalent to always being 2325 | ; at the front desk. Unbind Window using FindText().BindWindow(0) 2326 | 2327 | BindWindow(bind_id:=0, bind_mode:=0, get_id:=0, get_mode:=0) 2328 | { 2329 | local 2330 | (!IsObject(this.bind) && this.bind:={id:0, mode:0, oldStyle:0}) 2331 | , bind:=this.bind 2332 | if (get_id) 2333 | return bind.id 2334 | if (get_mode) 2335 | return bind.mode 2336 | if (bind_id) 2337 | { 2338 | bind.id:=bind_id:=this.Floor(bind_id) 2339 | , bind.mode:=bind_mode, bind.oldStyle:=0 2340 | if (bind_mode & 1) 2341 | { 2342 | WinGet, i, ExStyle, ahk_id %bind_id% 2343 | bind.oldStyle:=i 2344 | WinSet, Transparent, 255, ahk_id %bind_id% 2345 | Loop 30 2346 | { 2347 | Sleep 100 2348 | WinGet, i, Transparent, ahk_id %bind_id% 2349 | } 2350 | Until (i=255) 2351 | } 2352 | } 2353 | else 2354 | { 2355 | bind_id:=bind.id 2356 | if (bind.mode & 1) 2357 | WinSet, ExStyle, % bind.oldStyle, ahk_id %bind_id% 2358 | bind.id:=0, bind.mode:=0, bind.oldStyle:=0 2359 | } 2360 | } 2361 | 2362 | ; Use FindText().CaptureCursor(1) to Capture Cursor 2363 | ; Use FindText().CaptureCursor(0) to Cancel Capture Cursor 2364 | 2365 | CaptureCursor(hDC:=0, zx:=0, zy:=0, zw:=0, zh:=0, get_cursor:=0) 2366 | { 2367 | local 2368 | if (get_cursor) 2369 | return this.Cursor 2370 | if (hDC=1 || hDC=0) && (zw=0) 2371 | { 2372 | this.Cursor:=hDC 2373 | return 2374 | } 2375 | VarSetCapacity(mi, 40, 0), NumPut(16+A_PtrSize, mi, "int") 2376 | DllCall("GetCursorInfo", "Ptr",&mi) 2377 | bShow:=NumGet(mi, 4, "int") 2378 | hCursor:=NumGet(mi, 8, "Ptr") 2379 | x:=NumGet(mi, 8+A_PtrSize, "int") 2380 | y:=NumGet(mi, 12+A_PtrSize, "int") 2381 | if (!bShow) || (x=zx+zw || y>=zy+zh) 2382 | return 2383 | VarSetCapacity(ni, 40, 0) 2384 | DllCall("GetIconInfo", "Ptr",hCursor, "Ptr",&ni) 2385 | xCenter:=NumGet(ni, 4, "int") 2386 | yCenter:=NumGet(ni, 8, "int") 2387 | hBMMask:=NumGet(ni, (A_PtrSize=8?16:12), "Ptr") 2388 | hBMColor:=NumGet(ni, (A_PtrSize=8?24:16), "Ptr") 2389 | DllCall("DrawIconEx", "Ptr",hDC 2390 | , "int",x-xCenter-zx, "int",y-yCenter-zy, "Ptr",hCursor 2391 | , "int",0, "int",0, "int",0, "int",0, "int",3) 2392 | DllCall("DeleteObject", "Ptr",hBMMask) 2393 | DllCall("DeleteObject", "Ptr",hBMColor) 2394 | } 2395 | 2396 | MCode(hex) 2397 | { 2398 | local 2399 | flag:=((hex~="[^A-Fa-f\d\s]") ? 1:4), len:=0 2400 | Loop 2 2401 | if !DllCall("crypt32\CryptStringToBinary", "Str",hex, "uint",0, "uint",flag 2402 | , "Ptr",(A_Index=1?0:(p:=this.Buffer(len)).Ptr), "uint*",len, "Ptr",0, "Ptr",0) 2403 | return 2404 | if DllCall("VirtualProtect", "Ptr",p.Ptr, "Ptr",len, "uint",0x40, "uint*",0) 2405 | return p 2406 | } 2407 | 2408 | bin2hex(addr, size, base64:=0) 2409 | { 2410 | local 2411 | flag:=(base64 ? 1:4)|0x40000000, len:=0 2412 | Loop 2 2413 | DllCall("crypt32\CryptBinaryToString", "Ptr",addr, "uint",size, "uint",flag 2414 | , "Ptr",(A_Index=1?0:(p:=this.Buffer(len*2)).Ptr), "uint*",len) 2415 | return RegExReplace(StrGet(p.Ptr, len), "\s+") 2416 | } 2417 | 2418 | base64tobit(s) 2419 | { 2420 | local 2421 | ListLines % (lls:=A_ListLines)?0:0 2422 | Chars:="0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 2423 | SetFormat, IntegerFast, d 2424 | Loop Parse, Chars 2425 | if InStr(s, A_LoopField, 1) 2426 | s:=RegExReplace(s, "[" A_LoopField "]", ((i:=A_Index-1)>>5&1) 2427 | . (i>>4&1) . (i>>3&1) . (i>>2&1) . (i>>1&1) . (i&1)) 2428 | s:=RegExReplace(RegExReplace(s,"[^01]+"),"10*$") 2429 | ListLines % lls 2430 | return s 2431 | } 2432 | 2433 | bit2base64(s) 2434 | { 2435 | local 2436 | ListLines % (lls:=A_ListLines)?0:0 2437 | s:=RegExReplace(s,"[^01]+") 2438 | s.=SubStr("100000",1,6-Mod(StrLen(s),6)) 2439 | s:=RegExReplace(s,".{6}","|$0") 2440 | Chars:="0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 2441 | SetFormat, IntegerFast, d 2442 | Loop Parse, Chars 2443 | s:=StrReplace(s, "|" . ((i:=A_Index-1)>>5&1) 2444 | . (i>>4&1) . (i>>3&1) . (i>>2&1) . (i>>1&1) . (i&1), A_LoopField) 2445 | ListLines % lls 2446 | return s 2447 | } 2448 | 2449 | ASCII(s) 2450 | { 2451 | local 2452 | if RegExMatch(s, "O)\$(\d+)\.([\w+/]+)", r) 2453 | { 2454 | s:=RegExReplace(this.base64tobit(r[2]),".{" r[1] "}","$0`n") 2455 | s:=StrReplace(StrReplace(s,"0","_"),"1","0") 2456 | } 2457 | else s:="" 2458 | return s 2459 | } 2460 | 2461 | ; You can put the text library at the beginning of the script, 2462 | ; and Use FindText().PicLib(Text,1) to add the text library to PicLib()'s Lib, 2463 | ; Use FindText().PicLib("comment1|comment2|...") to get text images from Lib 2464 | 2465 | PicLib(comments, add_to_Lib:=0, index:=1) 2466 | { 2467 | local 2468 | (!IsObject(this.Lib) && this.Lib:=[]), Lib:=this.Lib 2469 | , (!Lib.HasKey(index) && Lib[index]:=[]), Lib:=Lib[index] 2470 | if (add_to_Lib) 2471 | { 2472 | re:="O)<([^>\n]*)>[^$\n]+\$[^""\r\n]+" 2473 | Loop Parse, comments, | 2474 | if RegExMatch(A_LoopField, re, r) 2475 | { 2476 | s1:=Trim(r[1]), s2:="" 2477 | Loop Parse, s1 2478 | s2.=Format("_{:d}", Ord(A_LoopField)) 2479 | (s2!="") && Lib[s2]:=r[0] 2480 | } 2481 | } 2482 | else 2483 | { 2484 | Text:="" 2485 | Loop Parse, comments, | 2486 | { 2487 | s1:=Trim(A_LoopField), s2:="" 2488 | Loop Parse, s1 2489 | s2.=Format("_{:d}", Ord(A_LoopField)) 2490 | (Lib.HasKey(s2)) && Text.="|" Lib[s2] 2491 | } 2492 | return Text 2493 | } 2494 | } 2495 | 2496 | ; Decompose a string into individual characters and get their data 2497 | 2498 | PicN(Number, index:=1) 2499 | { 2500 | return this.PicLib(RegExReplace(Number,".","|$0"), 0, index) 2501 | } 2502 | 2503 | ; Use FindText().PicX(Text) to automatically cut into multiple characters 2504 | ; Can't be used in ColorPos mode, because it can cause position errors 2505 | 2506 | PicX(Text) 2507 | { 2508 | local 2509 | if !RegExMatch(Text, "O)(<[^$\n]+)\$(\d+)\.([\w+/]+)", r) 2510 | return Text 2511 | v:=this.base64tobit(r[3]), Text:="" 2512 | c:=StrLen(StrReplace(v,"0"))<=StrLen(v)//2 ? "1":"0" 2513 | txt:=RegExReplace(v,".{" r[2] "}","$0`n") 2514 | While InStr(txt,c) 2515 | { 2516 | While !(txt~="m`n)^" c) 2517 | txt:=RegExReplace(txt,"m`n)^.") 2518 | i:=0 2519 | While (txt~="m`n)^.{" i "}" c) 2520 | i:=Format("{:d}",i+1) 2521 | v:=RegExReplace(txt,"m`n)^(.{" i "}).*","$1") 2522 | txt:=RegExReplace(txt,"m`n)^.{" i "}") 2523 | if (v!="") 2524 | Text.="|" r[1] "$" i "." this.bit2base64(v) 2525 | } 2526 | return Text 2527 | } 2528 | 2529 | ; Screenshot and retained as the last screenshot. 2530 | 2531 | ScreenShot(x1:=0, y1:=0, x2:=0, y2:=0) 2532 | { 2533 | this.FindText(,, x1, y1, x2, y2) 2534 | } 2535 | 2536 | ; Get the RGB color of a point from the last screenshot. 2537 | ; If the point to get the color is beyond the range of 2538 | ; Screen, it will return White color (0xFFFFFF). 2539 | 2540 | GetColor(x, y, fmt:=1) 2541 | { 2542 | local 2543 | bits:=this.GetBitsFromScreen(,,,,0,zx,zy,zw,zh), x-=zx, y-=zy 2544 | , c:=(x>=0 && x=0 && y=0 && x=0 && ymax_X ? x : max_X) 2575 | While (min_X!="" && min_X<=max_X) 2576 | { 2577 | LeftX:="" 2578 | For k,v in ok 2579 | { 2580 | x:=v.1, y:=v.2 2581 | if (xoffsetY) 2582 | Continue 2583 | ; Get the leftmost X coordinates 2584 | if (LeftX="" || xdx ? "*":"") . LeftOCR 2593 | ; Update for next search 2594 | min_X:=LeftX+LeftW-(overlapW>LeftW//2 ? LeftW//2:overlapW) 2595 | , dx:=LeftX+LeftW+offsetX, ocr_Y:=LeftY 2596 | , (LeftYmax_Y && max_Y:=LeftY+LeftH) 2598 | } 2599 | (ocr_X="") && ocr_X:=min_Y:=min_X:=max_Y:=0 2600 | return {text:ocr_Text, x:ocr_X, y:min_Y, w:min_X-ocr_X, h:max_Y-min_Y} 2601 | } 2602 | 2603 | ; Sort the results of FindText() from left to right 2604 | ; and top to bottom, ignore slight height difference 2605 | 2606 | Sort(ok, dy:=10) 2607 | { 2608 | local 2609 | if !IsObject(ok) 2610 | return ok 2611 | s:="", n:=150000, ypos:=[] 2612 | For k,v in ok 2613 | { 2614 | x:=v.x, y:=v.y, add:=1 2615 | For k1,v1 in ypos 2616 | if Abs(y-v1)<=dy 2617 | { 2618 | y:=v1, add:=0 2619 | Break 2620 | } 2621 | if (add) 2622 | ypos.Push(y) 2623 | s.=(y*n+x) "." k "|" 2624 | } 2625 | s:=Trim(s,"|") 2626 | Sort, s, N D| 2627 | ok2:=[] 2628 | For k,v in StrSplit(s,"|") 2629 | ok2.Push(ok[SubStr(v,InStr(v,".")+1)]) 2630 | return ok2 2631 | } 2632 | 2633 | ; Sort the results of FindText() according to the nearest distance 2634 | 2635 | Sort2(ok, px, py) 2636 | { 2637 | local 2638 | if !IsObject(ok) 2639 | return ok 2640 | s:="" 2641 | For k,v in ok 2642 | s.=((v.x-px)**2+(v.y-py)**2) "." k "|" 2643 | s:=Trim(s,"|") 2644 | Sort, s, N D| 2645 | ok2:=[] 2646 | For k,v in StrSplit(s,"|") 2647 | ok2.Push(ok[SubStr(v,InStr(v,".")+1)]) 2648 | return ok2 2649 | } 2650 | 2651 | ; Sort the results of FindText() according to the search direction 2652 | 2653 | Sort3(ok, dir:=1) 2654 | { 2655 | local 2656 | if !IsObject(ok) 2657 | return ok 2658 | s:="", n:=150000 2659 | For k,v in ok 2660 | x:=v.1, y:=v.2 2661 | , s.=(dir=1 ? y*n+x 2662 | : dir=2 ? y*n-x 2663 | : dir=3 ? -y*n+x 2664 | : dir=4 ? -y*n-x 2665 | : dir=5 ? x*n+y 2666 | : dir=6 ? x*n-y 2667 | : dir=7 ? -x*n+y 2668 | : dir=8 ? -x*n-y : y*n+x) "." k "|" 2669 | s:=Trim(s,"|") 2670 | Sort, s, N D| 2671 | ok2:=[] 2672 | For k,v in StrSplit(s,"|") 2673 | ok2.Push(ok[SubStr(v,InStr(v,".")+1)]) 2674 | return ok2 2675 | } 2676 | 2677 | ; Prompt mouse position in remote assistance 2678 | 2679 | MouseTip(x:="", y:="", w:=10, h:=10, d:=3) 2680 | { 2681 | local 2682 | if (x="") 2683 | { 2684 | VarSetCapacity(pt,16,0), DllCall("GetCursorPos","Ptr",&pt) 2685 | x:=NumGet(pt,0,"uint"), y:=NumGet(pt,4,"uint") 2686 | } 2687 | Loop 4 2688 | { 2689 | this.RangeTip(x-w, y-h, 2*w+1, 2*h+1, (A_Index & 1 ? "Red":"Blue"), d) 2690 | Sleep 500 2691 | } 2692 | this.RangeTip() 2693 | } 2694 | 2695 | ; Shows a range of the borders, similar to the ToolTip 2696 | 2697 | RangeTip(x:="", y:="", w:="", h:="", color:="Red", d:=3, num:=1) 2698 | { 2699 | local 2700 | ListLines % (lls:=A_ListLines)?0:0 2701 | static init, tab 2702 | if !VarSetCapacity(init) && (init:="1") 2703 | tab:=[] 2704 | (!tab.HasKey(num) && tab[num]:=[0,0,0,0]), Range:=tab[num] 2705 | if (x="") 2706 | { 2707 | if (Range[1]) 2708 | Loop 4 2709 | { 2710 | Gui, % Range[A_Index] ":Destroy" 2711 | Range[A_Index]:=0 2712 | } 2713 | ListLines % lls 2714 | return 2715 | } 2716 | if !(Range[1]) 2717 | { 2718 | Loop 4 2719 | { 2720 | Gui, New, +Hwndid +AlwaysOnTop -Caption +ToolWindow -DPIScale +E0x08000000 2721 | Range[A_Index]:=id 2722 | } 2723 | } 2724 | x:=Floor(x), y:=Floor(y), w:=Floor(w), h:=Floor(h), d:=Floor(d) 2725 | Loop 4 2726 | { 2727 | i:=A_Index 2728 | , x1:=(i=2 ? x+w : x-d) 2729 | , y1:=(i=3 ? y+h : y-d) 2730 | , w1:=(i=1 || i=3 ? w+2*d : d) 2731 | , h1:=(i=2 || i=4 ? h+2*d : d) 2732 | Gui, % Range[i] ":Color", %color% 2733 | Gui, % Range[i] ":Show", NA x%x1% y%y1% w%w1% h%h1% 2734 | } 2735 | ListLines % lls 2736 | } 2737 | 2738 | State(key) 2739 | { 2740 | return GetKeyState(key,"P") || GetKeyState(key) 2741 | } 2742 | 2743 | ; Use RButton to select the screen range 2744 | 2745 | GetRange(ww:=25, hh:=8, key:="RButton") 2746 | { 2747 | local 2748 | static init, KeyOff, hk 2749 | if !VarSetCapacity(init) && (init:="1") 2750 | KeyOff:=this.GetRange.Bind(this, "Off") 2751 | if (ww=="Off") 2752 | return hk:=Trim(A_ThisHotkey, "*") 2753 | ;--------------------- 2754 | GetRange_HotkeyIf:=_Gui:=this.GuiNew() 2755 | _Gui.Opt("-Caption +ToolWindow +E0x80000") 2756 | _Gui.Title:="GetRange_HotkeyIf" 2757 | _Gui.Show("NA x0 y0 w0 h0") 2758 | ;--------------------- 2759 | if GetKeyState("Ctrl") 2760 | Send {Ctrl Up} 2761 | Hotkey, IfWinExist, GetRange_HotkeyIf 2762 | keys:=key "|Up|Down|Left|Right" 2763 | For k,v in StrSplit(keys, "|") 2764 | { 2765 | if GetKeyState(v) 2766 | Send {%v% Up} 2767 | Hotkey, *%v%, %KeyOff%, On UseErrorLevel 2768 | } 2769 | Hotkey, IfWinExist 2770 | ;--------------------- 2771 | Critical % (cri:=A_IsCritical)?"Off":"Off" 2772 | CoordMode, Mouse 2773 | tip:=this.Lang("s5") 2774 | hk:="", oldx:=oldy:="", keydown:=0 2775 | Loop 2776 | { 2777 | Sleep 50 2778 | MouseGetPos, x2, y2 2779 | if (hk=key) || this.State(key) || this.State("Ctrl") 2780 | { 2781 | keydown++ 2782 | if (keydown=1) 2783 | MouseGetPos, x1, y1, Bind_ID 2784 | timeout:=A_TickCount+3000 2785 | While (A_TickCount=2) 2789 | Break 2790 | } 2791 | else if (hk="Up") || this.State("Up") 2792 | (hh>1 && hh--), hk:="" 2793 | else if (hk="Down") || this.State("Down") 2794 | hh++, hk:="" 2795 | else if (hk="Left") || this.State("Left") 2796 | (ww>1 && ww--), hk:="" 2797 | else if (hk="Right") || this.State("Right") 2798 | ww++, hk:="" 2799 | x:=(keydown?x1:x2), y:=(keydown?y1:y2) 2800 | this.RangeTip(x-ww, y-hh, 2*ww+1, 2*hh+1, (A_MSec<500?"Red":"Blue")) 2801 | if (oldx=x2 && oldy=y2) 2802 | Continue 2803 | oldx:=x2, oldy:=y2 2804 | ToolTip % "x: " x " y: " y "`n" tip 2805 | } 2806 | ToolTip 2807 | this.RangeTip() 2808 | Hotkey, IfWinExist, GetRange_HotkeyIf 2809 | For k,v in StrSplit(keys, "|") 2810 | Hotkey, *%v%, %KeyOff%, Off UseErrorLevel 2811 | Hotkey, IfWinExist 2812 | GetRange_HotkeyIf.Destroy() 2813 | Critical % cri 2814 | return [x-ww, y-hh, x+ww, y+hh, Bind_ID] 2815 | } 2816 | 2817 | GetRange2(key:="LButton") 2818 | { 2819 | local 2820 | FindText_GetRange:=_Gui:=this.GuiNew() 2821 | _Gui.Opt("+LastFound +AlwaysOnTop -Caption +ToolWindow -DPIScale +E0x08000000") 2822 | _Gui.BackColor:="White" 2823 | WinSet, Transparent, 10 2824 | this.GetBitsFromScreen(,,,,0,x,y,w,h) 2825 | _Gui.Title:="FindText_GetRange" 2826 | _Gui.Show("NA x" x " y" y " w" w " h" h) 2827 | CoordMode, Mouse 2828 | tip:=this.Lang("s7"), oldx:=oldy:="" 2829 | Loop 2830 | { 2831 | Sleep 50 2832 | MouseGetPos, x1, y1 2833 | if (oldx=x1 && oldy=y1) 2834 | Continue 2835 | oldx:=x1, oldy:=y1 2836 | ToolTip % "x: " x1 " y: " y1 " w: 0 h: 0`n" tip 2837 | } 2838 | Until this.State(key) || this.State("Ctrl") 2839 | Loop 2840 | { 2841 | Sleep 50 2842 | MouseGetPos, x2, y2 2843 | x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1 2844 | this.RangeTip(x, y, w, h, (A_MSec<500 ? "Red":"Blue")) 2845 | if (oldx=x2 && oldy=y2) 2846 | Continue 2847 | oldx:=x2, oldy:=y2 2848 | ToolTip % "x: " x " y: " y " w: " w " h: " h "`n" tip 2849 | } 2850 | Until !(this.State(key) || this.State("Ctrl")) 2851 | ToolTip 2852 | this.RangeTip() 2853 | FindText_GetRange.Destroy() 2854 | Clipboard:=x "," y "," (x+w-1) "," (y+h-1) 2855 | return [x, y, x+w-1, y+h-1] 2856 | } 2857 | 2858 | BitmapFromScreen(ByRef x:=0, ByRef y:=0, ByRef w:=0, ByRef h:=0 2859 | , ScreenShot:=1, ByRef zx:=0, ByRef zy:=0, ByRef zw:=0, ByRef zh:=0) 2860 | { 2861 | local 2862 | bits:=this.GetBitsFromScreen(x,y,w,h,ScreenShot,zx,zy,zw,zh) 2863 | if (w<1 || h<1 || !bits.hBM) 2864 | return 2865 | hBM:=this.CreateDIBSection(w, h) 2866 | this.CopyHBM(hBM, 0, 0, bits.hBM, x-zx, y-zy, w, h, 1) 2867 | return hBM 2868 | } 2869 | 2870 | ; Quickly save screen image to BMP file for debugging 2871 | ; if file = 0 or "", save to Clipboard 2872 | 2873 | SavePic(file:=0, x1:=0, y1:=0, x2:=0, y2:=0, ScreenShot:=1) 2874 | { 2875 | local 2876 | x1:=this.Floor(x1), y1:=this.Floor(y1), x2:=this.Floor(x2), y2:=this.Floor(y2) 2877 | if (x1=0 && y1=0 && x2=0 && y2=0) 2878 | n:=150000, x:=y:=-n, w:=h:=2*n 2879 | else 2880 | x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1 2881 | hBM:=this.BitmapFromScreen(x, y, w, h, ScreenShot) 2882 | this.SaveBitmapToFile(file, hBM) 2883 | DllCall("DeleteObject", "Ptr",hBM) 2884 | } 2885 | 2886 | ; Save Bitmap To File, if file = 0 or "", save to Clipboard 2887 | ; hBM_or_file can be a bitmap handle or file path, eg: "c:\1.bmp" 2888 | 2889 | SaveBitmapToFile(file, hBM_or_file, x:=0, y:=0, w:=0, h:=0) 2890 | { 2891 | local 2892 | if hBM_or_file is number 2893 | hBM_or_file:="HBITMAP:*" hBM_or_file 2894 | if !hBM:=DllCall("CopyImage", "Ptr",LoadPicture(hBM_or_file) 2895 | , "int",0, "int",0, "int",0, "uint",0x2008) 2896 | return 2897 | if (file) || (w!=0 && h!=0) 2898 | { 2899 | (w=0 || h=0) && this.GetBitmapWH(hBM, w, h) 2900 | hBM2:=this.CreateDIBSection(w, -h, bpp:=(file ? 24 : 32)) 2901 | this.CopyHBM(hBM2, 0, 0, hBM, x, y, w, h) 2902 | DllCall("DeleteObject", "Ptr",hBM), hBM:=hBM2 2903 | } 2904 | VarSetCapacity(dib, dib_size:=(A_PtrSize=8 ? 104:84), 0) 2905 | , DllCall("GetObject", "Ptr",hBM, "int",dib_size, "Ptr",&dib) 2906 | , pbi:=&dib+(bitmap_size:=A_PtrSize=8 ? 32:24) 2907 | , size:=NumGet(pbi+20, "uint"), pBits:=NumGet(pbi-A_PtrSize, "Ptr") 2908 | if (!file) 2909 | { 2910 | hdib:=DllCall("GlobalAlloc", "uint",2, "Ptr",40+size, "Ptr") 2911 | pdib:=DllCall("GlobalLock", "Ptr",hdib, "Ptr") 2912 | DllCall("RtlMoveMemory", "Ptr",pdib, "Ptr",pbi, "Ptr",40) 2913 | DllCall("RtlMoveMemory", "Ptr",pdib+40, "Ptr",pBits, "Ptr",size) 2914 | DllCall("GlobalUnlock", "Ptr",hdib) 2915 | DllCall("OpenClipboard", "Ptr",0) 2916 | DllCall("EmptyClipboard") 2917 | DllCall("SetClipboardData", "uint",8, "Ptr",hdib) 2918 | DllCall("CloseClipboard") 2919 | } 2920 | else 2921 | { 2922 | if InStr(file,"\") && !FileExist(dir:=RegExReplace(file,"[^\\]*$")) 2923 | Try FileCreateDir, % dir 2924 | VarSetCapacity(bf, 14, 0), NumPut(0x4D42, bf, "short") 2925 | NumPut(54+size, bf, 2, "uint"), NumPut(54, bf, 10, "uint") 2926 | f:=FileOpen(file, "w"), f.RawWrite(bf, 14) 2927 | , f.RawWrite(pbi+0, 40), f.RawWrite(pBits+0, size), f.Close() 2928 | } 2929 | DllCall("DeleteObject", "Ptr",hBM) 2930 | } 2931 | 2932 | ; Show the saved Picture file 2933 | 2934 | ShowPic(file:="", show:=1, ByRef x:="", ByRef y:="", ByRef w:="", ByRef h:="") 2935 | { 2936 | local 2937 | if (file="") 2938 | { 2939 | this.ShowScreenShot() 2940 | return 2941 | } 2942 | if !(hBM:=LoadPicture(file)) 2943 | return 2944 | this.GetBitmapWH(hBM, w, h) 2945 | bits:=this.GetBitsFromScreen(,,,,0,x,y,zw,zh) 2946 | this.UpdateBits(bits, x, y, Max(w,zw), Max(h,zh)) 2947 | this.CopyHBM(bits.hBM, 0, 0, hBM, 0, 0, w, h) 2948 | DllCall("DeleteObject", "Ptr",hBM) 2949 | if (show) 2950 | this.ShowScreenShot(x, y, x+w-1, y+h-1, 0) 2951 | return 1 2952 | } 2953 | 2954 | ; Show the memory Screenshot for debugging 2955 | 2956 | ShowScreenShot(x1:=0, y1:=0, x2:=0, y2:=0, ScreenShot:=1) 2957 | { 2958 | local 2959 | static init, hPic, oldx, oldy, oldw, oldh, FindText_Screen 2960 | if !VarSetCapacity(init) && (init:="1") 2961 | FindText_Screen:="" 2962 | x1:=this.Floor(x1), y1:=this.Floor(y1), x2:=this.Floor(x2), y2:=this.Floor(y2) 2963 | if (x1=0 && y1=0 && x2=0 && y2=0) 2964 | { 2965 | if (FindText_Screen) 2966 | FindText_Screen.Destroy(), FindText_Screen:="" 2967 | return 2968 | } 2969 | x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1 2970 | if !hBM:=this.BitmapFromScreen(x,y,w,h,ScreenShot) 2971 | return 2972 | ;--------------- 2973 | if (!FindText_Screen) 2974 | { 2975 | FindText_Screen:=_Gui:=this.GuiNew() ; WS_EX_NOACTIVATE:=0x08000000 2976 | _Gui.Opt("+AlwaysOnTop -Caption +ToolWindow -DPIScale +E0x08000000") 2977 | _Gui.MarginX:=0, _Gui.MarginY:=0 2978 | id:=_Gui.Add("Pic", "w" w " h" h), hPic:=id.Hwnd 2979 | _Gui.Title:="Show Pic" 2980 | _Gui.Show("NA x" x " y" y " w" w " h" h) 2981 | oldx:=x, oldy:=y, oldw:=w, oldh:=h 2982 | } 2983 | else if (oldx!=x || oldy!=y || oldw!=w || oldh!=h) 2984 | { 2985 | if (oldw!=w || oldh!=h) 2986 | FindText_Screen[hPic].Move(,, w, h) 2987 | FindText_Screen.Show("NA x" x " y" y " w" w " h" h) 2988 | oldx:=x, oldy:=y, oldw:=w, oldh:=h 2989 | } 2990 | this.BitmapToWindow(hPic, 0, 0, hBM, 0, 0, w, h) 2991 | DllCall("DeleteObject", "Ptr",hBM) 2992 | } 2993 | 2994 | BitmapToWindow(hwnd, x1, y1, hBM, x2, y2, w, h) 2995 | { 2996 | local 2997 | mDC:=DllCall("CreateCompatibleDC", "Ptr",0, "Ptr") 2998 | oBM:=DllCall("SelectObject", "Ptr",mDC, "Ptr",hBM, "Ptr") 2999 | hDC:=DllCall("GetDC", "Ptr",hwnd, "Ptr") 3000 | DllCall("BitBlt", "Ptr",hDC, "int",x1, "int",y1, "int",w, "int",h 3001 | , "Ptr",mDC, "int",x2, "int",y2, "uint",0xCC0020) 3002 | DllCall("ReleaseDC", "Ptr",hwnd, "Ptr",hDC) 3003 | DllCall("SelectObject", "Ptr",mDC, "Ptr",oBM) 3004 | DllCall("DeleteDC", "Ptr",mDC) 3005 | } 3006 | 3007 | ; Quickly get the search data of screen image 3008 | 3009 | GetTextFromScreen(x1:=0, y1:=0, x2:=0, y2:=0, Threshold:="" 3010 | , ScreenShot:=1, ByRef rx:="", ByRef ry:="", cut:=1) 3011 | { 3012 | local 3013 | if (x1=0 && y1=0 && x2=0 && y2=0) 3014 | return this.Gui("CaptureS", ScreenShot) 3015 | SetBatchLines % (bch:=A_BatchLines)?"-1":"-1" 3016 | x1:=this.Floor(x1), y1:=this.Floor(y1), x2:=this.Floor(x2), y2:=this.Floor(y2) 3017 | x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1 3018 | bits:=this.GetBitsFromScreen(x,y,w,h,ScreenShot,zx,zy) 3019 | if (w<1 || h<1 || !bits.Scan0) 3020 | { 3021 | SetBatchLines % bch 3022 | return 3023 | } 3024 | ListLines % (lls:=A_ListLines)?0:0 3025 | gs:=[] 3026 | j:=bits.Stride-w*4, p:=bits.Scan0+(y-zy)*bits.Stride+(x-zx)*4-j-4 3027 | Loop % h + 0*(k:=0) 3028 | Loop % w + 0*(p+=j) 3029 | c:=NumGet(0|p+=4,"uint") 3030 | , gs[++k]:=(((c>>16)&0xFF)*38+((c>>8)&0xFF)*75+(c&0xFF)*15)>>7 3031 | if InStr(Threshold,"**") 3032 | { 3033 | Threshold:=Trim(Threshold,"* "), (Threshold="" && Threshold:=50) 3034 | s:="", sw:=w, w-=2, h-=2, x++, y++ 3035 | Loop % h + 0*(y1:=0) 3036 | Loop % w + 0*(y1++) 3037 | i:=y1*sw+A_Index+1, j:=gs[i]+Threshold 3038 | , s.=( gs[i-1]>j || gs[i+1]>j 3039 | || gs[i-sw]>j || gs[i+sw]>j 3040 | || gs[i-sw-1]>j || gs[i-sw+1]>j 3041 | || gs[i+sw-1]>j || gs[i+sw+1]>j ) ? "1":"0" 3042 | Threshold:="**" Threshold 3043 | } 3044 | else 3045 | { 3046 | Threshold:=Trim(Threshold,"* ") 3047 | if (Threshold="") 3048 | { 3049 | pp:=[] 3050 | Loop 256 3051 | pp[A_Index-1]:=0 3052 | Loop % w*h 3053 | pp[gs[A_Index]]++ 3054 | IP0:=IS0:=0 3055 | Loop 256 3056 | k:=A_Index-1, IP0+=k*pp[k], IS0+=pp[k] 3057 | Threshold:=Floor(IP0/IS0) 3058 | Loop 20 3059 | { 3060 | LastThreshold:=Threshold 3061 | IP1:=IS1:=0 3062 | Loop % LastThreshold+1 3063 | k:=A_Index-1, IP1+=k*pp[k], IS1+=pp[k] 3064 | IP2:=IP0-IP1, IS2:=IS0-IS1 3065 | if (IS1!=0 && IS2!=0) 3066 | Threshold:=Floor((IP1/IS1+IP2/IS2)/2) 3067 | if (Threshold=LastThreshold) 3068 | Break 3069 | } 3070 | } 3071 | s:="" 3072 | Loop % w*h 3073 | s.=gs[A_Index]<=Threshold ? "1":"0" 3074 | Threshold:="*" Threshold 3075 | } 3076 | ListLines % lls 3077 | ;-------------------- 3078 | w:=Format("{:d}",w), CutUp:=CutDown:=0 3079 | if (cut=1) 3080 | { 3081 | re1:="(^0{" w "}|^1{" w "})" 3082 | re2:="(0{" w "}$|1{" w "}$)" 3083 | While (s~=re1) 3084 | s:=RegExReplace(s,re1), CutUp++ 3085 | While (s~=re2) 3086 | s:=RegExReplace(s,re2), CutDown++ 3087 | } 3088 | rx:=x+w//2, ry:=y+CutUp+(h-CutUp-CutDown)//2 3089 | s:="|<>" Threshold "$" w "." this.bit2base64(s) 3090 | ;-------------------- 3091 | SetBatchLines % bch 3092 | return s 3093 | } 3094 | 3095 | ; Wait for the screen image to change within a few seconds 3096 | ; Take a Screenshot before using it: FindText().ScreenShot() 3097 | 3098 | WaitChange(time:=-1, x1:=0, y1:=0, x2:=0, y2:=0) 3099 | { 3100 | local 3101 | hash:=this.GetPicHash(x1, y1, x2, y2, 0) 3102 | time:=this.Floor(time), timeout:=A_TickCount+Round(time*1000) 3103 | Loop 3104 | { 3105 | if (hash!=this.GetPicHash(x1, y1, x2, y2, 1)) 3106 | return 1 3107 | if (time>=0 && A_TickCount>=timeout) 3108 | Break 3109 | Sleep 10 3110 | } 3111 | return 0 3112 | } 3113 | 3114 | ; Wait for the screen image to stabilize 3115 | 3116 | WaitNotChange(time:=1, timeout:=30, x1:=0, y1:=0, x2:=0, y2:=0) 3117 | { 3118 | local 3119 | oldhash:="", time:=this.Floor(time) 3120 | , timeout:=A_TickCount+Round(this.Floor(timeout)*1000) 3121 | Loop 3122 | { 3123 | hash:=this.GetPicHash(x1, y1, x2, y2, 1), t:=A_TickCount 3124 | if (hash!=oldhash) 3125 | oldhash:=hash, timeout2:=t+Round(time*1000) 3126 | if (t>=timeout2) 3127 | return 1 3128 | if (t>=timeout) 3129 | return 0 3130 | Sleep 100 3131 | } 3132 | } 3133 | 3134 | GetPicHash(x1:=0, y1:=0, x2:=0, y2:=0, ScreenShot:=1) 3135 | { 3136 | local 3137 | static init:=DllCall("LoadLibrary", "Str","ntdll", "Ptr") 3138 | x1:=this.Floor(x1), y1:=this.Floor(y1), x2:=this.Floor(x2), y2:=this.Floor(y2) 3139 | if (x1=0 && y1=0 && x2=0 && y2=0) 3140 | n:=150000, x:=y:=-n, w:=h:=2*n 3141 | else 3142 | x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1 3143 | bits:=this.GetBitsFromScreen(x,y,w,h,ScreenShot,zx,zy), x-=zx, y-=zy 3144 | if (w<1 || h<1 || !bits.Scan0) 3145 | return 0 3146 | hash:=0, Stride:=bits.Stride, p:=bits.Scan0+(y-1)*Stride+x*4, w*=4 3147 | ListLines % (lls:=A_ListLines)?0:0 3148 | Loop % h 3149 | hash:=(hash*31+DllCall("ntdll\RtlComputeCrc32", "uint",0 3150 | , "Ptr",p+=Stride, "uint",w, "uint"))&0xFFFFFFFF 3151 | ListLines % lls 3152 | return hash 3153 | } 3154 | 3155 | WindowToScreen(ByRef x, ByRef y, x1, y1, id:="") 3156 | { 3157 | local 3158 | if (!id) 3159 | WinGet, id, ID, A 3160 | VarSetCapacity(rect, 16, 0) 3161 | , DllCall("GetWindowRect", "Ptr",id, "Ptr",&rect) 3162 | , x:=x1+NumGet(rect,"int"), y:=y1+NumGet(rect,4,"int") 3163 | } 3164 | 3165 | ScreenToWindow(ByRef x, ByRef y, x1, y1, id:="") 3166 | { 3167 | local 3168 | this.WindowToScreen(dx, dy, 0, 0, id), x:=x1-dx, y:=y1-dy 3169 | } 3170 | 3171 | ClientToScreen(ByRef x, ByRef y, x1, y1, id:="") 3172 | { 3173 | local 3174 | if (!id) 3175 | WinGet, id, ID, A 3176 | VarSetCapacity(pt, 8, 0), NumPut(0, pt, "int64") 3177 | , DllCall("ClientToScreen", "Ptr",id, "Ptr",&pt) 3178 | , x:=x1+NumGet(pt,"int"), y:=y1+NumGet(pt,4,"int") 3179 | } 3180 | 3181 | ScreenToClient(ByRef x, ByRef y, x1, y1, id:="") 3182 | { 3183 | local 3184 | this.ClientToScreen(dx, dy, 0, 0, id), x:=x1-dx, y:=y1-dy 3185 | } 3186 | 3187 | ; It is not like FindText always use Screen Coordinates, 3188 | ; But like built-in command PixelGetColor using CoordMode Settings 3189 | 3190 | PixelGetColor(x, y, ScreenShot:=1, id:="") 3191 | { 3192 | if (A_CoordModePixel="Window") 3193 | this.WindowToScreen(x, y, x, y, id) 3194 | else if (A_CoordModePixel="Client") 3195 | this.ClientToScreen(x, y, x, y, id) 3196 | if (ScreenShot) 3197 | this.ScreenShot(x, y, x, y) 3198 | return this.GetColor(x, y) 3199 | } 3200 | 3201 | ; It is not like FindText always use Screen Coordinates, 3202 | ; But like built-in command ImageSearch using CoordMode Settings 3203 | ; ImageFile can use "*n *TransBlack/White/RRGGBB-DRDGDB... d:\a.bmp" 3204 | 3205 | ImageSearch(ByRef rx:="", ByRef ry:="", x1:=0, y1:=0, x2:=0, y2:=0 3206 | , ImageFile:="", ScreenShot:=1, FindAll:=0, dir:=1) 3207 | { 3208 | local 3209 | dx:=dy:=0 3210 | if (A_CoordModePixel="Window") 3211 | this.WindowToScreen(dx, dy, 0, 0) 3212 | else if (A_CoordModePixel="Client") 3213 | this.ClientToScreen(dx, dy, 0, 0) 3214 | text:="" 3215 | Loop Parse, ImageFile, | 3216 | if (v:=Trim(A_LoopField))!="" 3217 | { 3218 | text.=InStr(v,"$") ? "|" v : "|##" 3219 | . (RegExMatch(v, "O)(^|\s)\*(\d+)\s", r) 3220 | ? Format("{:06X}", r[2]<<16|r[2]<<8|r[2]) : "000000") 3221 | . (RegExMatch(v, "Oi)(^|\s)\*Trans(\S+)\s", r) ? "/" Trim(r[2],"/"):"") 3222 | . "$" Trim(RegExReplace(v,"(^|\s)\*\S+")) 3223 | } 3224 | x1:=this.Floor(x1), y1:=this.Floor(y1), x2:=this.Floor(x2), y2:=this.Floor(y2) 3225 | if (x1=0 && y1=0 && x2=0 && y2=0) 3226 | n:=150000, x1:=y1:=-n, x2:=y2:=n 3227 | if (ok:=this.FindText(,, x1+dx, y1+dy, x2+dx, y2+dy 3228 | , 0, 0, text, ScreenShot, FindAll,,,, dir)) 3229 | { 3230 | For k,v in ok ; you can use ok:=FindText().ok 3231 | v.1-=dx, v.2-=dy, v.x-=dx, v.y-=dy 3232 | rx:=ok[1].1, ry:=ok[1].2, ErrorLevel:=0 3233 | return ok 3234 | } 3235 | else 3236 | { 3237 | rx:=ry:="", ErrorLevel:=1 3238 | return 0 3239 | } 3240 | } 3241 | 3242 | ; It is not like FindText always use Screen Coordinates, 3243 | ; But like built-in command PixelSearch using CoordMode Settings 3244 | ; ColorID can use "RRGGBB-DRDGDB|RRGGBB-DRDGDB", Variation in 0-255 3245 | 3246 | PixelSearch(ByRef rx:="", ByRef ry:="", x1:=0, y1:=0, x2:=0, y2:=0 3247 | , ColorID:="", Variation:=0, ScreenShot:=1, FindAll:=0, dir:=1) 3248 | { 3249 | local 3250 | n:=this.Floor(Variation), text:=Format("##{:06X}$0/0/", n<<16|n<<8|n) 3251 | . Trim(StrReplace(ColorID, "|", "/"), "- /") 3252 | return this.ImageSearch(rx, ry, x1, y1, x2, y2, text, ScreenShot, FindAll, dir) 3253 | } 3254 | 3255 | ; Pixel count of certain colors within the range indicated by Screen Coordinates 3256 | ; ColorID can use "RRGGBB-DRDGDB|RRGGBB-DRDGDB", Variation in 0-255 3257 | 3258 | PixelCount(x1:=0, y1:=0, x2:=0, y2:=0, ColorID:="", Variation:=0, ScreenShot:=1) 3259 | { 3260 | local 3261 | x1:=this.Floor(x1), y1:=this.Floor(y1), x2:=this.Floor(x2), y2:=this.Floor(y2) 3262 | if (x1=0 && y1=0 && x2=0 && y2=0) 3263 | n:=150000, x:=y:=-n, w:=h:=2*n 3264 | else 3265 | x:=Min(x1,x2), y:=Min(y1,y2), w:=Abs(x2-x1)+1, h:=Abs(y2-y1)+1 3266 | bits:=this.GetBitsFromScreen(x,y,w,h,ScreenShot,zx,zy), x-=zx, y-=zy 3267 | sum:=0, VarSetCapacity(s1,4), VarSetCapacity(s0,4), VarSetCapacity(ss,w*(h+3)) 3268 | ini:={ bits:bits, ss:&ss, s1:&s1, s0:&s0, allpos:0, allpos_max:0 3269 | , err1:0, err0:0, zoomW:1, zoomH:1 } 3270 | n:=this.Floor(Variation), text:=Format("##{:06X}$0/0/", n<<16|n<<8|n) 3271 | . Trim(StrReplace(ColorID, "|", "/"), "- /") 3272 | if IsObject(j:=this.PicInfo(text)) 3273 | sum:=this.PicFind(ini, j, 1, x, y, w, h) 3274 | return sum 3275 | } 3276 | 3277 | ; Create color blocks containing a specified number of specified colors 3278 | ; ColorID can use "RRGGBB-DRDGDB|RRGGBB-DRDGDB", "*128", "**50" 3279 | ; Count1, Count0 is the minimum number of black and white dots after binarization of this color block 3280 | 3281 | ColorBlock(ColorID, w, h, Count1:=0, Count0:=0) 3282 | { 3283 | local 3284 | (Count0>0 && Count1:=0) 3285 | Text:="|<>[" (1-Count1/(w*h)) "," (1-Count0/(w*h)) "]" 3286 | . Trim(StrReplace(ColorID,"|","/"),"- /") . Format("${:d}.",w) 3287 | . this.bit2base64(StrReplace(Format(Format("{{}:0{:d}d{}}",w*h),0),"0" 3288 | , (Count0>0 ? "0":"1"))) 3289 | return Text 3290 | } 3291 | 3292 | Click(x:="", y:="", other1:="", other2:="", GoBack:=0) 3293 | { 3294 | local 3295 | CoordMode, Mouse, % (bak:=A_CoordModeMouse)?"Screen":"Screen" 3296 | if GoBack 3297 | MouseGetPos, oldx, oldy 3298 | MouseMove, x, y, 0 3299 | Sleep 30 3300 | Click % x "," y "," other1 "," other2 3301 | if GoBack 3302 | MouseMove, oldx, oldy, 0 3303 | CoordMode, Mouse, %bak% 3304 | return 1 3305 | } 3306 | 3307 | ; Running AHK code dynamically with new threads 3308 | 3309 | Class Thread 3310 | { 3311 | __New(args*) 3312 | { 3313 | this.pid:=this.Exec(args*) 3314 | } 3315 | __Delete() 3316 | { 3317 | Process, Close, % this.pid 3318 | } 3319 | Exec(s, Ahk:="", args:="") ; required AHK v1.1.34+ and Ahk2Exe Use .exe 3320 | { 3321 | local 3322 | Ahk:=Ahk ? Ahk : A_IsCompiled ? A_ScriptFullPath : A_AhkPath 3323 | s:="`nDllCall(""SetWindowText"",""Ptr"",A_ScriptHwnd,""Str"","""")`n" 3324 | . "`nSetBatchLines,-1`n" . s, s:=RegExReplace(s, "\R", "`r`n") 3325 | Try 3326 | { 3327 | shell:=ComObjCreate("WScript.Shell") 3328 | oExec:=shell.Exec("""" Ahk """ /script /force /CP0 * " args) 3329 | oExec.StdIn.Write(s) 3330 | oExec.StdIn.Close(), pid:=oExec.ProcessID 3331 | } 3332 | Catch 3333 | { 3334 | f:=A_Temp "\~ahk.tmp" 3335 | s:="`r`nTry FileDelete " f "`r`n" s 3336 | Try FileDelete % f 3337 | FileAppend % s, % f 3338 | r:=this.Clear.Bind(this) 3339 | SetTimer % r, -3000 3340 | Run "%Ahk%" /script /force /CP0 "%f%" %args%,, UseErrorLevel, pid 3341 | } 3342 | return pid 3343 | } 3344 | Clear() 3345 | { 3346 | Try FileDelete % A_Temp "\~ahk.tmp" 3347 | SetTimer,, Off 3348 | } 3349 | } 3350 | 3351 | ; FindText().QPC() Use the same as A_TickCount 3352 | 3353 | QPC() 3354 | { 3355 | static init, f, c 3356 | if !VarSetCapacity(init) && (init:="1") 3357 | f:=0, c:=DllCall("QueryPerformanceFrequency", "Int64*",f)+(f/=1000) 3358 | return (!DllCall("QueryPerformanceCounter","Int64*",c))*0+(c/f) 3359 | } 3360 | 3361 | ; FindText().ToolTip() Use the same as ToolTip 3362 | 3363 | ToolTip(s:="", x:="", y:="", num:=1, arg:="") 3364 | { 3365 | local 3366 | static init, ini, tip, timer 3367 | if !VarSetCapacity(init) && (init:="1") 3368 | ini:=[], tip:=[], timer:=[] 3369 | f:="ToolTip_" . this.Floor(num) 3370 | if (s="") 3371 | { 3372 | Try tip[f].Destroy() 3373 | ini[f]:="", tip[f]:="" 3374 | return 3375 | } 3376 | ;----------------- 3377 | r1:=A_CoordModeToolTip 3378 | r2:=A_CoordModeMouse 3379 | CoordMode Mouse, Screen 3380 | MouseGetPos x1, y1 3381 | CoordMode Mouse, %r1% 3382 | MouseGetPos x2, y2 3383 | CoordMode Mouse, %r2% 3384 | (x!="" && x:="x" (this.Floor(x)+x1-x2)) 3385 | , (y!="" && y:="y" (this.Floor(y)+y1-y2)) 3386 | , (x="" && y="" && x:="x" (x1+16) " y" (y1+16)) 3387 | ;----------------- 3388 | bgcolor:=arg.bgcolor!="" ? arg.bgcolor : "FAFBFC" 3389 | color:=arg.color!="" ? arg.color : "Black" 3390 | font:=arg.font ? arg.font : "Consolas" 3391 | size:=arg.size ? arg.size : "10" 3392 | bold:=arg.bold ? arg.bold : "" 3393 | trans:=arg.trans!="" ? arg.trans & 255 : 255 3394 | timeout:=arg.timeout!="" ? arg.timeout : "" 3395 | ;----------------- 3396 | r:=bgcolor "|" color "|" font "|" size "|" bold "|" trans "|" s 3397 | if (!ini.HasKey(f) || ini[f]!=r) 3398 | { 3399 | ini[f]:=r 3400 | Try tip[f].Destroy() 3401 | tip[f]:=_Gui:=this.GuiNew() ; WS_EX_LAYERED:=0x80000, WS_EX_TRANSPARENT:=0x20 3402 | _Gui.Opt("+LastFound +AlwaysOnTop -Caption +ToolWindow -DPIScale +E0x80020") 3403 | _Gui.MarginX:=2, _Gui.MarginY:=2 3404 | _Gui.BackColor:=bgcolor 3405 | _Gui.SetFont("c" color " s" size " " bold, font) 3406 | _Gui.Add("Text",, s) 3407 | _Gui.Title:=f 3408 | _Gui.Show("Hide") 3409 | WinSet, Transparent, % trans 3410 | } 3411 | tip[f].Opt("+AlwaysOnTop") 3412 | tip[f].Show("NA " x " " y) 3413 | if (timeout) 3414 | { 3415 | (!timer.HasKey(f) && timer[f]:=this.ToolTip.Bind(this,"","","",num)) 3416 | , r:=timer[f] 3417 | SetTimer % r, % -Round(Abs(this.Floor(timeout)*1000))-1 3418 | } 3419 | } 3420 | 3421 | ; FindText().ObjView() view object values for Debug 3422 | 3423 | ObjView(obj, keyname:="") 3424 | { 3425 | local 3426 | if IsObject(obj) ; thanks lexikos's type(v) 3427 | { 3428 | s:="" 3429 | For k,v in obj 3430 | s.=this.ObjView(v, keyname "[" (StrLen(k)>1000 3431 | || [k].GetCapacity(1) ? """" k """":k) "]") 3432 | } 3433 | else 3434 | s:=keyname ": " (StrLen(obj)>1000 3435 | || [obj].GetCapacity(1) ? """" obj """":obj) "`n" 3436 | if (keyname!="") 3437 | return s 3438 | ;------------------ 3439 | _Gui:=this.GuiNew("+AlwaysOnTop") 3440 | _Gui.Add("Button", "y270 w350 gCancel Default", "OK") 3441 | _Gui.Add("Edit", "xp y10 w350 h250 -Wrap -WantReturn") 3442 | _Gui["Edit1"].Value:=s 3443 | _Gui.Title:="Debug view object values" 3444 | _Gui.Show() 3445 | DetectHiddenWindows 0 3446 | WinWaitClose % "ahk_id " _Gui.Hwnd 3447 | _Gui.Destroy() 3448 | } 3449 | 3450 | EditScroll(hEdit, regex:="", line:=0, pos:=0) 3451 | { 3452 | local 3453 | ControlGetText, s,, ahk_id %hEdit% 3454 | pos:=(regex!="") ? InStr(SubStr(s,1,s~=regex) " ","`n",0,-1) 3455 | : (line>1) ? InStr(s,"`n",0,1,line-1) : pos 3456 | SendMessage, 0xB1, pos, pos,, ahk_id %hEdit% 3457 | SendMessage, 0xB7,,,, ahk_id %hEdit% 3458 | } 3459 | 3460 | LastCtrl() 3461 | { 3462 | local 3463 | return (G:=this.GuiFromHwnd(WinExist()))[G.LastHwnd] 3464 | } 3465 | 3466 | Hide(args*) 3467 | { 3468 | WinMinimize 3469 | WinHide 3470 | ToolTip 3471 | DetectHiddenWindows 0 3472 | WinWaitClose % "ahk_id " WinExist() 3473 | } 3474 | 3475 | SC(RGB, hwnd) 3476 | { 3477 | SendMessage,0x2001,0,(RGB&0xFF)<<16|RGB&0xFF00|(RGB>>16)&0xFF,,% "ahk_id " hwnd 3478 | } 3479 | 3480 | 3481 | ;==== Optional GUI interface ==== 3482 | 3483 | 3484 | Gui(cmd, arg1:="", args*) 3485 | { 3486 | local 3487 | static 3488 | local bch, cri, lls, _Gui 3489 | ListLines % InStr("MouseMove|ToolTipOff",cmd)?0:A_ListLines 3490 | static init 3491 | if !VarSetCapacity(init) && (init:="1") 3492 | { 3493 | SavePicDir:=A_Temp "\Ahk_ScreenShot\" 3494 | G_ := this.Gui.Bind(this) 3495 | G_G := this.Gui.Bind(this, "G") 3496 | G_Run := this.Gui.Bind(this, "Run") 3497 | G_Show := this.Gui.Bind(this, "Show") 3498 | G_KeyDown := this.Gui.Bind(this, "KeyDown") 3499 | G_LButtonDown := this.Gui.Bind(this, "LButtonDown") 3500 | G_RButtonDown := this.Gui.Bind(this, "RButtonDown") 3501 | G_MouseMove := this.Gui.Bind(this, "MouseMove") 3502 | G_ScreenShot := this.Gui.Bind(this, "ScreenShot") 3503 | G_ShowPic := this.Gui.Bind(this, "ShowPic") 3504 | G_Slider := this.Gui.Bind(this, "Slider") 3505 | G_ToolTip := this.Gui.Bind(this, "ToolTip") 3506 | G_ToolTipOff := this.Gui.Bind(this, "ToolTipOff") 3507 | G_SaveScr := this.Gui.Bind(this, "SaveScr") 3508 | G_PicShowOK := this.Gui.Bind(this, "PicShowOK") 3509 | G_Drag := this.Gui.Bind(this, "Drag") 3510 | FindText_Capture:=FindText_Main:="" 3511 | PrevControl:=x:=y:=oldx:=oldy:="" 3512 | Pics:=[], hBM_old:=dx:=dy:=0 3513 | bch:=A_BatchLines, cri:=A_IsCritical 3514 | Critical 3515 | #NoEnv 3516 | Lang:=this.Lang(,1), Tip_Text:=this.Lang(,2) 3517 | G_.Call("MakeCaptureWindow") 3518 | G_.Call("MakeMainWindow") 3519 | OnMessage(0x100, G_KeyDown) 3520 | OnMessage(0x201, G_LButtonDown) 3521 | OnMessage(0x204, G_RButtonDown) 3522 | OnMessage(0x200, G_MouseMove) 3523 | Menu, Tray, Add 3524 | Menu, Tray, Add, % Lang["s1"], % G_Show 3525 | if (!A_IsCompiled && A_LineFile=A_ScriptFullPath) 3526 | { 3527 | Menu, Tray, Default, % Lang["s1"] 3528 | Menu, Tray, Click, 1 3529 | Menu, Tray, Icon, Shell32.dll, 23 3530 | } 3531 | Critical % cri 3532 | SetBatchLines % bch 3533 | this.GuiNew("+LastFound").Destroy() 3534 | } 3535 | Switch cmd 3536 | { 3537 | Case "G": 3538 | id:=this.LastCtrl() 3539 | Try id.OnEvent("Click", G_Run) 3540 | Catch 3541 | Try id.OnEvent("Change", G_Run) 3542 | return 3543 | Case "Run": 3544 | Critical 3545 | G_.Call(arg1.Name) 3546 | return 3547 | Case "Show": 3548 | FindText_Main.Show(arg1 ? "Center" : "") 3549 | ControlFocus,, % "ahk_id " hscr 3550 | return 3551 | Case "Cancel", "Cancel2": 3552 | WinHide 3553 | return 3554 | Case "MakeCaptureWindow": 3555 | WindowColor:="0xDDEEFF" 3556 | Try FindText_Capture.Destroy() 3557 | FindText_Capture:=_Gui:=this.GuiNew() 3558 | _Gui.Opt("+LastFound +AlwaysOnTop -DPIScale") 3559 | _Gui.MarginX:=15, _Gui.MarginY:=10 3560 | _Gui.BackColor:=WindowColor 3561 | _Gui.SetFont("s12", "Verdana") 3562 | Tab:=_Gui.Add("Tab3", "vMyTab1 -Wrap", StrSplit(Lang["s18"],"|")) 3563 | Tab.UseTab(1) 3564 | C_:=[], Cid_:=[] 3565 | , nW:=71, nH:=25, w:=h:=12, pW:=nW*(w+1)-1, pH:=(nH+1)*(h+1)-1 3566 | id:=_Gui.Add("Text", "w" pW " h" pH), Cid_[id.Hwnd]:=-1 3567 | _Gui.Opt("-Theme") 3568 | ListLines % (lls:=A_ListLines)?0:0 3569 | Loop % nW*(nH+1) 3570 | { 3571 | i:=A_Index, j:=i=1 ? "xp yp Section" : Mod(i,nW)=1 ? "xs y+1":"x+1" 3572 | id:=_Gui.Add("Progress", j " w" w " h" h " -E0x20000 Smooth") 3573 | C_[i]:=id.Hwnd, Cid_[id.Hwnd]:=i 3574 | } 3575 | ListLines % lls 3576 | _Gui.Opt("+Theme") 3577 | _Gui.Add("Slider", "xs w" pW " vMySlider1 +Center Page20 Line10 NoTicks AltSubmit") 3578 | G_G.Call() 3579 | _Gui.Add("Slider", "ys h" pH " vMySlider2 +Center Page20 Line10 NoTicks AltSubmit +Vertical") 3580 | G_G.Call() 3581 | Tab.UseTab(2) 3582 | id:=_Gui.Add("Pic", "w" (pW-135) " h" pH " +Border -Background Section"), hPic:=id.Hwnd 3583 | Pic_hBM:=this.CreateDIBSection(Pic_w:=(pW-135), Pic_h:=pH) 3584 | _Gui.Add("Slider", "xs wp vMySlider3 +Center Page20 Line10 NoTicks AltSubmit") 3585 | G_G.Call() 3586 | _Gui.Add("Slider", "ys h" pH " vMySlider4 +Center Page20 Line10 NoTicks AltSubmit +Vertical") 3587 | G_G.Call() 3588 | _Gui.Add("ListBox", "ys w120 h200 vSelectBox AltSubmit 0x100") 3589 | G_G.Call() 3590 | _Gui.Add("Button", "y+0 wp vClearAll", Lang["ClearAll"]) 3591 | G_G.Call() 3592 | _Gui.Add("Button", "y+0 wp vOpenDir", Lang["OpenDir"]) 3593 | G_G.Call() 3594 | _Gui.Add("Button", "y+0 wp vLoadPic", Lang["LoadPic"]) 3595 | G_G.Call() 3596 | _Gui.Add("Button", "y+0 wp vSavePic", Lang["SavePic"]) 3597 | G_G.Call() 3598 | Tab.UseTab() 3599 | ;-------------- 3600 | _Gui.Add("Text", "xm Section", Lang["SelGray"]) 3601 | _Gui.Add("Edit", "x+5 yp-3 w80 vSelGray ReadOnly") 3602 | _Gui.Add("Text", "x+15 ys", Lang["SelColor"]) 3603 | _Gui.Add("Edit", "x+5 yp-3 w150 vSelColor ReadOnly") 3604 | _Gui.Add("Text", "x+15 ys", Lang["SelR"]) 3605 | _Gui.Add("Edit", "x+5 yp-3 w80 vSelR ReadOnly") 3606 | _Gui.Add("Text", "x+5 ys", Lang["SelG"]) 3607 | _Gui.Add("Edit", "x+5 yp-3 w80 vSelG ReadOnly") 3608 | _Gui.Add("Text", "x+5 ys", Lang["SelB"]) 3609 | _Gui.Add("Edit", "x+5 yp-3 w80 vSelB ReadOnly") 3610 | ;-------------- 3611 | id:=_Gui.Add("Button", "xm Hidden Section", Lang["Auto"]) 3612 | id.GetPos(pX, pY, pW, pH) 3613 | w:=Round(pW*0.75), i:=Round(w*3+15+pW*0.5-w*1.5) 3614 | _Gui.Add("Button", "xm+" i " yp w" w " hp -Wrap vRepU", Lang["RepU"]) 3615 | G_G.Call() 3616 | _Gui.Add("Button", "x+0 wp hp -Wrap vCutU", Lang["CutU"]) 3617 | G_G.Call() 3618 | _Gui.Add("Button", "x+0 wp hp -Wrap vCutU3", Lang["CutU3"]) 3619 | G_G.Call() 3620 | _Gui.Add("Button", "xm wp hp -Wrap vRepL", Lang["RepL"]) 3621 | G_G.Call() 3622 | _Gui.Add("Button", "x+0 wp hp -Wrap vCutL", Lang["CutL"]) 3623 | G_G.Call() 3624 | _Gui.Add("Button", "x+0 wp hp -Wrap vCutL3", Lang["CutL3"]) 3625 | G_G.Call() 3626 | _Gui.Add("Button", "x+15 w" pW " hp -Wrap vAuto", Lang["Auto"]) 3627 | G_G.Call() 3628 | _Gui.Add("Button", "x+15 w" w " hp -Wrap vRepR", Lang["RepR"]) 3629 | G_G.Call() 3630 | _Gui.Add("Button", "x+0 wp hp -Wrap vCutR", Lang["CutR"]) 3631 | G_G.Call() 3632 | _Gui.Add("Button", "x+0 wp hp -Wrap vCutR3", Lang["CutR3"]) 3633 | G_G.Call() 3634 | _Gui.Add("Button", "xm+" i " wp hp -Wrap vRepD", Lang["RepD"]) 3635 | G_G.Call() 3636 | _Gui.Add("Button", "x+0 wp hp -Wrap vCutD", Lang["CutD"]) 3637 | G_G.Call() 3638 | _Gui.Add("Button", "x+0 wp hp -Wrap vCutD3", Lang["CutD3"]) 3639 | G_G.Call() 3640 | ;-------------- 3641 | Tab:=_Gui.Add("Tab3", "ys -Wrap", StrSplit(Lang["s2"],"|")) 3642 | Tab.UseTab(1) 3643 | _Gui.Add("Text", "x+30 y+35", Lang["Threshold"]) 3644 | _Gui.Add("Edit", "x+15 w100 vThreshold") 3645 | _Gui.Add("Button", "x+15 yp-3 vGray2Two", Lang["Gray2Two"]) 3646 | G_G.Call() 3647 | Tab.UseTab(2) 3648 | _Gui.Add("Text", "x+30 y+35", Lang["GrayDiff"]) 3649 | _Gui.Add("Edit", "x+15 w100 vGrayDiff", "50") 3650 | _Gui.Add("Button", "x+15 yp-3 vGrayDiff2Two", Lang["GrayDiff2Two"]) 3651 | G_G.Call() 3652 | Tab.UseTab(3) 3653 | _Gui.Add("Text", "x+10 y+15 Section", Lang["Similar1"] " 0") 3654 | _Gui.Add("Slider", "x+0 w100 vSimilar1 +Center Page1 NoTicks ToolTip") 3655 | G_G.Call() 3656 | _Gui.Add("Text", "x+0", "100") 3657 | _Gui.Add("Button", "x+10 ys-2 vAddColorSim", Lang["AddColorSim"]) 3658 | G_G.Call() 3659 | _Gui.Add("Text", "x+25 ys+4", Lang["DiffRGB2"]) 3660 | _Gui.Add("Edit", "x+5 ys w80 vDiffRGB2 Limit3") 3661 | _Gui.Add("UpDown", "vdRGB2 Range0-255 Wrap", 50) 3662 | _Gui.Add("Button", "x+10 ys-2 vAddColorDiff", Lang["AddColorDiff"]) 3663 | G_G.Call() 3664 | _Gui.Add("Button", "xs vUndo2", Lang["Undo2"]) 3665 | G_G.Call() 3666 | _Gui.Add("Edit", "x+10 yp+2 w340 vColorList") 3667 | _Gui.Add("Button", "x+10 yp-2 vColor2Two", Lang["Color2Two"]) 3668 | G_G.Call() 3669 | Tab.UseTab(4) 3670 | _Gui.Add("Text", "x+30 y+35", Lang["Similar2"] " 0") 3671 | _Gui.Add("Slider", "x+0 w120 vSimilar2 +Center Page1 NoTicks ToolTip") 3672 | G_G.Call() 3673 | _Gui.Add("Text", "x+0", "100") 3674 | _Gui.Add("Button", "x+15 yp-3 vColorPos2Two", Lang["ColorPos2Two"]) 3675 | G_G.Call() 3676 | Tab.UseTab(5) 3677 | _Gui.Add("Text", "x+30 y+15 Section", Lang["Similar3"] " 0") 3678 | _Gui.Add("Slider", "x+0 w120 vSimilar3 +Center Page1 NoTicks ToolTip") 3679 | G_G.Call() 3680 | _Gui.Add("Text", "x+0", "100") 3681 | _Gui.Add("Button", "x+15 ys-2 vUndo", Lang["Undo"]) 3682 | G_G.Call() 3683 | _Gui.Add("Checkbox", "xs vMultiColor", Lang["MultiColor"]) 3684 | G_G.Call() 3685 | _Gui.Add("Checkbox", "x+50 vFindShape", Lang["FindShape"]) 3686 | G_G.Call() 3687 | Tab.UseTab() 3688 | ;-------------- 3689 | _Gui.Add("Button", "xm vReset", Lang["Reset"]) 3690 | G_G.Call() 3691 | _Gui.Add("Checkbox", "x+15 yp+5 vModify", Lang["Modify"]) 3692 | G_G.Call() 3693 | _Gui.Add("Text", "x+30", Lang["Comment"]) 3694 | _Gui.Add("Edit", "x+5 yp-2 w250 vComment") 3695 | _Gui.Add("Button", "x+10 yp-3 vSplitAdd", Lang["SplitAdd"]) 3696 | G_G.Call() 3697 | _Gui.Add("Button", "x+10 vAllAdd", Lang["AllAdd"]) 3698 | G_G.Call() 3699 | _Gui.Add("Button", "x+30 wp vOK", Lang["OK"]) 3700 | G_G.Call() 3701 | _Gui.Add("Button", "x+15 wp vCancel", Lang["Cancel"]) 3702 | G_G.Call() 3703 | _Gui.Add("Button", "xm vBind0", Lang["Bind0"]) 3704 | G_G.Call() 3705 | _Gui.Add("Button", "x+10 vBind1", Lang["Bind1"]) 3706 | G_G.Call() 3707 | _Gui.Add("Button", "x+10 vBind2", Lang["Bind2"]) 3708 | G_G.Call() 3709 | _Gui.Add("Button", "x+10 vBind3", Lang["Bind3"]) 3710 | G_G.Call() 3711 | _Gui.Add("Button", "x+10 vBind4", Lang["Bind4"]) 3712 | G_G.Call() 3713 | _Gui.Add("Button", "x+30 vSavePic2", Lang["SavePic2"]) 3714 | G_G.Call() 3715 | _Gui.Title:=Lang["s3"] 3716 | _Gui.Show("Hide") 3717 | _Gui.OnEvent("DropFiles", G_Drag) 3718 | return 3719 | Case "Drag": 3720 | Try G_.Call("LoadPic", args[2][1]) 3721 | return 3722 | Case "MakeMainWindow": 3723 | Try FindText_Main.Destroy() 3724 | FindText_Main:=_Gui:=this.GuiNew() 3725 | _Gui.Opt("+LastFound +AlwaysOnTop -DPIScale") 3726 | _Gui.MarginX:=15, _Gui.MarginY:=10 3727 | _Gui.BackColor:=WindowColor 3728 | _Gui.SetFont("s12", "Verdana") 3729 | _Gui.Add("Text", "xm", Lang["NowHotkey"]) 3730 | _Gui.Add("Edit", "x+5 w160 vNowHotkey ReadOnly") 3731 | _Gui.Add("Hotkey", "x+5 w160 vSetHotkey1") 3732 | s:="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|LWin|Ctrl|Shift|Space|MButton" 3733 | . "|ScrollLock|CapsLock|Ins|Esc|BS|Del|Tab|Home|End|PgUp|PgDn" 3734 | . "|NumpadDot|NumpadSub|NumpadAdd|NumpadDiv|NumpadMult" 3735 | _Gui.Add("DDL", "x+5 w160 vSetHotkey2", StrSplit(s,"|")) 3736 | _Gui.Add("Button", "x+15 vApply", Lang["Apply"]) 3737 | G_G.Call() 3738 | _Gui.Add("GroupBox", "xm y+0 w280 h55 vMyGroup cBlack") 3739 | _Gui.Add("Text", "xp+15 yp+20 Section", Lang["Myww"] ": ") 3740 | _Gui.Add("Text", "x+0 w80", nW//2) 3741 | _Gui.Add("UpDown", "vMyww Range1-100", nW//2) 3742 | _Gui.Add("Text", "x+15 ys", Lang["Myhh"] ": ") 3743 | _Gui.Add("Text", "x+0 w80", nH//2) 3744 | id:=_Gui.Add("UpDown", "vMyhh Range1-100", nH//2) 3745 | id.GetPos(pX, pY, pW, pH) 3746 | _Gui["MyGroup"].Move(,, pX+pW, pH+30) 3747 | id:=_Gui.Add("Checkbox", "x+100 ys vAddFunc", Lang["AddFunc"] " FindText()") 3748 | id.GetPos(pX, pY, pW, pH) 3749 | pW:=pX+pW-15, pW:=(pW<720?720:pW), w:=pW//5 3750 | _Gui.Add("Button", "xm y+18 w" w " vCutL2", Lang["CutL2"]) 3751 | G_G.Call() 3752 | _Gui.Add("Button", "x+0 wp vCutR2", Lang["CutR2"]) 3753 | G_G.Call() 3754 | _Gui.Add("Button", "x+0 wp vCutU2", Lang["CutU2"]) 3755 | G_G.Call() 3756 | _Gui.Add("Button", "x+0 wp vCutD2", Lang["CutD2"]) 3757 | G_G.Call() 3758 | _Gui.Add("Button", "x+0 wp vUpdate", Lang["Update"]) 3759 | G_G.Call() 3760 | _Gui.SetFont("s6 bold", "Verdana") 3761 | _Gui.Add("Edit", "xm y+10 w" pW " h260 vMyPic -Wrap HScroll") 3762 | _Gui.SetFont("s12 norm", "Verdana") 3763 | w:=pW//3 3764 | _Gui.Add("Button", "xm w" w " vCapture", Lang["Capture"]) 3765 | G_G.Call() 3766 | _Gui.Add("Button", "x+0 wp vTest", Lang["Test"]) 3767 | G_G.Call() 3768 | _Gui.Add("Button", "x+0 wp vCopy", Lang["Copy"]) 3769 | G_G.Call() 3770 | _Gui.Add("Button", "xm y+0 wp vCaptureS", Lang["CaptureS"]) 3771 | G_G.Call() 3772 | _Gui.Add("Button", "x+0 wp vGetRange", Lang["GetRange"]) 3773 | G_G.Call() 3774 | _Gui.Add("Button", "x+0 wp vGetOffset", Lang["GetOffset"]) 3775 | G_G.Call() 3776 | _Gui.Add("Edit", "xm y+10 w130 hp vClipText") 3777 | _Gui.Add("Button", "x+0 vPaste", Lang["Paste"]) 3778 | G_G.Call() 3779 | _Gui.Add("Button", "x+0 vTestClip", Lang["TestClip"]) 3780 | G_G.Call() 3781 | id:=_Gui.Add("Button", "x+0 vGetClipOffset", Lang["GetClipOffset"]) 3782 | G_G.Call() 3783 | id.GetPos(x,, w) 3784 | w:=((pW+15)-(x+w))//2 3785 | _Gui.Add("Edit", "x+0 w" w " hp vOffset") 3786 | _Gui.Add("Button", "x+0 wp vCopyOffset", Lang["CopyOffset"]) 3787 | G_G.Call() 3788 | _Gui.SetFont("cBlue") 3789 | id:=_Gui.Add("Edit", "xm w" pW " h250 vscr -Wrap HScroll"), hscr:=id.Hwnd 3790 | _Gui.Title:=Lang["s4"] 3791 | _Gui.Show("Hide") 3792 | G_.Call("LoadScr") 3793 | OnExit(G_SaveScr) 3794 | return 3795 | Case "LoadScr": 3796 | f:=A_Temp "\~scr1.tmp" 3797 | FileRead, s, % f 3798 | FindText_Main["scr"].Value:=s 3799 | return 3800 | Case "SaveScr": 3801 | f:=A_Temp "\~scr1.tmp" 3802 | s:=FindText_Main["scr"].Value 3803 | Try FileDelete % f 3804 | FileAppend % s, % f 3805 | return 3806 | Case "Capture", "CaptureS": 3807 | _Gui:=FindText_Main 3808 | if show_gui:=WinExist("ahk_id " _Gui.Hwnd) 3809 | this.Hide() 3810 | if (cmd="Capture") 3811 | { 3812 | w:=_Gui["Myww"].Value 3813 | h:=_Gui["Myhh"].Value 3814 | p:=this.GetRange(w, h) 3815 | sx:=p[1], sy:=p[2], sw:=p[3]-p[1]+1, sh:=p[4]-p[2]+1 3816 | , Bind_ID:=p[5], bind_mode:="" 3817 | _Gui:=FindText_Capture 3818 | _Gui["MyTab1"].Choose(1) 3819 | } 3820 | else 3821 | { 3822 | sx:=0, sy:=0, sw:=1, sh:=1, Bind_ID:=WinExist("A"), bind_mode:="" 3823 | _Gui:=FindText_Capture 3824 | _Gui["MyTab1"].Choose(2) 3825 | } 3826 | n:=150000, x:=y:=-n, w:=h:=2*n 3827 | hBM:=this.BitmapFromScreen(x,y,w,h,(arg1=0?0:1)) 3828 | Pics:=[], Pics[hBM]:=1, hBM_x:=hBM_y:=0 3829 | G_.Call("CaptureUpdate") 3830 | G_.Call("PicUpdate") 3831 | Names:=["HBITMAP:*" hBM], s:="" 3832 | Loop Files, % SavePicDir "*.bmp" 3833 | Names.Push(v:=A_LoopFileFullPath), s.="|" RegExReplace(v,"i)^.*\\|\.bmp$") 3834 | _Gui["SelectBox"].Delete() 3835 | _Gui["SelectBox"].Add(StrSplit(Trim(s,"|"),"|")) 3836 | ;------------------------ 3837 | s:="SelGray|SelColor|SelR|SelG|SelB|Threshold|Comment|ColorList" 3838 | Loop Parse, s, | 3839 | _Gui[A_LoopField].Value:="" 3840 | For k,v in ["Similar1","Similar2","Similar3"] 3841 | _Gui[v].Value:=90 3842 | _Gui["Modify"].Value:=Modify:=0 3843 | _Gui["MultiColor"].Value:=MultiColor:=0 3844 | _Gui["FindShape"].Value:=FindShape:=0 3845 | _Gui["GrayDiff"].Value:=50 3846 | _Gui["Gray2Two"].Focus() 3847 | _Gui["Gray2Two"].Opt("+Default") 3848 | _Gui.Show("Center") 3849 | Event:=Result:="" 3850 | DetectHiddenWindows 0 3851 | Critical, Off 3852 | WinWaitClose % "ahk_id " _Gui.Hwnd 3853 | Critical 3854 | ToolTip 3855 | Pics[hBM]:=1, hBM_old:=0 3856 | For k,v in Pics 3857 | Try DllCall("DeleteObject", "Ptr",k) 3858 | Text:=RegExMatch(Result,"O)\|<[^>\n]*>[^$\n]+\$[^""\r\n]+",r)?r[0]:"" 3859 | ;------------------------ 3860 | _Gui:=FindText_Main 3861 | if (bind_mode!="") 3862 | { 3863 | WinGetTitle, tt, ahk_id %Bind_ID% 3864 | WinGetClass, tc, ahk_id %Bind_ID% 3865 | tt:=Trim(SubStr(tt,1,30) (tc ? " ahk_class " tc:"")) 3866 | tt:=StrReplace(RegExReplace(tt,"[;``]","``$0"),"""","""""") 3867 | Result:="`nSetTitleMatchMode 2`nid:=WinExist(""" tt """)" 3868 | . "`nFindText().BindWindow(id" (bind_mode=0 ? "":"," bind_mode) 3869 | . ") `; " Lang["s6"] " FindText().BindWindow(0)`n`n" Result 3870 | } 3871 | if (Event="OK") 3872 | { 3873 | s:="" 3874 | if (!A_IsCompiled) 3875 | Try FileRead, s, %A_LineFile% 3876 | re:="Oi)\n\s*FindText[^\n]+args\*[\s\S]*?Script_End[(){}\s]+}" 3877 | s:=RegExMatch(s, re, r) ? "`n;==========`n" r[0] "`n" : "" 3878 | _Gui["scr"].Value:=Result "`n" s 3879 | _Gui["MyPic"].Value:=Trim(this.ASCII(Result),"`n") 3880 | } 3881 | else if (Event="SplitAdd" || Event="AllAdd") 3882 | { 3883 | s:=_Gui["scr"].Value 3884 | r:=SubStr(s, 1, InStr(s,"=FindText(")) 3885 | i:=j:=0, re:="<[^>\n]*>[^$\n]+\$[^""\r\n]+" 3886 | While j:=RegExMatch(r, re,, j+1) 3887 | i:=InStr(r, "`n", 0, j) 3888 | _Gui["scr"].Value:=SubStr(s,1,i) . Result . SubStr(s,i+1) 3889 | _Gui["MyPic"].Value:=Trim(this.ASCII(Result),"`n") 3890 | } 3891 | if (Event) && RegExMatch(Result, "O)\$\d+\.[\w+/]{1,100}", r) 3892 | this.EditScroll(hscr, "\Q" r[0] "\E") 3893 | Event:=Result:=s:="" 3894 | ;---------------------- 3895 | if (show_gui && arg1="") 3896 | G_Show.Call() 3897 | else Clipboard:=Text 3898 | return Text 3899 | Case "CaptureUpdate": 3900 | nX:=sx, nY:=sy, nW:=sw, nH:=sh 3901 | bits:=this.GetBitsFromScreen(nX,nY,nW,nH,0,zx,zy) 3902 | cors:=[], show:=[], ascii:=[] 3903 | , SelPos:=bg:=color:=Result:="" 3904 | , dx:=dy:=CutLeft:=CutRight:=CutUp:=CutDown:=0 3905 | ListLines % (lls:=A_ListLines)?0:0 3906 | if (nW>0 && nH>0 && bits.Scan0) 3907 | { 3908 | j:=bits.Stride-nW*4, p:=bits.Scan0+(nY-zy)*bits.Stride+(nX-zx)*4-j-4 3909 | Loop % nH + 0*(k:=0) 3910 | Loop % nW + 0*(p+=j) 3911 | show[++k]:=1, cors[k]:=NumGet(0|p+=4,"uint") 3912 | } 3913 | Loop % 25 + 0*(ty:=dy-1)*(k:=0) 3914 | Loop % 71 + 0*(tx:=dx-1)*(ty++) 3915 | this.SC(((++tx)71 3921 | _Gui["MySlider2"].Enabled:=nH>25 3922 | _Gui["MySlider1"].Value:=0 3923 | _Gui["MySlider2"].Value:=0 3924 | return 3925 | Case "PicUpdate": 3926 | Try i:=0, i:=Pics.HasKey(hBM_old) 3927 | Try (!i) && DllCall("DeleteObject", "Ptr",hBM_old) 3928 | this.GetBitmapWH(hBM, hBM_w, hBM_h), hBM_old:=hBM 3929 | G_.Call("PicShow", 1) 3930 | return 3931 | Case "MySlider3", "MySlider4": 3932 | hBM_x:=Round(FindText_Capture["MySlider3"].Value*(hBM_w-Pic_w)/100) 3933 | hBM_y:=Round(FindText_Capture["MySlider4"].Value*(hBM_h-Pic_h)/100) 3934 | G_.Call("PicShow") 3935 | return 3936 | Case "PicShow": 3937 | w:=hBM_w-Pic_w, h:=hBM_h-Pic_h 3938 | , hBM_x:=Max(Min(hBM_x,w),0), hBM_y:=Max(Min(hBM_y,h),0) 3939 | if (w<0 || h<0) 3940 | this.DrawHBM(Pic_hBM, [[0, 0, Pic_w, Pic_h, WindowColor]]) 3941 | this.CopyHBM(Pic_hBM,0,0,hBM,hBM_x,hBM_y,Min(Pic_w,hBM_w),Min(Pic_h,hBM_h)) 3942 | if (arg1) 3943 | G_PicShowOK.Call() 3944 | else 3945 | { 3946 | this.BitmapToWindow(hPic,0,0,Pic_hBM,0,0,Pic_w,Pic_h) 3947 | SetTimer % G_PicShowOK, -1000 3948 | } 3949 | FindText_Capture["MySlider3"].Value:=w>0?Round(hBM_x/w*100):0 3950 | FindText_Capture["MySlider4"].Value:=h>0?Round(hBM_y/h*100):0 3951 | return 3952 | Case "PicShowOK": 3953 | FindText_Capture[hPic].Value:="*w0 *h0 HBITMAP:*" Pic_hBM 3954 | return 3955 | Case "Reset": 3956 | G_.Call("CaptureUpdate") 3957 | return 3958 | Case "LoadPic": 3959 | FindText_Capture.Opt("+OwnDialogs") 3960 | f:=arg1 3961 | if (f="") 3962 | { 3963 | if !FileExist(SavePicDir) 3964 | FileCreateDir % SavePicDir 3965 | f:=SavePicDir "*.bmp" 3966 | Loop Files, % f 3967 | f:=A_LoopFileFullPath 3968 | FileSelectFile, f,, %f%, Select Picture 3969 | } 3970 | if !InStr(f,"HBITMAP:") && !FileExist(f) 3971 | { 3972 | MsgBox, 4096, Tip, % Lang["s17"] 3973 | return 3974 | } 3975 | if !this.ShowPic(f, 0, sx, sy, sw, sh) 3976 | return 3977 | hBM:=this.BitmapFromScreen(sx, sy, sw, sh, 0) 3978 | sw:=Min(sw,71), sh:=Min(sh,25) 3979 | G_.Call("CaptureUpdate") 3980 | G_.Call("PicUpdate") 3981 | return 3982 | Case "SavePic": 3983 | FindText_Capture.Hide() 3984 | this.ScreenShot(), this.ShowPic("HBITMAP:*" hBM) 3985 | Try this.GuiFromHwnd(WinExist("Show Pic")).Opt("+OwnDialogs") 3986 | Loop 3987 | { 3988 | p:=this.GetRange2() 3989 | MsgBox, 4099, Tip, % Lang["s15"] 3990 | IfMsgBox, No 3991 | Continue 3992 | Break 3993 | } 3994 | IfMsgBox, Yes 3995 | G_.Call("ScreenShot", p[1] "|" p[2] "|" p[3] "|" p[4] "|0") 3996 | this.ShowPic() 3997 | return 3998 | Case "SelectBox": 3999 | SelectBox:=FindText_Capture["SelectBox"].Value 4000 | Try f:="", f:=Names[SelectBox] 4001 | if (f!="") 4002 | G_.Call("LoadPic", f) 4003 | return 4004 | Case "ClearAll": 4005 | FindText_Capture.Opt("+OwnDialogs") 4006 | MsgBox, 4100, Tip, % Lang["s19"] 4007 | IfMsgBox, Yes 4008 | { 4009 | FindText_Capture.Hide() 4010 | FileDelete % SavePicDir "*.bmp" 4011 | } 4012 | return 4013 | Case "OpenDir": 4014 | if !FileExist(SavePicDir) 4015 | FileCreateDir % SavePicDir 4016 | Run % SavePicDir 4017 | return 4018 | Case "GetRange": 4019 | _Gui:=FindText_Main 4020 | _Gui.Opt("+LastFound") 4021 | this.Hide() 4022 | p:=this.GetRange2(), v:=p[1] ", " p[2] ", " p[3] ", " p[4] 4023 | s:=_Gui["scr"].Value 4024 | re:="i)(=FindText\([^\n]*?)([^(,\n]*,){4}([^,\n]*,[^,\n]*,[^,\n]*Text)" 4025 | if SubStr(s,1,s~="i)\n\s*FindText[^\n]+args\*")~=re 4026 | { 4027 | s:=RegExReplace(s, re, "$1 " v ",$3",, 1) 4028 | _Gui["scr"].Value:=s 4029 | } 4030 | _Gui["Offset"].Value:=v 4031 | G_Show.Call() 4032 | return 4033 | Case "Test", "TestClip": 4034 | _Gui:=FindText_Main 4035 | _Gui.Opt("+LastFound") 4036 | this.Hide() 4037 | ;---------------------- 4038 | if (cmd="Test") 4039 | s:=_Gui["scr"].Value 4040 | else 4041 | s:=_Gui["ClipText"].Value 4042 | if (cmd="Test") && InStr(s, "MCode(") 4043 | { 4044 | s:="`n#NoEnv`nMenu, Tray, Click, 1`n" s "`nExitApp`n" 4045 | Thread1:=new this.Thread(s) 4046 | DetectHiddenWindows, 1 4047 | WinWait % "ahk_class AutoHotkey ahk_pid " Thread1.pid,, 3 4048 | if (!ErrorLevel) 4049 | WinWaitClose,,, 30 4050 | ; Thread1:="" ; kill the Thread 4051 | } 4052 | else 4053 | { 4054 | t:=A_TickCount, v:=X:=Y:="" 4055 | if RegExMatch(s, "O)<[^>\n]*>[^$\n]+\$[^""\r\n]+", r) 4056 | v:=this.FindText(X, Y, 0,0,0,0, 0,0, r[0]) 4057 | r:=StrSplit(Lang["s8"] "||||", "|") 4058 | MsgBox, 4096, Tip, % r[1] ":`t" (IsObject(v)?v.Length():v) "`n`n" 4059 | . r[2] ":`t" (A_TickCount-t) " " r[3] "`n`n" 4060 | . r[4] ":`t" X ", " Y "`n`n" 4061 | . r[5] ":`t<" (IsObject(v)?v[1].id:"") ">", 3 4062 | Try For i,j in v 4063 | if (i<=2) 4064 | this.MouseTip(j.x, j.y) 4065 | v:="", Clipboard:=X "," Y 4066 | } 4067 | ;---------------------- 4068 | G_Show.Call() 4069 | return 4070 | Case "GetOffset", "GetClipOffset": 4071 | FindText_Main.Hide() 4072 | p:=this.GetRange() 4073 | _Gui:=FindText_Main 4074 | if (cmd="GetOffset") 4075 | s:=_Gui["scr"].Value 4076 | else 4077 | s:=_Gui["ClipText"].Value 4078 | if RegExMatch(s, "O)<[^>\n]*>[^$\n]+\$[^""\r\n]+", r) 4079 | && this.FindText(X, Y, 0,0,0,0, 0,0, r[0]) 4080 | { 4081 | r:=StrReplace("X+" ((p[1]+p[3])//2-X) 4082 | . ", Y+" ((p[2]+p[4])//2-Y), "+-", "-") 4083 | if (cmd="GetOffset") 4084 | { 4085 | re:="i)(\(\)\.\w*Click\w*\()[^,\n]*,[^,)\n]*" 4086 | if SubStr(s,1,s~="i)\n\s*FindText[^\n]+args\*")~=re 4087 | s:=RegExReplace(s, re, "$1" r,, 1) 4088 | _Gui["scr"].Value:=s 4089 | } 4090 | _Gui["Offset"].Value:=r 4091 | } 4092 | s:="", G_Show.Call() 4093 | return 4094 | Case "Paste": 4095 | if RegExMatch(Clipboard, "O)\|?<[^>\n]*>[^$\n]+\$[^""\r\n]+", r) 4096 | { 4097 | FindText_Main["ClipText"].Value:=r[0] 4098 | FindText_Main["MyPic"].Value:=Trim(this.ASCII(r[0]),"`n") 4099 | } 4100 | return 4101 | Case "CopyOffset": 4102 | Clipboard:=FindText_Main["Offset"].Value 4103 | return 4104 | Case "Copy": 4105 | ControlGet, s, Selected,,, ahk_id %hscr% 4106 | if (s="") 4107 | { 4108 | s:=FindText_Main["scr"].Value 4109 | r:=FindText_Main["AddFunc"].Value 4110 | if (r != 1) 4111 | s:=RegExReplace(s, "i)\n\s*FindText[^\n]+args\*[\s\S]*") 4112 | , s:=RegExReplace(s, "i)\n; ok:=FindText[\s\S]*") 4113 | , s:=SubStr(s, (s~="i)\n[ \t]*Text")) 4114 | } 4115 | Clipboard:=RegExReplace(s, "\R", "`r`n") 4116 | ControlFocus,, % "ahk_id " hscr 4117 | return 4118 | Case "Apply": 4119 | _Gui:=FindText_Main 4120 | NowHotkey:=_Gui["NowHotkey"].Value 4121 | SetHotkey1:=_Gui["SetHotkey1"].Value 4122 | SetHotkey2:=_Gui["SetHotkey2"].Text 4123 | if (NowHotkey!="") 4124 | Hotkey, *%NowHotkey%,, Off UseErrorLevel 4125 | k:=SetHotkey1!="" ? SetHotkey1 : SetHotkey2 4126 | if (k!="") 4127 | Hotkey, *%k%, %G_ScreenShot%, On UseErrorLevel 4128 | _Gui["NowHotkey"].Value:=k 4129 | _Gui["SetHotkey1"].Value:="" 4130 | _Gui["SetHotkey2"].Choose(0) 4131 | return 4132 | Case "ScreenShot": 4133 | Critical 4134 | if !FileExist(SavePicDir) 4135 | FileCreateDir % SavePicDir 4136 | Loop 4137 | f:=SavePicDir . Format("{:03d}.bmp",A_Index) 4138 | Until !FileExist(f) 4139 | this.SavePic(f, StrSplit(arg1,"|")*) 4140 | CoordMode, ToolTip 4141 | this.ToolTip(Lang["s9"],, 0,, { bgcolor:"Yellow", color:"Red" 4142 | , size:48, bold:"bold", trans:200, timeout:0.2 }) 4143 | return 4144 | Case "Bind0", "Bind1", "Bind2", "Bind3", "Bind4": 4145 | this.BindWindow(Bind_ID, bind_mode:=SubStr(cmd,5)) 4146 | n:=150000, x:=y:=-n, w:=h:=2*n 4147 | hBM:=this.BitmapFromScreen(x,y,w,h,1) 4148 | G_.Call("PicUpdate") 4149 | FindText_Capture["MyTab1"].Choose(2) 4150 | this.BindWindow(0) 4151 | return 4152 | Case "MySlider1", "MySlider2": 4153 | SetTimer % G_Slider, -10 4154 | return 4155 | Case "Slider": 4156 | Critical 4157 | dx:=nW>71 ? Round(FindText_Capture["MySlider1"].Value*(nW-71)/100):0 4158 | dy:=nH>25 ? Round(FindText_Capture["MySlider2"].Value*(nH-25)/100):0 4159 | if (oldx=dx && oldy=dy) 4160 | return 4161 | ListLines % (lls:=A_ListLines)?0:0 4162 | Loop % 25 + 0*(ty:=dy-1)*(k:=0) 4163 | Loop % 71 + 0*(tx:=dx-1)*(ty++) 4164 | this.SC(((++tx)>=nW || ty>=nH || !show[i:=ty*nW+tx+1] 4165 | ? WindowColor : bg="" ? cors[i] : ascii[i] ? 0:0xFFFFFF), C_[++k]) 4166 | Loop % 71*(oldx!=dx) + 0*(i:=nW*nH+dx)*(k:=71*25) 4167 | this.SC((show[++i]?0xFF0000:0xFFFFAA), C_[++k]) 4168 | ListLines % lls 4169 | oldx:=dx, oldy:=dy 4170 | return 4171 | Case "RepColor", "CutColor": 4172 | if (cmd="RepColor") 4173 | show[k]:=1, c:=(bg="" ? cors[k] : ascii[k] ? 0:0xFFFFFF) 4174 | else 4175 | show[k]:=0, c:=WindowColor 4176 | if (tx:=Mod(k-1,nW)-dx)>=0 && tx<71 && (ty:=(k-1)//nW-dy)>=0 && ty<25 4177 | this.SC(c, C_[ty*71+tx+1]) 4178 | return 4179 | Case "RepL": 4180 | if (CutLeft<=0) || (bg!="" && InStr(color,"**") && CutLeft=1) 4181 | return 4182 | k:=CutLeft-nW, CutLeft-- 4183 | Loop % nH 4184 | k+=nW, (A_Index>CutUp && A_Index=nW) 4188 | return 4189 | CutLeft++, k:=CutLeft-nW 4190 | Loop % nH 4191 | k+=nW, (A_Index>CutUp && A_IndexCutUp && A_Index=nW) 4206 | return 4207 | CutRight++, k:=1-CutRight 4208 | Loop % nH 4209 | k+=nW, (A_Index>CutUp && A_IndexCutLeft && A_Index=nH) 4224 | return 4225 | CutUp++, k:=(CutUp-1)*nW 4226 | Loop % nW 4227 | k++, (A_Index>CutLeft && A_IndexCutLeft && A_Index=nH) 4242 | return 4243 | CutDown++, k:=(nH-CutDown)*nW 4244 | Loop % nW 4245 | k++, (A_Index>CutLeft && A_Index>16)&0xFF)*38+((c>>8)&0xFF)*75+(c&0xFF)*15)>>7 4256 | _Gui:=FindText_Capture 4257 | _Gui["Threshold"].Focus() 4258 | Threshold:=_Gui["Threshold"].Value 4259 | if (Threshold="") 4260 | { 4261 | pp:=[] 4262 | Loop 256 4263 | pp[A_Index-1]:=0 4264 | Loop % nW*nH 4265 | if (show[A_Index]) 4266 | pp[gs[A_Index]]++ 4267 | IP0:=IS0:=0 4268 | Loop 256 4269 | k:=A_Index-1, IP0+=k*pp[k], IS0+=pp[k] 4270 | Threshold:=Floor(IP0/IS0) 4271 | Loop 20 4272 | { 4273 | LastThreshold:=Threshold 4274 | IP1:=IS1:=0 4275 | Loop % LastThreshold+1 4276 | k:=A_Index-1, IP1+=k*pp[k], IS1+=pp[k] 4277 | IP2:=IP0-IP1, IS2:=IS0-IS1 4278 | if (IS1!=0 && IS2!=0) 4279 | Threshold:=Floor((IP1/IS1+IP2/IS2)/2) 4280 | if (Threshold=LastThreshold) 4281 | Break 4282 | } 4283 | _Gui["Threshold"].Value:=Threshold 4284 | } 4285 | Threshold:=Round(Threshold) 4286 | color:="*" Threshold, k:=i:=0 4287 | Loop % nW*nH 4288 | ascii[++k]:=v:=(gs[k]<=Threshold) 4289 | , (show[k] && i:=(v?i+1:i-1)) 4290 | bg:=(i>0 ? "1":"0"), G_.Call("BlackWhite") 4291 | ListLines % lls 4292 | return 4293 | Case "GrayDiff2Two": 4294 | _Gui:=FindText_Capture 4295 | GrayDiff:=_Gui["GrayDiff"].Value 4296 | if (GrayDiff="") 4297 | { 4298 | _Gui.Opt("+OwnDialogs") 4299 | MsgBox, 4096, Tip, % Lang["s11"], 1 4300 | return 4301 | } 4302 | ListLines % (lls:=A_ListLines)?0:0 4303 | gs:=[], k:=0 4304 | Loop % nW*nH 4305 | gs[++k]:=((((c:=cors[k])>>16)&0xFF)*38+((c>>8)&0xFF)*75+(c&0xFF)*15)>>7 4306 | if (CutLeft=0) 4307 | G_.Call("CutL") 4308 | if (CutRight=0) 4309 | G_.Call("CutR") 4310 | if (CutUp=0) 4311 | G_.Call("CutU") 4312 | if (CutDown=0) 4313 | G_.Call("CutD") 4314 | GrayDiff:=Round(GrayDiff) 4315 | color:="**" GrayDiff, k:=i:=0 4316 | Loop % nW*nH 4317 | j:=gs[++k]+GrayDiff 4318 | , ascii[k]:=v:=( gs[k-1]>j || gs[k+1]>j 4319 | || gs[k-nW]>j || gs[k+nW]>j 4320 | || gs[k-nW-1]>j || gs[k-nW+1]>j 4321 | || gs[k+nW-1]>j || gs[k+nW+1]>j ) 4322 | , (show[k] && i:=(v?i+1:i-1)) 4323 | bg:=(i>0 ? "1":"0"), G_.Call("BlackWhite") 4324 | ListLines % lls 4325 | return 4326 | Case "AddColorSim", "AddColorDiff": 4327 | _Gui:=FindText_Capture 4328 | c:=StrReplace(_Gui["SelColor"].Value, "0x") 4329 | if (c="") 4330 | { 4331 | _Gui.Opt("+OwnDialogs") 4332 | MsgBox, 4096, Tip, % Lang["s12"], 1 4333 | return 4334 | } 4335 | s:=_Gui["ColorList"].Value 4336 | if InStr(cmd, "Sim") 4337 | v:=_Gui["Similar1"].Value, v:=c "-" Round(v/100,2) 4338 | else 4339 | v:=_Gui["dRGB2"].Value, v:=c "-" Format("{:06X}",v<<16|v<<8|v) 4340 | s:=RegExReplace("/" s, "/" c "-[^/]*") . "/" v 4341 | _Gui["ColorList"].Value:=Trim(s,"/") 4342 | ControlSend,, {End}, % "ahk_id " _Gui["ColorList"].Hwnd 4343 | G_.Call("Color2Two") 4344 | return 4345 | Case "Undo2": 4346 | _Gui:=FindText_Capture 4347 | s:=_Gui["ColorList"].Value 4348 | s:=RegExReplace("/" s, "/[^/]+$") 4349 | _Gui["ColorList"].Value:=Trim(s,"/") 4350 | ControlSend,, {End}, % "ahk_id " _Gui["ColorList"].Hwnd 4351 | return 4352 | Case "Color2Two": 4353 | _Gui:=FindText_Capture 4354 | color:=RegExReplace(_Gui["ColorList"].Value, "i)\s|0x") 4355 | if (color="") 4356 | { 4357 | _Gui.Opt("+OwnDialogs") 4358 | MsgBox, 4096, Tip, % Lang["s16"], 1 4359 | return 4360 | } 4361 | ListLines % (lls:=A_ListLines)?0:0 4362 | k:=i:=v:=0, arr:=StrSplit(Trim(StrReplace(color,"@","-"), "/"), "/") 4363 | Loop % nW*nH 4364 | { 4365 | c:=cors[++k], rr:=(c>>16)&0xFF, gg:=(c>>8)&0xFF, bb:=c&0xFF 4366 | For k1,v1 in arr 4367 | { 4368 | r:=StrSplit(Trim(v1,"-") "-", "-"), c:=this.ToRGB(r[1]), n:=r[2] 4369 | , r:=((c>>16)&0xFF)-rr, g:=((c>>8)&0xFF)-gg, b:=(c&0xFF)-bb 4370 | if InStr(n, ".") 4371 | { 4372 | n:=this.Floor(n), n:=(n<=0||n>1?0:Floor(9*255*255*(1-n)*(1-n))) 4373 | if v:=(3*r*r+4*g*g+2*b*b<=n) 4374 | Break 4375 | } 4376 | else 4377 | { 4378 | c:=this.Floor("0x" n), dR:=(c>>16)&0xFF, dG:=(c>>8)&0xFF, dB:=c&0xFF 4379 | if v:=(Abs(r)<=dR && Abs(g)<=dG && Abs(b)<=dB) 4380 | Break 4381 | } 4382 | } 4383 | ascii[k]:=v, (show[k] && i:=(v?i+1:i-1)) 4384 | } 4385 | bg:=(i>0 ? "1":"0"), G_.Call("BlackWhite") 4386 | ListLines % lls 4387 | return 4388 | Case "ColorPos2Two": 4389 | _Gui:=FindText_Capture 4390 | c:=_Gui["SelColor"].Value 4391 | if (c="") 4392 | { 4393 | _Gui.Opt("+OwnDialogs") 4394 | MsgBox, 4096, Tip, % Lang["s12"], 1 4395 | return 4396 | } 4397 | n:=_Gui["Similar2"].Value, n:=Round(n/100,2), color:="#" c "-" n 4398 | , n:=(n<=0||n>1?0:Floor(9*255*255*(1-n)*(1-n))) 4399 | , rr:=(c>>16)&0xFF, gg:=(c>>8)&0xFF, bb:=c&0xFF, k:=i:=0 4400 | ListLines % (lls:=A_ListLines)?0:0 4401 | Loop % nW*nH 4402 | c:=cors[++k], r:=((c>>16)&0xFF)-rr, g:=((c>>8)&0xFF)-gg, b:=(c&0xFF)-bb 4403 | , ascii[k]:=v:=3*r*r+4*g*g+2*b*b<=n, (show[k] && i:=(v?i+1:i-1)) 4404 | bg:=(i>0 ? "1":"0"), G_.Call("BlackWhite") 4405 | ListLines % lls 4406 | return 4407 | Case "BlackWhite": 4408 | Loop % 25 + 0*(ty:=dy-1)*(k:=0) 4409 | Loop % 71 + 0*(tx:=dx-1)*(ty++) 4410 | if (k++)*0 + (++tx) StrLen(StrReplace(txt,"1")) ? "1":"0" 4513 | s:="", i:=0, k:=nW*nH+1+CutLeft 4514 | Loop % w:=nW-CutLeft-CutRight 4515 | { 4516 | i++ 4517 | if (!show[k++] && A_Index" color "$" v """`n" 4538 | Comment:=SubStr(Comment, 2) 4539 | } 4540 | } 4541 | Event:=cmd, Result:=s 4542 | _Gui.Hide() 4543 | return 4544 | } 4545 | if (!MultiColor) 4546 | txt:=Format("{:d}.",InStr(txt,"`n")-1) . this.bit2base64(txt) 4547 | else 4548 | { 4549 | n:=_Gui["Similar3"].Value, n:=Round(n/100,2), color:="##" n 4550 | , n:=(n<=0||n>1?0:Floor(9*255*255*(1-n)*(1-n))) 4551 | , arr:=StrSplit(Trim(StrReplace(Result,",","/"),"/"),"/"), s:="", i:=1 4552 | SetFormat, IntegerFast, d 4553 | Loop % arr.Length()//3 4554 | x1:=arr[i++], y1:=arr[i++], c1:=arr[i++], c:="0x" c1 4555 | , (A_Index=1 && (x:=x1, y:=y1, rr:=(c>>16)&0xFF, gg:=(c>>8)&0xFF, bb:=c&0xFF)) 4556 | , r:=((c>>16)&0xFF)-rr, g:=((c>>8)&0xFF)-gg, b:=(c&0xFF)-bb 4557 | , s.="," (x1-x) "/" (y1-y) "/" (FindShape?3*r*r+4*g*g+2*b*b<=n:c1) 4558 | txt:=SubStr(s,2) 4559 | } 4560 | s:="`nText.=""|<" Comment ">" color "$" txt """`n" 4561 | if (cmd="SplitAdd" || cmd="AllAdd") 4562 | { 4563 | Event:=cmd, Result:=s 4564 | _Gui.Hide() 4565 | return 4566 | } 4567 | x:=nX+CutLeft+(nW-CutLeft-CutRight)//2 4568 | y:=nY+CutUp+(nH-CutUp-CutDown)//2 4569 | s:=StrReplace(s, "Text.=", "Text:="), r:=StrSplit(Lang["s8"] "|||||||", "|") 4570 | s:="`; #Include `n" 4571 | . "`nt1:=A_TickCount, Text:=X:=Y:=""""`n" s 4572 | . "`nif (ok:=FindText(X, Y, " x "-150000, " 4573 | . y "-150000, " x "+150000, " y "+150000, 0, 0, Text))" 4574 | . "`n{" 4575 | . "`n `; FindText()." . "Click(" . "X, Y, ""L"")" 4576 | . "`n}`n" 4577 | . "`n`; ok:=FindText(X:=""wait"", Y:=3, 0,0,0,0,0,0,Text) `; " r[7] 4578 | . "`n`; ok:=FindText(X:=""wait0"", Y:=-1, 0,0,0,0,0,0,Text) `; " r[8] 4579 | . "`n`nMsgBox, 4096, Tip, `% """ r[1] ":``t"" (IsObject(ok)?ok.Length():ok)" 4580 | . "`n . ""``n``n" r[2] ":``t"" (A_TickCount-t1) "" " r[3] """" 4581 | . "`n . ""``n``n" r[4] ":``t"" X "", "" Y" 4582 | . "`n . ""``n``n" r[5] ":``t<"" (IsObject(ok)?ok[1].id:"""") "">""`n" 4583 | . "`nTry For i,v in ok `; ok " r[6] " ok:=FindText().ok" 4584 | . "`n if (i<=2)" 4585 | . "`n FindText().MouseTip(ok[i].x, ok[i].y)`n" 4586 | Event:=cmd, Result:=s 4587 | _Gui.Hide() 4588 | return 4589 | Case "SavePic2": 4590 | x:=nX+CutLeft, w:=nW-CutLeft-CutRight 4591 | y:=nY+CutUp, h:=nH-CutUp-CutDown 4592 | G_.Call("ScreenShot", x "|" y "|" (x+w-1) "|" (y+h-1) "|0") 4593 | return 4594 | Case "ShowPic": 4595 | ControlGet, i, CurrentLine,,, ahk_id %hscr% 4596 | ControlGet, s, Line, %i%,, ahk_id %hscr% 4597 | FindText_Main["MyPic"].Value:=Trim(this.ASCII(s),"`n") 4598 | return 4599 | Case "KeyDown": 4600 | Critical 4601 | _Gui:=FindText_Main 4602 | if (WinExist()!=_Gui.Hwnd) 4603 | return 4604 | Try ctrl:="", ctrl:=args[3] 4605 | if (ctrl=hscr) 4606 | SetTimer % G_ShowPic, -150 4607 | else if (ctrl=_Gui["ClipText"].Hwnd) 4608 | { 4609 | s:=_Gui["ClipText"].Value 4610 | _Gui["MyPic"].Value:=Trim(this.ASCII(s),"`n") 4611 | } 4612 | return 4613 | Case "LButtonDown": 4614 | Critical 4615 | if (WinExist()!=FindText_Capture.Hwnd) 4616 | return G_.Call("KeyDown", arg1, args*) 4617 | CoordMode, Mouse 4618 | MouseGetPos, k1, k2,, k6, 2 4619 | if (k6=hPic) 4620 | { 4621 | ListLines % (lls:=A_ListLines)?0:0 4622 | Loop 4623 | { 4624 | Sleep 50 4625 | MouseGetPos, k3, k4 4626 | this.RangeTip(Min(k1,k3), Min(k2,k4) 4627 | , Abs(k1-k3)+1, Abs(k2-k4)+1, (A_MSec<500 ? "Red":"Blue")) 4628 | } 4629 | Until !this.State("LButton") 4630 | ListLines % lls 4631 | this.RangeTip() 4632 | this.GetBitsFromScreen(,,,,0,zx,zy) 4633 | this.ClientToScreen(sx, sy, 0, 0, hPic) 4634 | sx:=Min(k1,k3)-sx+hBM_x+zx, sy:=Min(k2,k4)-sy+hBM_y+zy 4635 | , sw:=Abs(k1-k3)+1, sh:=Abs(k2-k4)+1 4636 | if (sw+sh)<5 4637 | sx-=71//2, sy-=25//2, sw:=71, sh:=25 4638 | G_.Call("CaptureUpdate") 4639 | FindText_Capture["MyTab1"].Choose(1) 4640 | return 4641 | } 4642 | if !(Cid_.HasKey(k6) && k5:=Cid_[k6]) 4643 | return 4644 | if (k5=-1) 4645 | { 4646 | MouseMove, k1+2, k2+2, 0 4647 | MouseGetPos,,,, k6, 2 4648 | MouseMove, k1, k2, 0 4649 | if !(Cid_.HasKey(k6) && k5:=Cid_[k6]) || (k5=-1) 4650 | return 4651 | } 4652 | if (k5>71*25) 4653 | { 4654 | k1:=nW*nH+dx+(k5-71*25) 4655 | this.SC(((show[k1]:=!show[k1])?0xFF0000:0xFFFFAA), k6) 4656 | return 4657 | } 4658 | k3:=Mod(k5-1,71)+dx, k4:=(k5-1)//71+dy 4659 | if (k3>=nW || k4>=nH) 4660 | return 4661 | k1:=k4*nW+k3+1 4662 | if (Modify && bg!="" && show[k1]) 4663 | this.SC(((ascii[k1]:=!ascii[k1])?0:0xFFFFFF), k6) 4664 | else 4665 | { 4666 | k2:=cors[k1], SelPos:=k1 4667 | _Gui:=FindText_Capture 4668 | _Gui["SelGray"].Value:=(((k2>>16)&0xFF)*38+((k2>>8)&0xFF)*75+(k2&0xFF)*15)>>7 4669 | _Gui["SelColor"].Value:=Format("0x{:06X}",k2&0xFFFFFF) 4670 | _Gui["SelR"].Value:=(k2>>16)&0xFF 4671 | _Gui["SelG"].Value:=(k2>>8)&0xFF 4672 | _Gui["SelB"].Value:=k2&0xFF 4673 | } 4674 | if (MultiColor && show[k1]) 4675 | { 4676 | (FindShape && Result="") && G_.Call("ColorPos2Two") 4677 | k2:=Format(",{:d}/{:d}/{:06X}", nX+k3, nY+k4, cors[k1]&0xFFFFFF) 4678 | , Result.=InStr(Result,k2) ? "":k2 4679 | ToolTip % Trim(Result, ",") 4680 | } 4681 | return 4682 | Case "RButtonDown": 4683 | Critical 4684 | MouseGetPos,,,, k2, 2 4685 | if (k2!=hPic) 4686 | return 4687 | CoordMode, Mouse 4688 | MouseGetPos, k1, k2 4689 | k5:=hBM_x, k6:=hBM_y 4690 | ListLines % (lls:=A_ListLines)?0:0 4691 | Loop 4692 | { 4693 | Sleep 10 4694 | MouseGetPos, k3, k4 4695 | hBM_x:=k5+k1-k3, hBM_y:=k6+k2-k4 4696 | G_.Call("PicShow") 4697 | } 4698 | Until !this.State("RButton") 4699 | ListLines % lls 4700 | return 4701 | Case "MouseMove": 4702 | Try ctrl_name:="", ctrl_name:=this.GuiCtrlFromHwnd(args[3]).Name 4703 | if (PrevControl != ctrl_name) 4704 | { 4705 | ToolTip 4706 | PrevControl:=ctrl_name 4707 | Try SetTimer % G_ToolTip, % (PrevControl ? -500:"Off") 4708 | Try SetTimer % G_ToolTipOff, % (PrevControl ? -5500:"Off") 4709 | } 4710 | return 4711 | Case "ToolTip": 4712 | MouseGetPos,,, _TT 4713 | if WinExist("ahk_id " _TT " ahk_class AutoHotkeyGUI") 4714 | Try ToolTip % Tip_Text[PrevControl] 4715 | return 4716 | Case "ToolTipOff": 4717 | ToolTip 4718 | return 4719 | Case "CutL2", "CutR2", "CutU2", "CutD2": 4720 | s:=FindText_Main["MyPic"].Value 4721 | s:=Trim(s,"`n") . "`n", v:=SubStr(cmd,4,1) 4722 | if (v="U") 4723 | s:=RegExReplace(s,"^[^\n]+\n") 4724 | else if (v="D") 4725 | s:=RegExReplace(s,"[^\n]+\n$") 4726 | else if (v="L") 4727 | s:=RegExReplace(s,"m`n)^[^\n]") 4728 | else if (v="R") 4729 | s:=RegExReplace(s,"m`n)[^\n]$") 4730 | FindText_Main["MyPic"].Value:=Trim(s,"`n") 4731 | return 4732 | Case "Update": 4733 | ControlFocus,, % "ahk_id " hscr 4734 | ControlGet, i, CurrentLine,,, ahk_id %hscr% 4735 | ControlGet, s, Line, %i%,, ahk_id %hscr% 4736 | if !RegExMatch(s, "O)(<[^>\n]*>[^$\n]+\$)\d+\.[\w+/]+", r) 4737 | return 4738 | v:=FindText_Main["MyPic"].Value 4739 | v:=Trim(v,"`n") . "`n", w:=Format("{:d}",InStr(v,"`n")-1) 4740 | v:=StrReplace(StrReplace(v,"0","1"),"_","0") 4741 | s:=StrReplace(s, r[0], r[1] . w "." this.bit2base64(v)) 4742 | v:="{End}{Shift Down}{Home}{Shift Up}{Del}" 4743 | ControlSend,, %v%, ahk_id %hscr% 4744 | Control, EditPaste, %s%,, ahk_id %hscr% 4745 | ControlSend,, {Home}, ahk_id %hscr% 4746 | return 4747 | } 4748 | } 4749 | 4750 | Lang(text:="", getLang:=0) 4751 | { 4752 | local 4753 | static init, Lang1, Lang2 4754 | if !VarSetCapacity(init) && (init:="1") 4755 | { 4756 | s:=" 4757 | ( 4758 | Myww = Width = Adjust the width of the capture range 4759 | Myhh = Height = Adjust the height of the capture range 4760 | AddFunc = Add = Additional FindText() in Copy 4761 | NowHotkey = Hotkey = Current screenshot hotkey 4762 | SetHotkey1 = = First sequence Screenshot hotkey 4763 | SetHotkey2 = = Second sequence Screenshot hotkey 4764 | Apply = Apply = Apply new screenshot hotkey 4765 | CutU2 = CutU = Cut the Upper Edge of the text in the edit box below 4766 | CutL2 = CutL = Cut the Left Edge of the text in the edit box below 4767 | CutR2 = CutR = Cut the Right Edge of the text in the edit box below 4768 | CutD2 = CutD = Cut the Lower Edge of the text in the edit box below 4769 | Update = Update = Update the text in the edit box below to the line of Code 4770 | GetRange = GetRange = Get screen range to Clipboard and update the search range of the Code 4771 | GetOffset = GetOffset = Get position offset relative to the Text from the Code and update FindText().Click() 4772 | GetClipOffset = GetOffset2 = Get position offset relative to the Text from the Left Box 4773 | Capture = Capture = Initiate Image Capture Sequence 4774 | CaptureS = CaptureS = Restore the Saved ScreenShot by Hotkey and then start capturing 4775 | Test = Test = Test the Text from the Code to see if it can be found on the screen 4776 | TestClip = Test2 = Test the Text from the Left Box and copy the result to Clipboard 4777 | Paste = Paste = Paste the Text from Clipboard to the Left Box 4778 | CopyOffset = Copy2 = Copy the Offset to Clipboard 4779 | Copy = Copy = Copy the selected or all of the code to the clipboard 4780 | Reset = Reset = Reset to Original Captured Image 4781 | SplitAdd = SplitAdd = Using Markup Segmentation to Generate Text Library 4782 | AllAdd = AllAdd = Append Another FindText Search Text into Previously Generated Code 4783 | Gray2Two = Gray2Two = Converts Image Pixels from Gray Threshold to Black or White 4784 | GrayDiff2Two = GrayDiff2Two = Converts Image Pixels from Gray Difference to Black or White 4785 | Color2Two = Color2Two = Converts Image Pixels from Color List to Black or White 4786 | ColorPos2Two = ColorPos2Two = Converts Image Pixels from Color Position to Black or White 4787 | SelGray = Gray = Gray value of the selected color 4788 | SelColor = Color = The selected color 4789 | SelR = R = Red component of the selected color 4790 | SelG = G = Green component of the selected color 4791 | SelB = B = Blue component of the selected color 4792 | RepU = -U = Undo Cut the Upper Edge by 1 4793 | CutU = U = Cut the Upper Edge by 1 4794 | CutU3 = U3 = Cut the Upper Edge by 3 4795 | RepL = -L = Undo Cut the Left Edge by 1 4796 | CutL = L = Cut the Left Edge by 1 4797 | CutL3 = L3 = Cut the Left Edge by 3 4798 | Auto = Auto = Automatic Cut Edge after image has been converted to black and white 4799 | RepR = -R = Undo Cut the Right Edge by 1 4800 | CutR = R = Cut the Right Edge by 1 4801 | CutR3 = R3 = Cut the Right Edge by 3 4802 | RepD = -D = Undo Cut the Lower Edge by 1 4803 | CutD = D = Cut the Lower Edge by 1 4804 | CutD3 = D3 = Cut the Lower Edge by 3 4805 | Modify = Modify = Allows Modify the Black and White Image 4806 | MultiColor = FindMultiColor = Click multiple colors with the mouse, then Click OK button 4807 | FindShape = FindShape = Click multiple colors, it will be binarized based on the first color 4808 | Undo = Undo = Undo the last selected color 4809 | Undo2 = Undo = Undo the last added color in Color List 4810 | Comment = Comment = Optional Comment used to Label Code ( Within <> ) 4811 | Threshold = Gray Threshold = Gray Threshold which Determines Black or White Pixel Conversion (0-255) 4812 | GrayDiff = Gray Difference = Gray Difference which Determines Black or White Pixel Conversion (0-255) 4813 | Similar1 = Similarity = Adjust color similarity as Equivalent to The Selected Color 4814 | Similar2 = Similarity = Adjust color similarity as Equivalent to The Selected Color 4815 | Similar3 = Similarity = Adjust color similarity as Equivalent to The Selected Color 4816 | AddColorSim = Add = Add Color to Color List and Run Color2Two 4817 | AddColorDiff = Add = Add Color to Color List and Run Color2Two 4818 | ColorList = = Color list for converting black and white images 4819 | DiffRGB = R/G/B = Determine the allowed R/G/B Error (0-255) when Find MultiColor 4820 | DiffRGB2 = R/G/B = Determine the allowed R/G/B Error (0-255) 4821 | Bind0 = BindWin1 = Bind the window and Use GetDCEx() to get the image of background window 4822 | Bind1 = BindWin1+ = Bind the window Use GetDCEx() and Modify the window to support transparency 4823 | Bind2 = BindWin2 = Bind the window and Use PrintWindow() to get the image of background window 4824 | Bind3 = BindWin2+ = Bind the window Use PrintWindow() and Modify the window to support transparency 4825 | Bind4 = BindWin3 = Bind the window and Use PrintWindow(,,3) to get the image of background window 4826 | OK = OK = Create New FindText Code for Testing 4827 | OK2 = OK = Restore this ScreenShot then Capturing 4828 | Cancel = Cancel = Close the Window Don't Do Anything 4829 | Cancel2 = Cancel = Close the Window Don't Do Anything 4830 | ClearAll = ClearAll = Clean up all saved ScreenShots 4831 | OpenDir = OpenDir = Open the saved screenshots directory 4832 | SavePic = SavePic = Select a range and save as a picture 4833 | SavePic2 = SavePic = Save the trimmed original image as a picture 4834 | LoadPic = LoadPic = Load a picture as Capture image 4835 | ClipText = = Displays the Text data from clipboard 4836 | Offset = = Displays the results of GetOffset2 or GetRange 4837 | SelectBox = = Select a screenshot to display in the upper left corner of the screen 4838 | s1 = FindText 4839 | s2 = Gray|GrayDiff|Color|ColorPos|MultiColor 4840 | s3 = Capture Image To Text 4841 | s4 = Capture Image To Text and Find Text Tool 4842 | s5 = Direction keys to fine tune\nFirst click RButton(or Ctrl)\nMove the mouse away\nSecond click RButton(or Ctrl) 4843 | s6 = Unbind Window using 4844 | s7 = Drag a range with LButton(or Ctrl)\nCoordinates are copied to clipboard 4845 | s8 = Found|Time|ms|Pos|Result|value can be get from|Wait 3 seconds for appear|Wait indefinitely for disappear 4846 | s9 = Success 4847 | s10 = The Capture Position|Perspective binding window\nRight click to finish capture 4848 | s11 = Please Set Gray Difference First ! 4849 | s12 = Please select the core color first ! 4850 | s13 = Please convert the image to black or white first ! 4851 | s14 = Can't be used in ColorPos mode, because it can cause position errors 4852 | s15 = Are you sure about the scope of your choice ?\n\nIf not, you can choose again 4853 | s16 = Please add colors to the color list first ! 4854 | s17 = The picture you want to open was not found ! 4855 | s18 = Capture|ScreenShot 4856 | s19 = Are you sure to delete all screenshots ? 4857 | )" 4858 | Lang1:=[], Lang2:=[] 4859 | Loop Parse, s, `n, `r 4860 | if InStr(v:=A_LoopField, "=") 4861 | r:=StrSplit(StrReplace(v "==","\n","`n"), "=", "`t ") 4862 | , Lang1[r[1]]:=r[2], Lang2[r[1]]:=r[3] 4863 | } 4864 | return getLang=1 ? Lang1 : getLang=2 ? Lang2 : Lang1[text] 4865 | } 4866 | 4867 | ;--------------------------------- 4868 | ; Gui-V1-V2 Compatibility Library By FeiYue 4869 | ;--------------------------------- 4870 | 4871 | GuiNew(args*) { 4872 | return new this.GuiCreate(args*) 4873 | } 4874 | 4875 | GuiFromHwnd(hwnd:="AllGuiObj", RecurseParent:=0) { 4876 | static init, AllGuiObj 4877 | if !VarSetCapacity(init) && (init:="1") 4878 | AllGuiObj:=[] 4879 | if (hwnd=="AllGuiObj") 4880 | return AllGuiObj 4881 | if (RecurseParent) 4882 | While hwnd && !AllGuiObj.HasKey(hwnd) 4883 | hwnd:=DllCall("GetParent", "Ptr",hwnd, "Ptr") 4884 | return AllGuiObj[hwnd] 4885 | } 4886 | 4887 | GuiCtrlFromHwnd(hwnd) { 4888 | return this.GuiFromHwnd(hwnd,1)[hwnd] 4889 | } 4890 | 4891 | GuiOnEvent(EventName, args*) { 4892 | return this.GuiFromHwnd(WinExist())["_" EventName].Call(0,args*) 4893 | } 4894 | 4895 | GuiClose(args*) { 4896 | return FindText().GuiOnEvent("Close",args*) 4897 | } 4898 | 4899 | GuiEscape(args*) { 4900 | return FindText().GuiOnEvent("Escape",args*) 4901 | } 4902 | 4903 | GuiSize(args*) { 4904 | return FindText().GuiOnEvent("Size",args*) 4905 | } 4906 | 4907 | GuiContextMenu(args*) { 4908 | return FindText().GuiOnEvent("ContextMenu",args*) 4909 | } 4910 | 4911 | GuiDropFiles(args*) { 4912 | return FindText().GuiOnEvent("DropFiles",0,args*) 4913 | } 4914 | 4915 | Class GuiCreate 4916 | { ;// GuiCreate Class Begin 4917 | 4918 | __New(opts:="", title:="", args*) { 4919 | local 4920 | Gui, New, % opts " +Hwndhwnd +LabelFindTextClass.Gui", % title 4921 | this.Hwnd:=hwnd, this.ClassNN:=[] 4922 | FindText().GuiFromHwnd()[hwnd]:=this 4923 | } 4924 | 4925 | __Delete() { 4926 | this.Destroy() 4927 | } 4928 | 4929 | Destroy() { 4930 | local 4931 | if !(hwnd:=this.Hwnd) 4932 | return 4933 | this.Hwnd:="", FindText().GuiFromHwnd().Delete(hwnd) 4934 | Try Gui, % hwnd ":Destroy" 4935 | For k,v in this 4936 | (v.Hwnd && v.Hwnd:=""), this[k]:="" 4937 | } 4938 | 4939 | OnEvent(EventName, Callback, AddRemove:=1) { 4940 | if IsObject(Callback) 4941 | this["_" EventName]:=Callback 4942 | } 4943 | 4944 | Opt(opts) { 4945 | Gui, % this.Hwnd ":" RegExReplace(opts,"i)[+\-\s]Label\S*") 4946 | } 4947 | 4948 | Add(type, opts:="", text:="") { 4949 | local 4950 | static init, type2class 4951 | if !VarSetCapacity(init) && (init:="1") 4952 | type2class:=[] 4953 | type:=(type="DropDownList"?"DDL":type="Picture"?"Pic":type) 4954 | name:=RegExMatch(opts,"i)(^|[+\-\s])V(?!Scroll\b|ertical\b)\K\S*",r)?r:"" 4955 | opts:=RegExReplace(opts,"i)(^|[+\-\s])V(?!Scroll\b|ertical\b)\S*") 4956 | if IsObject(text) 4957 | { 4958 | s:="" 4959 | For k,v in text 4960 | s.="|" v 4961 | text:=Trim(s, "|") 4962 | } 4963 | Gui, % this.Hwnd ":Add", % type, % opts " +Hwndhwnd", % text 4964 | this.LastHwnd:=hwnd 4965 | if type2class.HasKey(type) 4966 | s:=type2class[type] 4967 | else 4968 | { 4969 | WinGetClass, s, ahk_id %hwnd% 4970 | type2class[type]:=s 4971 | } 4972 | this.ClassNN[s]:=n:=Floor(this.ClassNN[s])+1, classnn:=s . n 4973 | obj:= new this.Control(this.Hwnd, hwnd, type, classnn, name) 4974 | this[hwnd]:=obj, this[classnn]:=obj 4975 | if (name) && !(name~="i)^(Destroy|OnEvent|Opt|Add" 4976 | . "|SetFont|Show|Hide|Move|GetClientPos|GetPos|Maximize" 4977 | . "|Minimize|Restore|Flash|Submit|Hwnd|Name|Title" 4978 | . "|BackColor|MarginX|MarginY|MenuBar|FocusedCtrl)$") 4979 | this[name]:=obj 4980 | return obj 4981 | } 4982 | 4983 | SetFont(opts:="", FontName:="") { 4984 | Gui, % this.Hwnd ":Font", % opts, % FontName 4985 | } 4986 | 4987 | Show(opts:="", args*) { 4988 | Gui, % this.Hwnd ":Show", % opts 4989 | } 4990 | 4991 | Hide() { 4992 | Gui, % this.Hwnd ":Hide" 4993 | } 4994 | 4995 | Move(x:="", y:="", w:="", h:="") { 4996 | local 4997 | this.GetPos(pX, pY, pW, pH) 4998 | x:=(x=""?pX:x), y:=(y=""?pY:y), w:=(w=""?pW:w), h:=(h=""?pH:h) 4999 | DllCall("MoveWindow", "Ptr",this.Hwnd, "int",x, "int",y, "int",w, "int",h, "int",1) 5000 | } 5001 | 5002 | GetClientPos(ByRef x:="", ByRef y:="", ByRef w:="", ByRef h:="") { 5003 | local 5004 | VarSetCapacity(rect, 16, 0) 5005 | , DllCall("GetClientRect", "Ptr",this.Hwnd, "Ptr",&rect) 5006 | , DllCall("ClientToScreen", "Ptr",this.Hwnd, "Ptr",&rect) 5007 | , x:=NumGet(rect, 0, "int"), y:=NumGet(rect, 4, "int") 5008 | , w:=NumGet(rect, 8, "int")-x, h:=NumGet(rect, 12, "int")-y 5009 | } 5010 | 5011 | GetPos(ByRef x:="", ByRef y:="", ByRef w:="", ByRef h:="") { 5012 | local 5013 | VarSetCapacity(rect, 16, 0) 5014 | , DllCall("GetWindowRect", "Ptr",this.Hwnd, "Ptr",&rect) 5015 | , x:=NumGet(rect, 0, "int"), y:=NumGet(rect, 4, "int") 5016 | , w:=NumGet(rect, 8, "int")-x, h:=NumGet(rect, 12, "int")-y 5017 | } 5018 | 5019 | Maximize() { 5020 | Gui, % this.Hwnd ":Maximize" 5021 | } 5022 | 5023 | Minimize() { 5024 | Gui, % this.Hwnd ":Minimize" 5025 | } 5026 | 5027 | Restore() { 5028 | Gui, % this.Hwnd ":Restore" 5029 | } 5030 | 5031 | Flash(k:=1) { 5032 | Gui, % this.Hwnd ":Flash", % k ? "":"Off" 5033 | } 5034 | 5035 | Submit(hide:=1) { 5036 | local 5037 | (hide && this.Hide()), arr:=[] 5038 | For k,v in this 5039 | if k is number 5040 | if (v.Name!="") 5041 | arr[v.Name]:=v.Value 5042 | return arr 5043 | } 5044 | 5045 | BackColor { 5046 | get { 5047 | return this._BackColor 5048 | } 5049 | set { 5050 | this._BackColor:=value 5051 | Gui, % this.Hwnd ":Color", % value 5052 | return value 5053 | } 5054 | } 5055 | 5056 | MarginX { 5057 | get { 5058 | return this._MarginX 5059 | } 5060 | set { 5061 | this._MarginX:=value 5062 | Gui, % this.Hwnd ":Margin", % value 5063 | return value 5064 | } 5065 | } 5066 | 5067 | MarginY { 5068 | get { 5069 | return this._MarginY 5070 | } 5071 | set { 5072 | this._MarginY:=value 5073 | Gui, % this.Hwnd ":Margin",, % value 5074 | return value 5075 | } 5076 | } 5077 | 5078 | MenuBar { 5079 | get { 5080 | return this._MenuBar 5081 | } 5082 | set { 5083 | this._MenuBar:=value 5084 | Gui, % this.Hwnd ":Menu", % value 5085 | return value 5086 | } 5087 | } 5088 | 5089 | Title { 5090 | get { 5091 | local 5092 | VarSetCapacity(v, 260*2) 5093 | DllCall("GetWindowText", "Ptr",this.Hwnd, "Str",v, "Int",260) 5094 | return v 5095 | } 5096 | set { 5097 | DllCall("SetWindowText", "Ptr",this.Hwnd, "Str",value) 5098 | return value 5099 | } 5100 | } 5101 | 5102 | FocusedCtrl { 5103 | get { 5104 | local 5105 | GuiControlGet, v, % this.Hwnd ":Focus" 5106 | return this[v] 5107 | } 5108 | } 5109 | 5110 | Class Control 5111 | { ;// Control Class Begin 5112 | 5113 | __New(GuiHwnd, hwnd, type, classnn, name) { 5114 | this.GuiHwnd:=GuiHwnd, this.Hwnd:=hwnd 5115 | this.Type:=type, this.ClassNN:=classnn, this.Name:=name 5116 | } 5117 | 5118 | Opt(opts) { 5119 | GuiControl, % opts, % this.Hwnd 5120 | } 5121 | 5122 | OnEvent(EventName, Callback, AddRemove:=1) { 5123 | local 5124 | r:=this.OnEvent_G.Bind(this, Callback) 5125 | GuiControl, +g, % this.Hwnd, % r 5126 | } 5127 | 5128 | OnEvent_G(Callback, args*) { 5129 | if IsObject(Callback) 5130 | return %Callback%(this, args*) 5131 | } 5132 | 5133 | GetPos(ByRef x:="", ByRef y:="", ByRef w:="", ByRef h:="") { 5134 | local 5135 | GuiControlGet, p, Pos, % this.Hwnd 5136 | x:=Floor(pX), y:=Floor(pY), w:=Floor(pW), h:=Floor(pH) 5137 | } 5138 | 5139 | Move(x:="", y:="", w:="", h:="") { 5140 | local 5141 | s:=(x=""?"":" x" x) (y=""?"":" y" y) (w=""?"":" w" w) (h=""?"":" h" h) 5142 | GuiControl, Move, % this.Hwnd, % s 5143 | } 5144 | 5145 | Redraw() { 5146 | GuiControl, MoveDraw, % this.Hwnd 5147 | } 5148 | 5149 | Focus() { 5150 | Try GuiControl, Focus, % this.Hwnd 5151 | } 5152 | 5153 | UseTab(Name:="", Exact:="", index:="") { 5154 | Gui, % this.GuiHwnd ":Tab", % Name, % index, % Exact?"Exact":"" 5155 | } 5156 | 5157 | SetFont(opts:="", FontName:="") { 5158 | Gui, % this.GuiHwnd ":Font", % opts, % FontName 5159 | GuiControl, Font, % this.Hwnd 5160 | } 5161 | 5162 | Add(text) { 5163 | local 5164 | if IsObject(text) 5165 | { 5166 | s:="" 5167 | For k,v in text 5168 | s.="|" v 5169 | text:=Trim(s, "|") 5170 | } 5171 | GuiControl,, % this.Hwnd, % text 5172 | } 5173 | 5174 | Delete(N:="") { 5175 | if (N="") 5176 | GuiControl,, % this.Hwnd, | 5177 | else 5178 | this.Choose(N), this.Choose(0) 5179 | } 5180 | 5181 | Choose(N) { 5182 | if N is number 5183 | GuiControl, Choose, % this.Hwnd, % N 5184 | else 5185 | GuiControl, ChooseString, % this.Hwnd, % N 5186 | } 5187 | 5188 | Gui { 5189 | get { 5190 | return FindText().GuiFromHwnd(this.GuiHwnd) 5191 | } 5192 | } 5193 | 5194 | Enabled { 5195 | get { 5196 | local 5197 | GuiControlGet, v, Enabled, % this.Hwnd 5198 | return v 5199 | } 5200 | set { 5201 | GuiControl, % "Enable" (!!value), % this.Hwnd 5202 | return value 5203 | } 5204 | } 5205 | 5206 | Visible { 5207 | get { 5208 | local 5209 | GuiControlGet, v, Visible, % this.Hwnd 5210 | return v 5211 | } 5212 | set { 5213 | GuiControl, % "Show" (!!value), % this.Hwnd 5214 | return value 5215 | } 5216 | } 5217 | 5218 | Focused { 5219 | get { 5220 | local 5221 | GuiControlGet, v, % this.GuiHwnd ":Focus" 5222 | return (v=this.ClassNN) 5223 | } 5224 | } 5225 | 5226 | Value { 5227 | get { 5228 | local 5229 | if (this.Type~="i)^(ListBox|DDL|ComboBox|Tab)$") 5230 | this.Opt("+AltSubmit") 5231 | GuiControlGet, v,, % this.Hwnd 5232 | return v 5233 | } 5234 | set { 5235 | if (this.Type~="i)^(ListBox|DDL|ComboBox|Tab)$") 5236 | GuiControl, Choose, % this.Hwnd, % value 5237 | else 5238 | GuiControl,, % this.Hwnd, % value 5239 | return value 5240 | } 5241 | } 5242 | 5243 | Text { 5244 | get { 5245 | local 5246 | if (this.Type~="i)^(ListBox|DDL|ComboBox|Tab)$") 5247 | this.Opt("-AltSubmit") 5248 | GuiControlGet, v,, % this.Hwnd 5249 | return v 5250 | } 5251 | set { 5252 | if (this.Type~="i)^(ListBox|DDL|ComboBox|Tab)$") 5253 | GuiControl, ChooseString, % this.Hwnd, % value 5254 | else 5255 | GuiControl,, % this.Hwnd, % value 5256 | return value 5257 | } 5258 | } 5259 | 5260 | } ;// Control Class End 5261 | 5262 | } ;// GuiCreate Class End 5263 | 5264 | Script_End() { 5265 | } 5266 | 5267 | } 5268 | --------------------------------------------------------------------------------