├── 16082_900.png ├── 16291_900.png ├── AhkSpy picture 2020-11-14 07.15.51.png ├── AhkSpy.ahk ├── AhkSpy.exe ├── Extra ├── AccViewer Source.ahk ├── AhkSpyZoom.ahk └── iWB2 Learner.ahk ├── Old ├── 449 ├── AhkSpy.ahk └── AhkSpy.exe ├── Readme.txt ├── Test ├── 422 2ex.ahk ├── AhkSpy.ahk ├── AhkSpyVersion 4.21 ie11.ahk ├── AhkSpy_DC.ahk ├── Crop 449.ahk └── art.test └── menu.png /16082_900.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serzh82saratov/AhkSpy/18816a663030e5bd19a080db024da49c5c5c4c93/16082_900.png -------------------------------------------------------------------------------- /16291_900.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serzh82saratov/AhkSpy/18816a663030e5bd19a080db024da49c5c5c4c93/16291_900.png -------------------------------------------------------------------------------- /AhkSpy picture 2020-11-14 07.15.51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serzh82saratov/AhkSpy/18816a663030e5bd19a080db024da49c5c5c4c93/AhkSpy picture 2020-11-14 07.15.51.png -------------------------------------------------------------------------------- /AhkSpy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serzh82saratov/AhkSpy/18816a663030e5bd19a080db024da49c5c5c4c93/AhkSpy.exe -------------------------------------------------------------------------------- /Extra/AccViewer Source.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance Force 2 | #Persistent 3 | #NoEnv 4 | #NoTrayIcon 5 | ListLines Off 6 | SetBatchLines -1 7 | 8 | { 9 | WM_ACTIVATE := 0x06 10 | WM_KILLFOCUS := 0x08 11 | WM_LBUTTONDOWN := 0x201 12 | WM_LBUTTONUP := 0x202 13 | global Border := new Outline, Stored:={}, Acc, ChildId, TVobj, Win:={} 14 | } 15 | { 16 | DetectHiddenWindows, On 17 | OnExit, OnExitCleanup 18 | OnMessage(0x200,"WM_MOUSEMOVE") 19 | ComObjError(false) 20 | Hotkey, ~LButton Up, Off 21 | } 22 | { 23 | Gui Main: New, HWNDhwnd LabelGui AlwaysOnTop, Accessible Info Viewer 24 | Gui Main: Default 25 | Win.Main := hwnd 26 | Gui, Add, Button, x160 y8 w105 h20 vShowStructure gShowStructure, Show Acc Structure 27 | { 28 | Gui, Add, Text, x10 y3 w25 h26 Border gCrossHair ReadOnly HWNDh8 Border 29 | CColor(h8, "White") 30 | Gui, Add, Text, x10 y3 w25 h4 HWNDh9 Border 31 | CColor(h9, "0046D5") 32 | Gui, Add, Text, x13 y17 w19 h1 Border vHBar 33 | Gui, Add, Text, x22 y8 w1 h19 Border vVBar 34 | } 35 | { 36 | Gui, Font, bold 37 | Gui, Add, GroupBox, x2 y32 w275 h130 vWinCtrl, Window/Control Info 38 | Gui, Font 39 | Gui, Add, Text, x7 y49 w42 h20 Right, WinTitle: 40 | Gui, Add, Edit, x51 y47 w221 h20 vWinTitle , 41 | Gui, Add, Text, x7 y71 w42 h20 Right, Text: 42 | Gui, Add, Edit, x51 y69 w221 h20 vText , 43 | Gui, Add, Text, x7 y93 w42 h20 Right, Hwnd: 44 | Gui, Add, Edit, x51 y91 w72 h20 vHwnd, 45 | Gui, Add, Text, x126 y93 w51 h20 vClassText Right, Class(NN): 46 | Gui, Add, Edit, x178 y91 w94 h20 vClass, 47 | Gui, Add, Text, x7 y115 w42 h20 Right, Position: 48 | Gui, Add, Edit, x51 y113 w72 h20 vPosition, 49 | Gui, Add, Text, x126 y115 w51 h20 Right, Process: 50 | Gui, Add, Edit, x178 y113 w94 h20 vProcess, 51 | Gui, Add, Text, x7 y137 w42 h20 Right, Size: 52 | Gui, Add, Edit, x51 y135 w72 h20 vSize, 53 | Gui, Add, Text, x126 y137 w51 h20 Right, Proc ID: 54 | Gui, Add, Edit, x178 y135 w94 h20 vProcID, 55 | } 56 | { 57 | Gui, Font, bold 58 | Gui, Add, GroupBox, x2 y165 w275 h240 vAcc, Accessible Info 59 | Gui, Font 60 | Gui, Add, Text, x7 y182 w42 h20 Right, Name: 61 | Gui, Add, Edit, x51 y180 w221 h20 vAccName , 62 | Gui, Add, Text, x7 y204 w42 h20 Right, Value: 63 | Gui, Add, Edit, x51 y202 w221 h20 vAccValue , 64 | Gui, Add, Text, x7 y226 w42 h20 Right, Role: 65 | Gui, Add, Edit, x51 y224 w72 h20 vAccRole, 66 | Gui, Add, Text, x126 y226 w55 h20 Right, ChildCount: 67 | Gui, Add, Edit, x182 y224 w90 h20 vAccChildCount, 68 | Gui, Add, Text, x7 y248 w42 h20 Right, State: 69 | Gui, Add, Edit, x51 y246 w72 h20 vAccState, 70 | Gui, Add, Text, x126 y248 w55 h20 Right, Selection: 71 | Gui, Add, Edit, x182 y246 w90 h20 vAccSelection, 72 | Gui, Add, Text, x7 y270 w42 h20 Right, Action: 73 | Gui, Add, Edit, x51 y268 w72 h20 vAccAction, 74 | Gui, Add, Text, x126 y270 w55 h20 Right, Focus: 75 | Gui, Add, Edit, x182 y268 w90 h20 vAccFocus, 76 | { 77 | Gui, Add, Text, x7 y292 w55 h20 Right vAccLocationText, Location: 78 | Gui, Add, Edit, x65 y290 w207 h20 vAccLocation , 79 | Gui, Add, Text, x7 y314 w55 h20 Right, Description: 80 | Gui, Add, Edit, x65 y312 w207 h20 vAccDescription , 81 | Gui, Add, Text, x7 y336 w55 h20 Right, Keyboard: 82 | Gui, Add, Edit, x65 y334 w207 h20 vAccKeyboard , 83 | Gui, Add, Text, x7 y358 w55 h20 Right, Help: 84 | Gui, Add, Edit, x65 y356 w207 h20 vAccHelp , 85 | Gui, Add, Text, x7 y380 w55 h20 Right, HelpTopic: 86 | Gui, Add, Edit, x65 y378 w207 h20 vAccHelpTopic , 87 | } 88 | } 89 | { 90 | Gui, Add, StatusBar, gShowMainGui 91 | SB_SetParts(70,150) 92 | SB_SetText("`tshow more", 3) 93 | } 94 | { 95 | Gui Acc: New, ToolWindow AlwaysOnTop Resize LabelAcc HWNDhwnd -DPIScale, Acc Structure 96 | Gui, Acc:+OwnerMain 97 | Win.Acc := hwnd 98 | Gui Acc: Add, TreeView, w200 h300 vTView gTreeView R17 AltSubmit 99 | Gui Acc: Show, Hide 100 | } 101 | GoSub, ShowMainGui 102 | WinSet, Redraw, , % "ahk_id" Win.Main 103 | 104 | param1 = %1% 105 | If param1 106 | pObj := ComObjActive(param1) 107 | If pObj 108 | GetAccInfoRun() 109 | return 110 | } 111 | ShowMainGui: 112 | { 113 | if A_EventInfo in 1,2 114 | { 115 | WM_MOUSEMOVE() 116 | StatusBarGetText, SB_Text, %A_EventInfo%, % "ahk_id" Win.Main 117 | if SB_Text 118 | if (A_EventInfo=2 and SB_Text:=SubStr(SB_Text,7)) 119 | or if RegExMatch(SB_Text, "Id: \K\d+", SB_Text) { 120 | ToolTip % "clipboard = " clipboard:=SB_Text 121 | SetTimer, RemoveToolTip, -2000 122 | } 123 | } 124 | else { 125 | Gui Main: Default 126 | if ShowingLess { 127 | SB_SetText("`tshow less", 3) 128 | GuiControl, Move, Acc, x2 y165 w275 h240 129 | GuiControl, Show, AccDescription 130 | GuiControl, Show, AccLocation 131 | GuiControl, Show, AccLocationText 132 | { 133 | height := 319 134 | while height<428 { 135 | height += 10 136 | Gui, Show, w280 h%height% 137 | Sleep, 20 138 | } 139 | } 140 | Gui, Show, w280 h428 141 | ShowingLess := false 142 | } 143 | else { 144 | if (ShowingLess != "") { 145 | height := 428 146 | while height>319 { 147 | height -= 10 148 | Gui, Show, w280 h%height% 149 | Sleep, 20 150 | } 151 | } 152 | Gui, Show, w280 h319 153 | GuiControl, Hide, AccDescription 154 | GuiControl, Hide, AccLocation 155 | GuiControl, Hide, AccLocationText 156 | GuiControl, Move, Acc, x2 y165 w275 h130 157 | SB_SetText("`tshow more", 3) 158 | ShowingLess := true 159 | } 160 | WinSet, Redraw, , % "ahk_id" Win.Main 161 | } 162 | return 163 | } 164 | 165 | #if Not Lbutton_Pressed 166 | ^/:: 167 | { 168 | SetBatchLines, -1 169 | Lbutton_Pressed := true 170 | Stored.Chwnd := "" 171 | Gui Acc: Default 172 | GuiControl, Disable, TView 173 | while, Lbutton_Pressed 174 | GetAccInfo() 175 | SetBatchLines, 10ms 176 | return 177 | } 178 | #if Lbutton_Pressed 179 | ^/:: 180 | { 181 | Lbutton_Pressed := false 182 | Gui Main: Default 183 | Sleep, -1 184 | GuiControl, , WinCtrl, % (DllCall("GetParent", Uint,Acc_WindowFromObject(Acc))? "Control":"Window") " Info" 185 | if Not DllCall("IsWindowVisible", "Ptr",Win.Acc) { 186 | Border.Hide() 187 | SB_SetText("Path: " GetAccPath(Acc).path, 2) 188 | } 189 | else { 190 | Gui Acc: Default 191 | BuildTreeView() 192 | GuiControl, Enable, TView 193 | WinActivate, % "ahk_id" Win.Acc 194 | PostMessage, %WM_LBUTTONDOWN%, , , SysTreeView321, % "ahk_id" Win.Acc 195 | } 196 | return 197 | } 198 | #if 199 | ~Lbutton Up:: 200 | { 201 | Hotkey, ~LButton Up, Off 202 | Lbutton_Pressed := False 203 | Gui Main: Default 204 | if Not CH { 205 | GuiControl, Show, HBar 206 | GuiControl, Show, VBar 207 | CrossHair(CH:=true) 208 | } 209 | Sleep, -1 210 | GuiControl, , WinCtrl, % (DllCall("GetParent", Uint,Acc_WindowFromObject(Acc))? "Control":"Window") " Info" 211 | if Not DllCall("IsWindowVisible", "Ptr",Win.Acc) { 212 | Border.Hide() 213 | SB_SetText("Path: " GetAccPath(Acc).path, 2) 214 | } 215 | else { 216 | Gui Acc: Default 217 | BuildTreeView() 218 | GuiControl, Enable, TView 219 | WinActivate, % "ahk_id" Win.Acc 220 | PostMessage, %WM_LBUTTONDOWN%, , , SysTreeView321, % "ahk_id" Win.Acc 221 | } 222 | return 223 | } 224 | CrossHair: 225 | { 226 | if (A_GuiEvent = "Normal") { 227 | SetBatchLines, -1 228 | Hotkey, ~LButton Up, On 229 | { 230 | GuiControl, Hide, HBar 231 | GuiControl, Hide, VBar 232 | CrossHair(CH:=false) 233 | } 234 | Lbutton_Pressed := True 235 | Stored.Chwnd := "" 236 | Gui Acc: Default 237 | GuiControl, Disable, TView 238 | while, Lbutton_Pressed 239 | GetAccInfo() 240 | SetBatchLines, 10ms 241 | } 242 | return 243 | } 244 | OnExitCleanup: 245 | { 246 | CrossHair(true) 247 | GuiClose: 248 | ExitApp 249 | } 250 | ShowStructure: 251 | { 252 | ControlFocus, Static1, % "ahk_id" Win.Main 253 | if DllCall("IsWindowVisible", "Ptr",Win.Acc) { 254 | PostMessage, %WM_LBUTTONDOWN%, , , SysTreeView321, % "ahk_id" Win.Acc 255 | return 256 | } 257 | WinGetPos, x, y, w, , % "ahk_id" Win.Main 258 | WinGetPos, , , AccW, AccH, % "ahk_id" Win.Acc 259 | WinMove, % "ahk_id" Win.Acc, 260 | , (x+w+AccW > A_ScreenWidth? x-AccW-10:x+w+10) 261 | , % y+5, %AccW%, %AccH% 262 | WinShow, % "ahk_id" Win.Acc 263 | if ComObjType(Acc, "Name") = "IAccessible" 264 | BuildTreeView() 265 | if Lbutton_Pressed 266 | GuiControl, Disable, TView 267 | else 268 | GuiControl, Enable, TView 269 | PostMessage, %WM_LBUTTONDOWN%, , , SysTreeView321, % "ahk_id" Win.Acc 270 | return 271 | } 272 | BuildTreeView() 273 | { 274 | r := GetAccPath(Acc) 275 | AccObj:=r.AccObj, Child_Path:=r.Path, r:="" 276 | Gui Acc: Default 277 | TV_Delete() 278 | GuiControl, -Redraw, TView 279 | parent := TV_Add(Acc_Role(AccObj), "", "Bold Expand") 280 | TVobj := {(parent): {is_obj:true, obj:AccObj, need_children:false, childid:0, Children:[]}} 281 | 282 | Loop Parse, Child_Path, . 283 | { 284 | if A_LoopField is not Digit 285 | TVobj[parent].Obj_Path := Trim(TVobj[parent].Obj_Path "," A_LoopField, ",") 286 | else { 287 | StoreParent := parent 288 | parent := TV_BuildAccChildren(AccObj, parent, "", A_LoopField) 289 | TVobj[parent].need_children := false 290 | TV_Expanded(StoreParent) 291 | TV_Modify(parent,"Expand") 292 | AccObj := TVobj[parent].obj 293 | } 294 | } 295 | if Not ChildId { 296 | TV_BuildAccChildren(AccObj, parent) 297 | TV_Modify(parent, "Select") 298 | } 299 | else 300 | TV_BuildAccChildren(AccObj, parent, ChildId) 301 | TV_Expanded(parent) 302 | Sleep 100 303 | TV_Modify(TV_GetSelection(),"Vis") 304 | GuiControl, +Redraw, TView 305 | } 306 | AccClose: 307 | { 308 | Border.Hide() 309 | Gui Acc: Hide 310 | TV_Delete() 311 | Gui Main: Default 312 | GuiControl, Enable, ShowStructure 313 | return 314 | } 315 | AccSize: 316 | { 317 | Anchor(TView, "wh") 318 | return 319 | } 320 | TreeView: 321 | { 322 | Gui, Submit, NoHide 323 | if (A_GuiEvent = "S") 324 | UpdateAccInfo(TVobj[A_EventInfo].obj, TVobj[A_EventInfo].childid, TVobj[A_EventInfo].obj_path) 325 | if (A_GuiEvent = "+") { 326 | GuiControl, -Redraw, TView 327 | TV_Expanded(A_EventInfo) 328 | GuiControl, +Redraw, TView 329 | } 330 | return 331 | } 332 | RemoveToolTip: 333 | { 334 | ToolTip 335 | return 336 | } 337 | GetAccInfoRun() { 338 | global Whwnd, pObj 339 | 340 | Acc := pObj.AccObj.AccObj 341 | ChildId := pObj.AccObj.Child 342 | Location := GetAccLocation(Acc, ChildId) 343 | Hwnd := Acc_WindowFromObject(Acc) 344 | if parent := DllCall("GetParent", Uint,hwnd) { 345 | WinGetTitle, title, ahk_id %parent% 346 | ControlGetText, text, , ahk_id %Hwnd% 347 | Whwnd := pObj.AccObj.WinID 348 | class := GetClassNN(Hwnd,Whwnd) 349 | ControlGetPos, posX, posY, posW, posH, , ahk_id %Hwnd% 350 | WinGet, proc, ProcessName, ahk_id %parent% 351 | WinGet, procid, PID, ahk_id %parent% 352 | } 353 | else 354 | { 355 | WinGetTitle, title, ahk_id %Hwnd% 356 | WinGetText, text, ahk_id %Hwnd% 357 | WinGetClass, class, ahk_id %Hwnd% 358 | WinGetPos, posX, posY, posW, posH, ahk_id %Hwnd% 359 | WinGet, proc, ProcessName, ahk_id %Hwnd% 360 | WinGet, procid, PID, ahk_id %Hwnd% 361 | } 362 | GuiControl, , WinTitle, %title% 363 | GuiControl, , Text, %text% 364 | SetFormat, IntegerFast, H 365 | GuiControl, , Hwnd, % Hwnd+0 366 | SetFormat, IntegerFast, D 367 | GuiControl, , Class, %class% 368 | GuiControl, , Position, x%posX% y%posY% 369 | GuiControl, , Size, w%posW% h%posH% 370 | GuiControl, , Process, %proc% 371 | GuiControl, , ProcId, %procid% 372 | 373 | UpdateAccInfo(Acc, ChildId) 374 | SB_SetText("Path: " GetAccPath(Acc).path, 2) 375 | Gosub ShowMainGui 376 | Gosub ShowStructure 377 | } 378 | GetAccInfo() { 379 | global Whwnd 380 | static ShowButtonEnabled 381 | MouseGetPos, , , Whwnd 382 | if (Whwnd!=Win.Main and Whwnd!=Win.Acc) { 383 | { 384 | GuiControlGet, SectionLabel, , WinCtrl 385 | if (SectionLabel != "Window/Control Info") 386 | GuiControl, , WinCtrl, Window/Control Info 387 | } 388 | Acc := Acc_ObjectFromPoint(ChildId) 389 | Location := GetAccLocation(Acc, ChildId) 390 | if Stored.Location != Location { 391 | Hwnd := Acc_WindowFromObject(Acc) 392 | if Stored.Hwnd != Hwnd { 393 | if parent := DllCall("GetParent", Uint,hwnd) { 394 | WinGetTitle, title, ahk_id %parent% 395 | ControlGetText, text, , ahk_id %Hwnd% 396 | class := GetClassNN(Hwnd,Whwnd) 397 | ControlGetPos, posX, posY, posW, posH, , ahk_id %Hwnd% 398 | WinGet, proc, ProcessName, ahk_id %parent% 399 | WinGet, procid, PID, ahk_id %parent% 400 | } 401 | else { 402 | WinGetTitle, title, ahk_id %Hwnd% 403 | WinGetText, text, ahk_id %Hwnd% 404 | WinGetClass, class, ahk_id %Hwnd% 405 | WinGetPos, posX, posY, posW, posH, ahk_id %Hwnd% 406 | WinGet, proc, ProcessName, ahk_id %Hwnd% 407 | WinGet, procid, PID, ahk_id %Hwnd% 408 | } 409 | { 410 | GuiControl, , WinTitle, %title% 411 | GuiControl, , Text, %text% 412 | SetFormat, IntegerFast, H 413 | GuiControl, , Hwnd, % Hwnd+0 414 | SetFormat, IntegerFast, D 415 | GuiControl, , Class, %class% 416 | GuiControl, , Position, x%posX% y%posY% 417 | GuiControl, , Size, w%posW% h%posH% 418 | GuiControl, , Process, %proc% 419 | GuiControl, , ProcId, %procid% 420 | } 421 | Stored.Hwnd := Hwnd 422 | } 423 | UpdateAccInfo(Acc, ChildId) 424 | } 425 | } 426 | } 427 | UpdateAccInfo(Acc, ChildId, Obj_Path="") { 428 | global Whwnd 429 | Gui Main: Default 430 | Location := GetAccLocation(Acc, ChildId, x,y,w,h) 431 | { 432 | GuiControl, , AccName, % Acc.accName(ChildId) 433 | GuiControl, , AccValue, % Acc.accValue(ChildId) 434 | GuiControl, , AccRole, % Acc_GetRoleText(Acc.accRole(ChildId)) 435 | GuiControl, , AccState, % Acc_GetStateText(Acc.accState(ChildId)) 436 | GuiControl, , AccAction, % Acc.accDefaultAction(ChildId) 437 | GuiControl, , AccChildCount, % ChildId? "N/A":Acc.accChildCount 438 | GuiControl, , AccSelection, % ChildId? "N/A":Acc.accSelection 439 | GuiControl, , AccFocus, % ChildId? "N/A":Acc.accFocus 440 | GuiControl, , AccLocation, %Location% 441 | GuiControl, , AccDescription, % Acc.accDescription(ChildId) 442 | GuiControl, , AccKeyboard, % Acc.accKeyboardShortCut(ChildId) 443 | Guicontrol, , AccHelp, % Acc.accHelp(ChildId) 444 | GuiControl, , AccHelpTopic, % Acc.accHelpTopic(ChildId) 445 | SB_SetText(ChildId? "Child Id: " ChildId:"Object") 446 | SB_SetText(DllCall("IsWindowVisible", "Ptr",Win.Acc)? "Path: " Obj_Path:"", 2) 447 | } 448 | Border.Transparent(true) 449 | Border.show(x,y,x+w,y+h) 450 | Border.setabove(Whwnd) 451 | Border.Transparent(false) 452 | Stored.Location := Location 453 | } 454 | GetClassNN(Chwnd, Whwnd) { 455 | global _GetClassNN := {} 456 | _GetClassNN.Hwnd := Chwnd 457 | Detect := A_DetectHiddenWindows 458 | WinGetClass, Class, ahk_id %Chwnd% 459 | _GetClassNN.Class := Class 460 | DetectHiddenWindows, On 461 | EnumAddress := RegisterCallback("GetClassNN_EnumChildProc") 462 | DllCall("EnumChildWindows", "uint",Whwnd, "uint",EnumAddress) 463 | DetectHiddenWindows, %Detect% 464 | return, _GetClassNN.ClassNN, _GetClassNN:="" 465 | } 466 | GetClassNN_EnumChildProc(hwnd, lparam) { 467 | static Occurrence 468 | global _GetClassNN 469 | WinGetClass, Class, ahk_id %hwnd% 470 | if _GetClassNN.Class == Class 471 | Occurrence++ 472 | if Not _GetClassNN.Hwnd == hwnd 473 | return true 474 | else { 475 | _GetClassNN.ClassNN := _GetClassNN.Class Occurrence 476 | Occurrence := 0 477 | return false 478 | } 479 | } 480 | TV_Expanded(TVid) { 481 | For Each, TV_Child_ID in TVobj[TVid].Children 482 | if TVobj[TV_Child_ID].need_children 483 | TV_BuildAccChildren(TVobj[TV_Child_ID].obj, TV_Child_ID) 484 | } 485 | TV_BuildAccChildren(AccObj, Parent, Selected_Child="", Flag="") { 486 | TVobj[Parent].need_children := false 487 | Parent_Obj_Path := Trim(TVobj[Parent].Obj_Path, ",") 488 | for wach, child in Acc_Children(AccObj) { 489 | if Not IsObject(child) { 490 | added := TV_Add("[" A_Index "] " Acc_GetRoleText(AccObj.accRole(child)), Parent) 491 | TVobj[added] := {is_obj:false, obj:Acc, childid:child, Obj_Path:Parent_Obj_Path} 492 | if (child = Selected_Child) 493 | TV_Modify(added, "Select") 494 | } 495 | else { 496 | added := TV_Add("[" A_Index "] " Acc_Role(child), Parent, "bold") 497 | TVobj[added] := {is_obj:true, need_children:true, obj:child, childid:0, Children:[], Obj_Path:Trim(Parent_Obj_Path "," A_Index, ",")} 498 | } 499 | TVobj[Parent].Children.Insert(added) 500 | if (A_Index = Flag) 501 | Flagged_Child := added 502 | } 503 | return Flagged_Child 504 | } 505 | GetAccPath(Acc, byref hwnd="") { 506 | If !hwnd := Acc_WindowFromObject(Acc) 507 | return 508 | WinObj := Acc_ObjectFromWindow(hwnd) 509 | WinObjPos := Acc_Location(WinObj).pos 510 | while Acc_WindowFromObject(Parent:=Acc_Parent(Acc)) = hwnd { 511 | t2 := GetEnumIndex(Acc) "." t2 512 | if Acc_Location(Parent).pos = WinObjPos 513 | return {AccObj:Parent, Path:SubStr(t2,1,-1)} 514 | Acc := Parent 515 | } 516 | while Acc_WindowFromObject(Parent:=Acc_Parent(WinObj)) = hwnd 517 | t1.="P.", WinObj:=Parent 518 | return {AccObj:Acc, Path:t1 SubStr(t2,1,-1)} 519 | } 520 | GetEnumIndex(Acc, ChildId=0) { 521 | if Not ChildId { 522 | ChildPos := Acc_Location(Acc).pos 523 | For Each, child in Acc_Children(Acc_Parent(Acc)) 524 | if IsObject(child) and Acc_Location(child).pos=ChildPos 525 | return A_Index 526 | } 527 | else { 528 | ChildPos := Acc_Location(Acc,ChildId).pos 529 | For Each, child in Acc_Children(Acc) 530 | if Not IsObject(child) and Acc_Location(Acc,child).pos=ChildPos 531 | return A_Index 532 | } 533 | } 534 | GetAccLocation(AccObj, Child=0, byref x="", byref y="", byref w="", byref h="") { 535 | AccObj.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), Child) 536 | return "x" (x:=NumGet(x,0,"int")) " " 537 | . "y" (y:=NumGet(y,0,"int")) " " 538 | . "w" (w:=NumGet(w,0,"int")) " " 539 | . "h" (h:=NumGet(h,0,"int")) 540 | } 541 | WM_MOUSEMOVE() { 542 | static hCurs := new Cursor(32649) 543 | MouseGetPos,,,,ctrl 544 | if (ctrl = "msctls_statusbar321") 545 | DllCall("SetCursor","ptr",hCurs.ptr) 546 | } 547 | class Cursor { 548 | __New(id) { 549 | this.ptr := DllCall("LoadCursor","UInt",NULL,"Int",id,"UInt") 550 | } 551 | __delete() { 552 | DllCall("DestroyCursor","Uint",this.ptr) 553 | } 554 | } 555 | class Outline { 556 | __New(color="red") { 557 | Gui, +HWNDdefault 558 | Loop, 4 { 559 | Gui, New, -Caption +ToolWindow HWNDhwnd -DPIScale 560 | Gui, Color, %color% 561 | this[A_Index] := hwnd 562 | } 563 | this.visible := false 564 | this.color := color 565 | this.top := this[1] 566 | this.right := this[2] 567 | this.bottom := this[3] 568 | this.left := this[4] 569 | Gui, %default%: Default 570 | } 571 | Show(x1, y1, x2, y2, sides="TRBL") { 572 | Gui, +HWNDdefault 573 | if InStr( sides, "T" ) 574 | Gui, % this[1] ":Show", % "NA X" x1-2 " Y" y1-2 " W" x2-x1+4 " H" 2 575 | Else, Gui, % this[1] ":Hide" 576 | if InStr( sides, "R" ) 577 | Gui, % this[2] ":Show", % "NA X" x2 " Y" y1 " W" 2 " H" y2-y1 578 | Else, Gui, % this[2] ":Hide" 579 | if InStr( sides, "B" ) 580 | Gui, % this[3] ":Show", % "NA X" x1-2 " Y" y2 " W" x2-x1+4 " H" 2 581 | Else, Gui, % this[3] ":Hide" 582 | if InStr( sides, "L" ) 583 | Gui, % this[4] ":Show", % "NA X" x1-2 " Y" y1 " W" 2 " H" y2-y1 584 | Else, Gui, % this[3] ":Hide" 585 | self.visible := true 586 | Gui, %default%: Default 587 | } 588 | Hide() { 589 | Gui, +HWNDdefault 590 | Loop, 4 591 | Gui, % this[A_Index] ": Hide" 592 | self.visible := false 593 | Gui, %default%: Default 594 | } 595 | SetAbove(hwnd) { 596 | ABOVE := DllCall("GetWindow", "uint", hwnd, "uint", 3) 597 | Loop, 4 598 | DllCall( "SetWindowPos", "uint", this[A_Index], "uint", ABOVE 599 | , "int", 0, "int", 0, "int", 0, "int", 0 600 | , "uint", 0x1|0x2|0x10 ) 601 | } 602 | Transparent(param) { 603 | Loop, 4 604 | WinSet, Transparent, % param=1? 0:255, % "ahk_id" this[A_Index] 605 | self.visible := !param 606 | } 607 | Color(color) { 608 | Gui, +HWNDdefault 609 | Loop, 4 610 | Gui, % this[A_Index] ": Color" , %color% 611 | self.color := color 612 | Gui, %default%: Default 613 | } 614 | Destroy() { 615 | Loop, 4 616 | Gui, % this[A_Index] ": Destroy" 617 | } 618 | } 619 | CColor(Hwnd, Background="", Foreground="") { 620 | return CColor_(Background, Foreground, "", Hwnd+0) 621 | } 622 | CColor_(Wp, Lp, Msg, Hwnd) { 623 | static 624 | static WM_CTLCOLOREDIT=0x0133, WM_CTLCOLORLISTBOX=0x134, WM_CTLCOLORSTATIC=0x0138 625 | ,LVM_SETBKCOLOR=0x1001, LVM_SETTEXTCOLOR=0x1024, LVM_SETTEXTBKCOLOR=0x1026, TVM_SETTEXTCOLOR=0x111E, TVM_SETBKCOLOR=0x111D 626 | ,BS_CHECKBOX=2, BS_RADIOBUTTON=8, ES_READONLY=0x800 627 | ,CLR_NONE=-1, CSILVER=0xC0C0C0, CGRAY=0x808080, CWHITE=0xFFFFFF, CMAROON=0x80, CRED=0x0FF, CPURPLE=0x800080, CFUCHSIA=0xFF00FF,CGREEN=0x8000, CLIME=0xFF00, COLIVE=0x8080, CYELLOW=0xFFFF, CNAVY=0x800000, CBLUE=0xFF0000, CTEAL=0x808000, CAQUA=0xFFFF00 628 | ,CLASSES := "Button,ComboBox,Edit,ListBox,Static,RICHEDIT50W,SysListView32,SysTreeView32" 629 | If (Msg = "") { 630 | if !adrSetTextColor 631 | adrSetTextColor := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "Gdi32.dll"), "str", "SetTextColor") 632 | ,adrSetBkColor := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "Gdi32.dll"), "str", "SetBkColor") 633 | ,adrSetBkMode := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "Gdi32.dll"), "str", "SetBkMode") 634 | BG := !Wp ? "" : C%Wp% != "" ? C%Wp% : "0x" SubStr(WP,5,2) SubStr(WP,3,2) SubStr(WP,1,2) 635 | FG := !Lp ? "" : C%Lp% != "" ? C%Lp% : "0x" SubStr(LP,5,2) SubStr(LP,3,2) SubStr(LP,1,2) 636 | WinGetClass, class, ahk_id %Hwnd% 637 | If class not in %CLASSES% 638 | return A_ThisFunc "> Unsupported control class: " class 639 | ControlGet, style, Style, , , ahk_id %Hwnd% 640 | if (class = "Edit") && (Style & ES_READONLY) 641 | class := "Static" 642 | if (class = "Button") 643 | if (style & BS_RADIOBUTTON) || (style & BS_CHECKBOX) 644 | class := "Static" 645 | else 646 | return A_ThisFunc "> Unsupported control class: " class 647 | if (class = "ComboBox") { 648 | VarSetCapacity(CBBINFO, 52, 0), NumPut(52, CBBINFO), DllCall("GetComboBoxInfo", "UInt", Hwnd, "UInt", &CBBINFO) 649 | hwnd := NumGet(CBBINFO, 48) 650 | %hwnd%BG := BG, %hwnd%FG := FG, %hwnd% := BG ? DllCall("CreateSolidBrush", "UInt", BG) : -1 651 | IfEqual, CTLCOLORLISTBOX,,SetEnv, CTLCOLORLISTBOX, % OnMessage(WM_CTLCOLORLISTBOX, A_ThisFunc) 652 | If NumGet(CBBINFO,44) 653 | Hwnd := Numget(CBBINFO,44), class := "Edit" 654 | } 655 | if class in SysListView32,SysTreeView32 656 | { 657 | m := class="SysListView32" ? "LVM" : "TVM" 658 | SendMessage, %m%_SETBKCOLOR, ,BG, ,ahk_id %Hwnd% 659 | SendMessage, %m%_SETTEXTCOLOR, ,FG, ,ahk_id %Hwnd% 660 | SendMessage, %m%_SETTEXTBKCOLOR, ,CLR_NONE, ,ahk_id %Hwnd% 661 | return 662 | } 663 | if (class = "RICHEDIT50W") 664 | return f := "RichEdit_SetBgColor", %f%(Hwnd, -BG) 665 | if (!CTLCOLOR%Class%) 666 | CTLCOLOR%Class% := OnMessage(WM_CTLCOLOR%Class%, A_ThisFunc) 667 | return %Hwnd% := BG ? DllCall("CreateSolidBrush", "UInt", BG) : CLR_NONE, %Hwnd%BG := BG, %Hwnd%FG := FG 668 | } 669 | critical 670 | Hwnd := Lp + 0, hDC := Wp + 0 671 | If (%Hwnd%) { 672 | DllCall(adrSetBkMode, "uint", hDC, "int", 1) 673 | if (%Hwnd%FG) 674 | DllCall(adrSetTextColor, "UInt", hDC, "UInt", %Hwnd%FG) 675 | if (%Hwnd%BG) 676 | DllCall(adrSetBkColor, "UInt", hDC, "UInt", %Hwnd%BG) 677 | return (%Hwnd%) 678 | } 679 | } 680 | CrossHair(OnOff=1) { 681 | static AndMask, XorMask, $, h_cursor, IDC_CROSS := 32515 682 | ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 683 | , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 684 | , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 685 | if (OnOff = "Init" or OnOff = "I" or $ = "") { 686 | $ := "h" 687 | , VarSetCapacity( h_cursor,4444, 1 ) 688 | , VarSetCapacity( AndMask, 32*4, 0xFF ) 689 | , VarSetCapacity( XorMask, 32*4, 0 ) 690 | , system_cursors := "32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650" 691 | StringSplit c, system_cursors, `, 692 | Loop, %c0% 693 | h_cursor := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% ) 694 | , h%A_Index% := DllCall( "CopyImage", "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 ) 695 | , b%A_Index% := DllCall("LoadCursor", "Uint", "", "Int", IDC_CROSS, "Uint") 696 | } 697 | $ := (OnOff = 0 || OnOff = "Off" || $ = "h" && (OnOff < 0 || OnOff = "Toggle" || OnOff = "T")) ? "b" : "h" 698 | Loop, %c0% 699 | h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 ) 700 | , DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% ) 701 | } 702 | 703 | { ; Acc Library 704 | Acc_Init() 705 | { 706 | Static h 707 | If Not h 708 | h:=DllCall("LoadLibrary","Str","oleacc","Ptr") 709 | } 710 | Acc_ObjectFromEvent(ByRef _idChild_, hWnd, idObject, idChild) 711 | { 712 | Acc_Init() 713 | If DllCall("oleacc\AccessibleObjectFromEvent", "Ptr", hWnd, "UInt", idObject, "UInt", idChild, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0 714 | Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt") 715 | } 716 | Acc_ObjectFromPoint(ByRef _idChild_ = "", x = "", y = "") 717 | { 718 | Acc_Init() 719 | If DllCall("oleacc\AccessibleObjectFromPoint", "Int64", x==""||y==""?0*DllCall("GetCursorPos","Int64*",pt)+pt:x&0xFFFFFFFF|y<<32, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0 720 | Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt") 721 | } 722 | Acc_ObjectFromWindow(hWnd, idObject = 0) 723 | { 724 | Acc_Init() 725 | If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0 726 | Return ComObjEnwrap(9,pacc,1) 727 | } 728 | Acc_WindowFromObject(pacc) 729 | { 730 | If DllCall("oleacc\WindowFromAccessibleObject", "Ptr", IsObject(pacc)?ComObjValue(pacc):pacc, "Ptr*", hWnd)=0 731 | Return hWnd 732 | } 733 | Acc_GetRoleText(nRole) 734 | { 735 | nSize := DllCall("oleacc\GetRoleText", "Uint", nRole, "Ptr", 0, "Uint", 0) 736 | VarSetCapacity(sRole, (A_IsUnicode?2:1)*nSize) 737 | DllCall("oleacc\GetRoleText", "Uint", nRole, "str", sRole, "Uint", nSize+1) 738 | Return sRole 739 | } 740 | Acc_GetStateText(nState) 741 | { 742 | nSize := DllCall("oleacc\GetStateText", "Uint", nState, "Ptr", 0, "Uint", 0) 743 | VarSetCapacity(sState, (A_IsUnicode?2:1)*nSize) 744 | DllCall("oleacc\GetStateText", "Uint", nState, "str", sState, "Uint", nSize+1) 745 | Return sState 746 | } 747 | Acc_Role(Acc, ChildId=0) { 748 | try return ComObjType(Acc,"Name")="IAccessible"?Acc_GetRoleText(Acc.accRole(ChildId)):"invalid object" 749 | } 750 | Acc_State(Acc, ChildId=0) { 751 | try return ComObjType(Acc,"Name")="IAccessible"?Acc_GetStateText(Acc.accState(ChildId)):"invalid object" 752 | } 753 | Acc_Children(Acc) { 754 | if ComObjType(Acc,"Name")!="IAccessible" 755 | error_message := "Cause:`tInvalid IAccessible Object`n`n" 756 | else { 757 | Acc_Init() 758 | cChildren:=Acc.accChildCount, Children:=[] 759 | if DllCall("oleacc\AccessibleChildren", "Ptr", ComObjValue(Acc), "Int", 0, "Int", cChildren, "Ptr", VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*", cChildren)=0 { 760 | Loop %cChildren% 761 | i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=3?child:Acc_Query(child)), ObjRelease(child) 762 | return Children 763 | } 764 | } 765 | error:=Exception("",-1) 766 | MsgBox, 262148, Acc_Children Failed, % (error_message?error_message:"") "File:`t" (error.file==A_ScriptFullPath?A_ScriptName:error.file) "`nLine:`t" error.line "`n`nContinue Script?" 767 | IfMsgBox, No 768 | ExitApp 769 | } 770 | Acc_Location(Acc, ChildId=0) { 771 | try Acc.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId) 772 | catch 773 | return 774 | return {x:NumGet(x,0,"int"), y:NumGet(y,0,"int"), w:NumGet(w,0,"int"), h:NumGet(h,0,"int") 775 | , pos:"x" NumGet(x,0,"int")" y" NumGet(y,0,"int") " w" NumGet(w,0,"int") " h" NumGet(h,0,"int")} 776 | } 777 | Acc_Parent(Acc) { 778 | try parent:=Acc.accParent 779 | return parent?Acc_Query(parent): 780 | } 781 | Acc_Child(Acc, ChildId=0) { 782 | try child:=Acc.accChild(ChildId) 783 | return child?Acc_Query(child): 784 | } 785 | Acc_Query(Acc) { 786 | try return ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1) 787 | } 788 | } 789 | 790 | Anchor(i, a = "", r = false) { 791 | static c, cs = 12, cx = 255, cl = 0, g, gs = 8, gl = 0, gpi, gw, gh, z = 0, k = 0xffff, ptr 792 | If z = 0 793 | VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), ptr := A_PtrSize ? "Ptr" : "UInt", z := true 794 | If (!WinExist("ahk_id" . i)) { 795 | GuiControlGet, t, Hwnd, %i% 796 | If ErrorLevel = 0 797 | i := t 798 | Else ControlGet, i, Hwnd, , %i% 799 | } 800 | VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), ptr, &gi) 801 | , giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int") 802 | If (gp != gpi) { 803 | gpi := gp 804 | Loop, %gl% 805 | If (NumGet(g, cb := gs * (A_Index - 1)) == gp, "UInt") { 806 | gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1 807 | Break 808 | } 809 | If (!gf) 810 | NumPut(gp, g, gl, "UInt"), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs 811 | } 812 | ControlGetPos, dx, dy, dw, dh, , ahk_id %i% 813 | Loop, %cl% 814 | If (NumGet(c, cb := cs * (A_Index - 1), "UInt") == i) { 815 | If a = 816 | { 817 | cf = 1 818 | Break 819 | } 820 | giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short") 821 | , cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short") 822 | Loop, Parse, a, xywh 823 | If A_Index > 1 824 | av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField) 825 | , d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1) 826 | DllCall("SetWindowPos", "UInt", i, "UInt", 0, "Int", dx, "Int", dy 827 | , "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4) 828 | If r != 0 829 | DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) 830 | Return 831 | } 832 | If cf != 1 833 | cb := cl, cl += cs 834 | bx := NumGet(gi, 48, "UInt"), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52, "UInt") 835 | If cf = 1 836 | dw -= giw - gw, dh -= gih - gh 837 | NumPut(i, c, cb, "UInt"), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short") 838 | , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short") 839 | Return, true 840 | } 841 | -------------------------------------------------------------------------------- /Extra/AhkSpyZoom.ahk: -------------------------------------------------------------------------------- 1 | 2 | ; version = 1.46 3 | 4 | #NoEnv 5 | #NoTrayIcon 6 | #SingleInstance Ignore 7 | #KeyHistory 0 8 | 9 | hAhkSpy = %1% 10 | ActiveNoPause = %2% 11 | If !WinExist("ahk_id" hAhkSpy) 12 | ExitApp 13 | 14 | ListLines Off 15 | SetBatchLines,-1 16 | CoordMode, Mouse, Screen 17 | OnExit("ZoomOnClose") 18 | 19 | Global oZoom := {}, hAhkSpy, MsgAhkSpyZoom, ActiveNoPause 20 | OnMessage(0x0020, "WM_SETCURSOR") 21 | OnMessage(0x201, "LBUTTONDOWN") ; WM_LBUTTONDOWN 22 | OnMessage(0xA1, "LBUTTONDOWN") ; WM_NCLBUTTONDOWN 23 | OnMessage(0xF, "WM_Paint") 24 | ZoomCreate() 25 | OnMessage(MsgAhkSpyZoom := DllCall("RegisterWindowMessage", "Str", "MsgAhkSpyZoom"), "MsgZoom") 26 | PostMessage, % MsgAhkSpyZoom, 0, % oZoom.hGui, , ahk_id %hAhkSpy% 27 | SetWinEventHook("EVENT_OBJECT_DESTROY", 0x8001) 28 | SetWinEventHook("EVENT_OBJECT_LOCATIONCHANGE", 0x800B) 29 | SetWinEventHook("EVENT_SYSTEM_MINIMIZESTART", 0x0016, 0x0017) 30 | WinGet, Min, MinMax, % "ahk_id " hAhkSpy 31 | If Min != -1 32 | ZoomShow() 33 | SetTimer, CheckAhkSpy, 200 34 | Return 35 | 36 | #If oZoom.Show 37 | 38 | ^+#Up:: 39 | ^+#Down:: 40 | +#WheelUp:: 41 | +#WheelDown::ChangeZoom(InStr(A_ThisHotKey, "Down") ? oZoom.Zoom + 1 : oZoom.Zoom - 1) 42 | 43 | #If (!oZoom.AhkSpyPause && oZoom.Show && !IsMinimize(hAhkSpy)) 44 | 45 | +#Up::MouseStep(0, -1) 46 | +#Down::MouseStep(0, 1) 47 | +#Left::MouseStep(-1, 0) 48 | +#Right::MouseStep(1, 0) 49 | 50 | MouseStep(x, y) { 51 | MouseMove, x, y, 0, R 52 | If oZoom.Pause 53 | { 54 | SetTimer, Magnify, Off 55 | oZoom.Pause := 0, Magnify(), oZoom.Pause := 1 56 | SetTimer, Magnify, -30 57 | } 58 | PostMessage, % MsgAhkSpyZoom, 1, 0, , ahk_id %hAhkSpy% 59 | } 60 | 61 | #If 62 | 63 | ZoomCreate() { 64 | oZoom.Zoom := IniRead("MagnifyZoom", 8) 65 | oZoom.Mark := IniRead("MagnifyMark", "Cross") 66 | oZoom.MemoryZoomSize := IniRead("MemoryZoomSize", 0) 67 | oZoom.GuiMinW := 308 68 | oZoom.GuiMinH := 368 69 | If oZoom.MemoryZoomSize 70 | GuiW := IniRead("MemoryZoomSizeW", oZoom.GuiMinW), GuiH := IniRead("MemoryZoomSizeH", oZoom.GuiMinH) 71 | Else 72 | GuiW := oZoom.GuiMinW, GuiH := oZoom.GuiMinH 73 | Gui Zoom: +AlwaysOnTop -DPIScale +hwndhGui +LabelZoomOn -Caption +E0x08000000 +Border 74 | Gui, Zoom: Font, s12 75 | Gui, Zoom: Color, F0F0F0 76 | Gui, Zoom: Add, Slider, hwndhSliderZoom gSliderZoom x8 Range1-50 w176 Center AltSubmit NoTicks, % oZoom.Zoom 77 | Gui, Zoom: Add, Text, hwndhTextZoom Center x+10 yp+3 w36, % oZoom.Zoom 78 | Gui, Zoom: Font 79 | Gui, Zoom: Add, Button, hwndhChangeMark gChangeMark x+10 yp w52, % oZoom.Mark 80 | Gui, Zoom: Show, % "Hide w" GuiW " h" GuiH, AhkSpyZoom 81 | Gui, Zoom: +MinSize 82 | DllCall("SetClassLong", "Ptr", hGui, "int", -26 83 | , "int", DllCall("GetClassLong", "Ptr", hGui, "int", -26) | 0x20000) 84 | 85 | Gui, Dev: +HWNDhDev -Caption -DPIScale +Parent%hGui% +Border 86 | Gui, Dev: Add, Text, hwndhDevCon 87 | Gui, Dev: Show, NA 88 | Gui, Dev: Color, F0F0F0 89 | 90 | oZoom.hdcSrc := DllCall("GetDC", Ptr, "") 91 | oZoom.hdcDest := DllCall("GetDC", Ptr, hDevCon, Ptr) 92 | oZoom.hdcMemory := DllCall("CreateCompatibleDC", "Ptr", 0) 93 | DllCall("gdi32.dll\SetStretchBltMode", "Ptr", oZoom.hdcDest, "Int", 4) 94 | oZoom.hGui := hGui 95 | oZoom.hDev := hDev 96 | oZoom.hDevCon := hDevCon 97 | 98 | oZoom.vTextZoom := hTextZoom 99 | oZoom.vChangeMark := hChangeMark 100 | oZoom.vSliderZoom := hSliderZoom 101 | } 102 | 103 | ZoomShow() { 104 | oZoom.Show := 1 105 | Gui, Zoom: Show, NA 106 | oZoom.Pause ? 0 : Magnify(), ZoomMove() 107 | } 108 | 109 | ZoomHide() { 110 | oZoom.Show := 0 111 | oZoom.Pause := 1 112 | Gui, Zoom: Show, Hide 113 | } 114 | 115 | Magnify() { 116 | If (oZoom.Show && !oZoom.Pause && oZoom.SIZING != 2) 117 | { 118 | MouseGetPos, mX, mY, WinID 119 | If (WinID != oZoom.hGui && WinID != hAhkSpy) 120 | { 121 | SetTimer, Memory, Off 122 | oZoom.MouseX := mX, oZoom.MouseY := mY 123 | StretchBlt(oZoom.hdcDest, 0, 0, oZoom.nWidthDest, oZoom.nHeightDest 124 | , oZoom.hdcSrc, mX - oZoom.nXOriginSrcOffset, mY - oZoom.nYOriginSrcOffset, oZoom.nWidthSrc, oZoom.nHeightSrc) 125 | For k, v In oZoom.oMarkers[oZoom.Mark] 126 | StretchBlt(oZoom.hdcDest, v.x, v.y, v.w, v.h, oZoom.hdcDest, v.x, v.y, v.w, v.h, 0x5A0049) ; PATINVERT 127 | SetTimer, Memory, -30 128 | } 129 | } 130 | SetTimer, Magnify, -1 131 | } 132 | 133 | SetSize() { 134 | Static Top := 64, Left := 4, Right := 4, Bottom := 4, PrWidth, PrHeight 135 | SetTimer, Magnify, Off 136 | GetClientPos(oZoom.hGui, GuiWidth, GuiHeight) 137 | Width := GuiWidth - Left - Right 138 | Height := GuiHeight - Top - Bottom 139 | Zoom := oZoom.Zoom 140 | conW := Mod(Width, Zoom) ? Width - Mod(Width, Zoom) + Zoom : Width 141 | conW := Mod(conW // Zoom, 2) ? conW : conW + Zoom 142 | conH := Mod(Height, Zoom) ? Height - Mod(Height, Zoom) + Zoom : Height 143 | conH := Mod(conH // Zoom, 2) ? conH : conH + Zoom 144 | conX := ((conW - Width) // 2) * -1 145 | conY := ((conH - Height) // 2) * -1 146 | 147 | oZoom.nWidthSrc := conW // Zoom 148 | oZoom.nHeightSrc := conH // Zoom 149 | oZoom.nXOriginSrcOffset := oZoom.nWidthSrc//2 150 | oZoom.nYOriginSrcOffset := oZoom.nHeightSrc//2 151 | oZoom.nWidthDest := nWidthDest := conW 152 | oZoom.nHeightDest := nHeightDest := conH 153 | oZoom.xCenter := xCenter := conW / 2 - Zoom / 2 154 | oZoom.yCenter := yCenter := conH / 2 - Zoom / 2 155 | 156 | oZoom.oMarkers["Cross"] := [{x:0,y:yCenter - 1,w:nWidthDest,h:1} 157 | , {x:0,y:yCenter + Zoom,w:nWidthDest,h:1} 158 | , {x:xCenter - 1,y:0,w:1,h:nHeightDest} 159 | , {x:xCenter + Zoom,y:0,w:1,h:nHeightDest}] 160 | 161 | oZoom.oMarkers["Square"] := [{x:xCenter - 1,y:yCenter,w:Zoom + 2,h:1} 162 | , {x:xCenter - 1,y:yCenter + Zoom + 1,w:Zoom + 2,h:1} 163 | , {x:xCenter - 1,y:yCenter + 1,w:1,h:Zoom} 164 | , {x:xCenter + Zoom,y:yCenter + 1,w:1,h:Zoom}] 165 | 166 | oZoom.oMarkers["Grid"] := Zoom = 1 ? oZoom.oMarkers["Square"] 167 | : [{x:xCenter - Zoom,y:yCenter - Zoom,w:Zoom * 3,h:1} 168 | , {x:xCenter - Zoom,y:yCenter,w:Zoom * 3,h:1} 169 | , {x:xCenter - Zoom,y:yCenter + Zoom,w:Zoom * 3,h:1} 170 | , {x:xCenter - Zoom,y:yCenter + Zoom * 2,w:Zoom * 3,h:1} 171 | , {x:xCenter - Zoom,y:yCenter - Zoom,w:1,h:Zoom * 3} 172 | , {x:xCenter,y:yCenter - Zoom,w:1,h:Zoom * 3} 173 | , {x:xCenter + Zoom,y:yCenter - Zoom,w:1,h:Zoom * 3} 174 | , {x:xCenter + Zoom * 2,y:yCenter - Zoom,w:1,h:Zoom * 3}] 175 | 176 | SetWindowPos(oZoom.hDevCon, conX, conY, conW, conH) 177 | SetWindowPos(oZoom.hDev, Left, Top, Width, Height) 178 | Redraw() 179 | If (PrWidth != Width || PrHeight != Height) 180 | { 181 | PrWidth := Width, PrHeight := Height 182 | If oZoom.MemoryZoomSize 183 | IniWrite(GuiWidth, "MemoryZoomSizeW"), IniWrite(GuiHeight, "MemoryZoomSizeH") 184 | SetTimer, RedrawWindow, -100 185 | } 186 | SetTimer, Magnify, -10 187 | } 188 | 189 | SetWindowPos(hWnd, x, y, w, h) { 190 | Static SWP_ASYNCWINDOWPOS := 0x4000, SWP_DEFERERASE := 0x2000, SWP_NOACTIVATE := 0x0010, SWP_NOCOPYBITS := 0x0100 191 | , SWP_NOOWNERZORDER := 0x0200, SWP_NOREDRAW := 0x0008, SWP_NOSENDCHANGING := 0x0400 192 | DllCall("SetWindowPos" 193 | , "Ptr", hWnd 194 | , "Ptr", 0 195 | , "Int", x 196 | , "Int", y 197 | , "Int", w 198 | , "Int", h 199 | , "UInt", SWP_ASYNCWINDOWPOS|SWP_DEFERERASE|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOOWNERZORDER|SWP_NOREDRAW|SWP_NOSENDCHANGING) 200 | } 201 | 202 | RedrawWindow() { 203 | DllCall("RedrawWindow", "Ptr", oZoom.hGui, "Uint", 0, "Uint", 0, "Uint", 0x1|0x4) 204 | } 205 | 206 | ZoomMove() { 207 | If !oZoom.Show 208 | Return 209 | WinGetPos, WinX, WinY, WinWidth, WinHeight, ahk_id %hAhkSpy% 210 | Gui, Zoom:Show, % "x" WinX + WinWidth " y" WinY " NA" 211 | } 212 | 213 | SliderZoom() { 214 | GuiControlGet, SliderZoom, Zoom:, % oZoom.vSliderZoom 215 | ChangeZoom(SliderZoom) 216 | } 217 | 218 | ChangeZoom(Val) { 219 | If (Val < 1 || Val > 50) 220 | Return 221 | SetTimer, Magnify, Off 222 | GuiControl, Zoom:, % oZoom.vTextZoom, % oZoom.Zoom := Val 223 | GuiControl, Zoom:, % oZoom.vSliderZoom, % oZoom.Zoom 224 | IniWrite(oZoom.Zoom, "MagnifyZoom") 225 | SetTimer, SetSize, -10 226 | } 227 | 228 | ChangeMark() { 229 | oZoom.Mark := ["Cross","Square","Grid","None"][{"Cross":2,"Square":3,"Grid":4,"None":1}[oZoom.Mark]] 230 | GuiControl, Zoom:, % oZoom.vChangeMark, % oZoom.Mark 231 | IniWrite(oZoom.Mark, "MagnifyMark") 232 | Redraw() 233 | } 234 | 235 | WM_Paint() { 236 | If A_GuiControl = 237 | SetTimer, Redraw, -10 238 | } 239 | 240 | Memory() { 241 | SysGet, VirtualScreenX, 76 242 | SysGet, VirtualScreenY, 77 243 | SysGet, VirtualScreenWidth, 78 244 | SysGet, VirtualScreenHeight, 79 245 | oZoom.nXOriginSrc := oZoom.MouseX - VirtualScreenX, oZoom.nYOriginSrc := oZoom.MouseY - VirtualScreenY 246 | hBM := DllCall("Gdi32.Dll\CreateCompatibleBitmap", "Ptr", oZoom.hdcSrc, "Int", VirtualScreenWidth, "Int", VirtualScreenHeight) 247 | DllCall("Gdi32.Dll\SelectObject", "Ptr", oZoom.hdcMemory, "Ptr", hBM), DllCall("DeleteObject", "Ptr", hBM) 248 | BitBlt(oZoom.hdcMemory, 0, 0, VirtualScreenWidth, VirtualScreenHeight, oZoom.hdcSrc, VirtualScreenX, VirtualScreenY) 249 | } 250 | 251 | Redraw() { 252 | StretchBlt(oZoom.hdcDest, 0, 0, oZoom.nWidthDest, oZoom.nHeightDest 253 | , oZoom.hdcMemory, oZoom.nXOriginSrc - oZoom.nXOriginSrcOffset, oZoom.nYOriginSrc - oZoom.nYOriginSrcOffset, oZoom.nWidthSrc, oZoom.nHeightSrc) 254 | For k, v In oZoom.oMarkers[oZoom.Mark] 255 | StretchBlt(oZoom.hdcDest, v.x, v.y, v.w, v.h, oZoom.hdcDest, v.x, v.y, v.w, v.h, 0x5A0049) ; PATINVERT 256 | } 257 | 258 | CheckAhkSpy() { 259 | WinGet, Min, MinMax, % "ahk_id " hAhkSpy 260 | If Min = 261 | ExitApp 262 | If (Min = -1 || (!ActiveNoPause && WinActive("ahk_id" hAhkSpy))) 263 | oZoom.Pause := 1 264 | } 265 | 266 | GetClientPos(hwnd, ByRef W, ByRef H) { 267 | VarSetCapacity(pwi, 60, 0), NumPut(60, pwi, 0, "UInt") 268 | DllCall("GetWindowInfo", "Ptr", hwnd, "UInt", &pwi) 269 | W := NumGet(pwi, 28, "int") - NumGet(pwi, 20, "int") 270 | H := NumGet(pwi, 32, "int") - NumGet(pwi, 24, "int") 271 | } 272 | 273 | IniRead(Key, Error := " ") { 274 | IniRead, Value, %A_AppData%\AhkSpy.ini, AhkSpy, %Key%, %Error% 275 | Return Value = "" ? Error : Value 276 | } 277 | 278 | IniWrite(Value, Key) { 279 | IniWrite, %Value%, %A_AppData%\AhkSpy.ini, AhkSpy, %Key% 280 | Return Value 281 | } 282 | 283 | IsMinimize(hwnd) { 284 | WinGet, Min, MinMax, % "ahk_id " hwnd 285 | If Min = -1 286 | Return 1 287 | } 288 | 289 | SetWinEventHook(EventProc, eventMin, eventMax = 0) { 290 | Return DllCall("SetWinEventHook" 291 | , "UInt", eventMin, "UInt", eventMax := !eventMax ? eventMin : eventMax 292 | , "Ptr", hmodWinEventProc := 0, "Ptr", lpfnWinEventProc := RegisterCallback(EventProc, "F") 293 | , "UInt", idProcess := 0, "UInt", idThread := 0 294 | , "UInt", dwflags := 0x0|0x2, "Ptr") ; WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS 295 | } 296 | 297 | BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster = 0xC000CA) { 298 | Return DllCall("Gdi32.Dll\BitBlt" 299 | , "Ptr", dDC 300 | , "Int", dx 301 | , "Int", dy 302 | , "Int", dw 303 | , "Int", dh 304 | , "Ptr", sDC 305 | , "Int", sx 306 | , "Int", sy 307 | , "Uint", Raster) 308 | } 309 | 310 | StretchBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, sw, sh, Raster = 0xC000CA) { 311 | Return DllCall("Gdi32.Dll\StretchBlt" 312 | , "Ptr", dDC 313 | , "Int", dx 314 | , "Int", dy 315 | , "Int", dw 316 | , "Int", dh 317 | , "Ptr", sDC 318 | , "Int", sx 319 | , "Int", sy 320 | , "Int", sw 321 | , "Int", sh 322 | , "Uint", Raster) 323 | } 324 | 325 | ; _________________________________________________ Events _________________________________________________ 326 | 327 | ZoomOnSize() { 328 | If A_EventInfo != 0 329 | Return 330 | SetTimer, SetSize, -10 331 | ZoomMove() 332 | } 333 | 334 | ZoomOnClose() { 335 | DllCall("gdi32.dll\DeleteDC", "Ptr", oZoom.hdcDest) 336 | DllCall("gdi32.dll\DeleteDC", "Ptr", oZoom.hdcSrc) 337 | DllCall("Gdi32.Dll\DeleteDC", "Ptr", oZoom.hdcMemory) 338 | RestoreCursors() 339 | ExitApp 340 | } 341 | 342 | ; wParam: 0 снять паузу, 1 пауза, 2 однократный зум, 3 hide, 4 show, 5 MemoryZoomSize, 6 MinSize, 7 пауза AhkSpy, 8 ActiveNoPause 343 | 344 | MsgZoom(wParam, lParam) { 345 | If wParam = 0 346 | oZoom.Pause := 0, Magnify() 347 | Else If wParam = 1 348 | oZoom.Pause := 1 349 | Else If wParam = 2 350 | { 351 | SetTimer, Magnify, Off 352 | S_Pause := oZoom.Pause, oZoom.Pause := 0, Magnify(), oZoom.Pause := S_Pause 353 | SetTimer, Magnify, -10 354 | } 355 | Else If wParam = 3 356 | ZoomHide() 357 | Else If wParam = 4 358 | ZoomShow() 359 | Else If wParam = 5 360 | { 361 | oZoom.MemoryZoomSize := lParam 362 | If lParam 363 | GetClientPos(oZoom.hGui, GuiWidth, GuiHeight) 364 | , IniWrite(GuiWidth, "MemoryZoomSizeW") 365 | , IniWrite(GuiHeight, "MemoryZoomSizeH") 366 | } 367 | Else If (wParam = 6 && oZoom.Show) 368 | Gui, Zoom:Show, % "NA w" oZoom.GuiMinW " h" oZoom.GuiMinH 369 | Else If wParam = 7 370 | oZoom.AhkSpyPause := lParam 371 | Else If wParam = 8 372 | ActiveNoPause := lParam 373 | } 374 | 375 | EVENT_OBJECT_DESTROY(hWinEventHook, event, hwnd) { 376 | If (idObject || idChild || hwnd != hAhkSpy) 377 | Return 378 | ExitApp 379 | } 380 | 381 | EVENT_OBJECT_LOCATIONCHANGE(hWinEventHook, event, hwnd) { 382 | If (idObject || idChild || hwnd != hAhkSpy) 383 | Return 384 | ZoomMove() 385 | } 386 | 387 | EVENT_SYSTEM_MINIMIZESTART(hWinEventHook, event, hwnd) { 388 | If (idObject || idChild || hwnd != hAhkSpy) 389 | Return 390 | oZoom.Pause := 1 391 | } 392 | 393 | ; _________________________________________________ Sizing _________________________________________________ 394 | 395 | WM_SETCURSOR(W, L, M, H) { 396 | Static SIZENWSE := DllCall("User32.dll\LoadCursor", "Ptr", NULL, "Int", 32642, "UPtr") 397 | , SIZENS := DllCall("User32.dll\LoadCursor", "Ptr", NULL, "Int", 32645, "UPtr") 398 | , SIZEWE := DllCall("User32.dll\LoadCursor", "Ptr", NULL, "Int", 32644, "UPtr") 399 | If (oZoom.SIZING = 2) 400 | Return 401 | If (W = oZoom.hGui) 402 | { 403 | MouseGetPos, mX, mY 404 | WinGetPos, WinX, WinY, WinW, WinH, % "ahk_id " oZoom.hDev 405 | If (mX > WinX && mY > WinY) 406 | { 407 | If (mX < WinX + WinW - 10) 408 | DllCall("User32.dll\SetCursor", "Ptr", SIZENS), oZoom.SIZINGType := "NS" 409 | Else If (mY < WinY + WinH) 410 | DllCall("User32.dll\SetCursor", "Ptr", SIZEWE), oZoom.SIZINGType := "WE" 411 | Else 412 | DllCall("User32.dll\SetCursor", "Ptr", SIZENWSE), oZoom.SIZINGType := "NWSE" 413 | Return oZoom.SIZING := 1 414 | } 415 | } 416 | Else 417 | oZoom.SIZING := 0, oZoom.SIZINGType := "" 418 | } 419 | 420 | LBUTTONDOWN(W, L, M, H) { 421 | If oZoom.SIZING 422 | { 423 | oZoom.SIZING := 2 424 | SetSystemCursor("SIZE" oZoom.SIZINGType) 425 | SetTimer, Sizing, -10 426 | KeyWait LButton 427 | SetTimer, Sizing, Off 428 | RestoreCursors() 429 | SetSize() 430 | oZoom.SIZING := 0, oZoom.SIZINGType := "" 431 | } 432 | } 433 | 434 | Sizing() { 435 | MouseGetPos, mX, mY 436 | WinGetPos, WinX, WinY, , , % "ahk_id " oZoom.hGui 437 | If (oZoom.SIZINGType = "NWSE" || oZoom.SIZINGType = "WE") 438 | Width := " w" (mX - WinX < oZoom.GuiMinW ? oZoom.GuiMinW : mX - WinX) 439 | If (oZoom.SIZINGType = "NWSE" || oZoom.SIZINGType = "NS") 440 | Height := " h" (mY - WinY < oZoom.GuiMinH ? oZoom.GuiMinH : mY - WinY) 441 | Gui, Zoom:Show, % "NA" Width . Height 442 | SetTimer, Sizing, -1 443 | } 444 | 445 | SetSystemCursor(CursorName, cx = 0, cy = 0) { 446 | Static SystemCursors := {ARROW:32512, IBEAM:32513, WAIT:32514, CROSS:32515, UPARROW:32516, SIZE:32640, ICON:32641, SIZENWSE:32642 447 | , SIZENESW:32643, SIZEWE:32644 ,SIZENS:32645, SIZEALL:32646, NO:32648, HAND:32649, APPSTARTING:32650, HELP:32651} 448 | Local CursorHandle, hImage, Name, ID 449 | If (CursorHandle := DllCall("LoadCursor", Uint, 0, Int, SystemCursors[CursorName])) 450 | For Name, ID in SystemCursors 451 | hImage := DllCall("CopyImage", Ptr, CursorHandle, Uint, 0x2, Int, cx, Int, cy, Uint, 0) 452 | , DllCall("SetSystemCursor", Ptr, hImage, Int, ID) 453 | } 454 | 455 | RestoreCursors() { 456 | Static SPI_SETCURSORS := 0x57 457 | DllCall("SystemParametersInfo", UInt, SPI_SETCURSORS, UInt, 0, UInt, 0, UInt, 0) 458 | } 459 | -------------------------------------------------------------------------------- /Extra/iWB2 Learner.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance Force 2 | #Persistent 3 | #NoEnv 4 | #NoTrayIcon 5 | ListLines Off 6 | SetBatchLines -1 7 | 8 | WM_ACTIVATE = 0x06 9 | WM_KILLFOCUS = 0x08 10 | WM_LBUTTONDOWN = 0x201 11 | WM_LBUTTONUP = 0x202 12 | Stored := object( "AppName", "iWB2 Learner" 13 | , "TextLabel", "InnerText" ) 14 | 15 | #NoEnv 16 | #NoTrayIcon 17 | #SingleInstance Force 18 | DetectHiddenWindows,on 19 | SetTitleMatchMode,slow 20 | SetTitleMatchMode,2 21 | 22 | 23 | ComObjError(false) 24 | OnMessage(WM_LBUTTONDOWN, "HandleMessage") 25 | OnExit, OnExitCleanup 26 | Menu, Main, Add, Show Parent Structure, ParentStructure 27 | 28 | Gui, Menu, Main 29 | Gui, Add, Edit, x61 y5 w255 h20 hwndTitleHwnd vTitle HWNDh1, 30 | Gui, Add, Edit, x61 y30 w255 h20 vURLL HWNDh2, 31 | Gui, Add, Edit, x36 y55 w50 h20 vEleIndex HWNDh3, 32 | Gui, Add, Edit, x120 y55 w90 h20 vEleName HWNDh4, 33 | Gui, Add, Edit, x226 y55 w90 h20 vEleIDs HWNDh5, 34 | Gui, Add, ListView, x6 y82 w310 h60 -LV0x10 AltSubmit vVarListView gSubListView NoSortHdr, % "Frame.#|index|name|id|" 35 | LV_ModifyCol(1, 65), LV_ModifyCol(2,49), LV_ModifyCol(3,87), LV_ModifyCol(4,87), LV_ModifyCol(2,"Center") 36 | Gui, Add, Edit, x11 y160 w302 h40 vhtml_text HWNDh6, 37 | Gui, Add, Edit, x10 y217 w302 h140 vhtml_value HWNDh7, 38 | Gui, Add, Text, x35 y7 w25 h20 +Center, Title 39 | Gui, Add, Text, x37 y33 w23 h20 +Center, Url 40 | Gui, Add, Text, x1 y56 w34 h20 +Center, Index 41 | Gui, Add, Text, x89 y57 w30 h21 +Center, Name 42 | Gui, Add, Text, x212 y58 w13 h20 +Center, ID 43 | Gui, Add, GroupBox, x6 y145 w310 h59 vText, InnerText 44 | Gui, Add, GroupBox, x6 y201 w310 h163 , OuterHTML 45 | Gui, Add, Text, x5 y3 w25 h26 Border gCrossHair ReadOnly HWNDh8 Border 46 | CColor(h8, "White") 47 | Gui, Add, Text, x5 y3 w25 h4 HWNDh9 Border 48 | CColor(h9, "0046D5") 49 | Gui, Add, Text, x8 y17 w19 h1 Border vHBar 50 | Gui, Add, Text, x17 y8 w1 h19 Border vVBar 51 | Gui, Font, S6 52 | Gui, Add, Text, x1 y32 w35 h26 +Center, DRAG CURSOR 53 | Gui, +AlwaysOnTop +Delimiter`n -DPIScale 54 | Gui, Show, Center h370 w322, % Stored.AppName 55 | Gui, +LastFoundExist 56 | WinSet, Redraw, , % "ahk_id" GuiWinHWND:=WinExist() 57 | ControlFocus, Static7, ahk_id %GuiWinHWND% 58 | Gui 2: +ToolWindow +AlwaysOnTop +Resize -DPIScale 59 | Gui 2: Add, TreeView, vTView R17 60 | Gui 2: Show, Hide, Parent Structure 61 | WinGetPos, , , 2GuiW, 2GuiH, % "ahk_id" 62 | . Stored.2GUIhwnd := WinExist("Parent Structure ahk_class AutoHotkeyGUI") 63 | Menu, RClickMenu, Add 64 | outline := Outline() 65 | Hotkey, ~LButton Up, Off 66 | return 67 | 68 | #vk53:: 69 | 70 | ComObjCreate("SAPI.SpVoice").Speak(Stored.textOfObj) 71 | return 72 | 73 | ~Lbutton Up:: 74 | 75 | Hotkey, ~LButton Up, Off 76 | Lbutton_Pressed := False 77 | if IsObject(Stored.BColor) 78 | Stored.BColor := "" 79 | else if Not CH { 80 | GuiControl, Show, HBar 81 | GuiControl, Show, VBar 82 | CrossHair(CH:=true) 83 | 84 | RemoveFocus() 85 | return 86 | } 87 | HandleMessage( p_w, p_l, p_m, p_hw ) { 88 | Gui, Submit, NoHide 89 | if (A_GuiControl = "VarListView") { 90 | global column_num 91 | VarSetCapacity( htinfo, 20 ) 92 | , DllCall( "RtlFillMemory", "uint", &htinfo, "uint", 1, "uchar", p_l & 0xFF ) 93 | , DllCall( "RtlFillMemory", "uint", &htinfo+1, "uint", 1, "uchar", ( p_l >> 8 ) & 0xFF ) 94 | , DllCall( "RtlFillMemory", "uint", &htinfo+4, "uint", 1, "uchar", ( p_l >> 16 ) & 0xFF ) 95 | , DllCall( "RtlFillMemory", "uint", &htinfo+5, "uint", 1, "uchar", ( p_l >> 24 ) & 0xFF ) 96 | SendMessage, 0x1000+57, 0, &htinfo,, ahk_id %p_hw% 97 | If ( ErrorLevel = -1 ) 98 | Return 99 | column_num := ( *( &htinfo+8 ) & 1 ) ? False : 1+*( &htinfo+16 ) 100 | } 101 | else if (%A_GuiControl% != "") { 102 | temp := clipboard := %A_GuiControl% 103 | ToolTip, % "clipboard= " (StrLen(temp) > 40 ? SubStr(temp,1,40) "..." : temp) 104 | SetTimer, RemoveToolTip, 1000 105 | } 106 | else if (A_GuiControl = "TView") { 107 | Acc_ObjectFromPoint(child).accSelect(0x3, child) 108 | Hotkey, ~LButton Up, On 109 | global Stored 110 | if TV_GetParent(TVsel:=TV_GetSelection()) { 111 | TV_GetText(text, TVsel) 112 | RegExMatch(text, "\d+", child) 113 | clicked := Stored.pelt.childNodes[child] 114 | } 115 | else { 116 | clicked := Stored.pelt 117 | Loop, % TV_GetDiffCount(Stored.TVitem, TVsel) 118 | clicked := clicked.parentNode 119 | } 120 | Stored.BColor := BCobj(clicked, "silver") 121 | } 122 | RemoveFocus() 123 | } 124 | IE_HtmlElement() { 125 | static IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}", IID_IHTMLWindow2 := "{332C4427-26CB-11D0-B483-00C04FD90119}" 126 | CoordMode, Mouse 127 | MouseGetPos, xpos, ypos,, hCtl, 3 128 | WinGetClass, sClass, ahk_id %hCtl% 129 | If Not sClass == "Internet Explorer_Server" 130 | || Not pdoc := ComObject(9,ComObjQuery(Acc_ObjectFromWindow(hCtl), IID_IHTMLWindow2, IID_IHTMLWindow2),1).document 131 | Return 132 | global outline, Stored, Frame := {} 133 | pwin := ComObject(9,ComObjQuery(pdoc, IID_IHTMLWindow2, IID_IHTMLWindow2),1) 134 | iWebBrowser2 := ComObject(9,ComObjQuery(pwin,IID_IWebBrowserApp,IID_IWebBrowserApp),1) 135 | if pelt := pwin.document.elementFromPoint( xpos-xorg:=pwin.screenLeft, ypos-yorg:=pwin.screenTop ) { 136 | Stored.LV := object() 137 | while (type:=pelt.tagName)="IFRAME" || type="FRAME" { 138 | selt .= A_Index ") **[sourceIndex]=" pelt.sourceindex " **[Name]= " pelt.name " **[ID]= " pelt.id "`n" 139 | , Stored.LV[A_Index, "C1"] := type "." A_Index 140 | , Stored.LV[A_Index, "C2"] := pelt.sourceindex 141 | , Stored.LV[A_Index, "C3"] := pelt.name 142 | , Stored.LV[A_Index, "C4"] := pelt.id 143 | , Frame[A_Index] := pelt 144 | , pwin := ComObject(9,ComObjQuery(pbrt:=pelt.contentWindow, IID_IHTMLWindow2, IID_IHTMLWindow2),1) 145 | , pdoc := pwin.document 146 | , Stored.LV[A_Index, "URL"] := pdoc.url 147 | , pbrt := pdoc.elementFromPoint( xpos-xorg+=pelt.getBoundingClientRect().left 148 | , ypos-yorg+=pelt.getBoundingClientRect().top ) 149 | , pelt := pbrt 150 | } 151 | pbrt := pelt.getBoundingClientRect() 152 | , l := pbrt.left 153 | , t := pbrt.top 154 | , r := pbrt.right 155 | , b := pbrt.bottom 156 | if Not outline.visible 157 | || (Stored.pelt.sourceIndex != pelt.sourceIndex) { 158 | if selt 159 | Frect := Frame[Frame.maxIndex()].getBoundingClientRect() 160 | , Frame.x1 := xorg 161 | , Frame.y1 := yorg 162 | , Frame.x2 := FRect.right+xorg 163 | , Frame.y2 := FRect.bottom+yorg 164 | else, 165 | Frame.x1:=Frame.y1:=Frame.x2:=Frame.y2:= "NA" 166 | outline.transparent(true) 167 | , outline.hide() 168 | , coord := GetCoord( Stored.x1 := l+xorg 169 | , Stored.y1 := t+yorg 170 | , Stored.x2 := r+xorg 171 | , Stored.y2 := b+yorg 172 | , iWebBrowser2.HWND ) 173 | , outline.show(coord.x1, coord.y1, coord.x2, coord.y2, coord.sides) 174 | , outline.setAbove( iWebBrowser2.HWND ) 175 | , outline.transparent( false ) 176 | } 177 | Sleep, 1 178 | if (Stored.selt != selt) { 179 | LV_Delete() 180 | Loop, % Stored.LV.MaxIndex() 181 | LV_Add( "" , Stored.LV[A_Index].C1 182 | , Stored.LV[A_Index].C2 183 | , Stored.LV[A_Index].C3 184 | , Stored.LV[A_Index].C4 ) 185 | Stored.selt := selt 186 | } 187 | Stored.pelt := pelt 188 | , Stored.LocationName := iWebBrowser2.LocationName 189 | , Stored.LocationURL := iWebBrowser2.LocationURL 190 | GoSub, UpdateGuiControls 191 | Gui, Show, NA, % Stored.AppName " :: <" Stored.pelt.tagName ">" 192 | } 193 | } 194 | CrossHair: 195 | { 196 | if (A_GuiEvent = "Normal") { 197 | SetBatchLines, -1 198 | Hotkey, ~LButton Up, On 199 | { 200 | GuiControl, Hide, HBar 201 | GuiControl, Hide, VBar 202 | CrossHair(CH:=false) 203 | } 204 | Lbutton_Pressed := True 205 | while, Lbutton_Pressed 206 | IE_HtmlElement() 207 | outline.hide() 208 | if Stored.pelt.tagName != "" 209 | Gui, Show, NA, % Stored.AppName " :: <" Stored.pelt.tagName "> [" GetTagIndex(Stored.pelt) "]" 210 | if WinVisible("ahk_id" Stored.2GUIhwnd) 211 | GoSub, ParentStructure 212 | SetBatchLines, 10ms 213 | } 214 | return 215 | } 216 | OnExitCleanup: 217 | { 218 | CrossHair(true) 219 | GuiClose: 220 | ExitApp 221 | } 222 | UpdateGuiControls: 223 | { 224 | SetBatchLines, -1 225 | Gui, 1: Default 226 | textOfObj := inpt(Stored.pelt) 227 | GuiControl, , Title, % Stored.LocationName 228 | GuiControl, , URLL, % Stored.LocationURL 229 | GuiControl, , EleIndex, % Stored.pelt.sourceindex 230 | GuiControl, , EleName, % Stored.pelt.name 231 | GuiControl, , EleIDs, % Stored.pelt.id 232 | if (Stored.textOfObj != textOfObj) 233 | GuiControl, , html_text, % Stored.textOfObj:=textOfObj 234 | if (Stored.outerHTML != (val:=Stored.pelt.outerHTML) ) 235 | GuiControl, , html_value, % Stored.outerHTML:=val 236 | textOfObj:=val:="" 237 | RemoveFocus() 238 | } 239 | SubListView: 240 | { 241 | if (A_GuiEvent = "Normal") { 242 | if (column_num = 1) 243 | LVselection := Stored.LV[A_EventInfo].url 244 | else, 245 | LV_GetText(LVselection, A_EventInfo, column_num) 246 | if LVselection { 247 | clipboard := LVSelection 248 | ToolTip, % "clipboard= " (StrLen(LVSelection) > 40 ? SubStr(LVSelection,1,40) "..." : LVSelection) 249 | SetTimer, RemoveToolTip, 1000 250 | } 251 | } 252 | Return 253 | } 254 | RemoveToolTip: 255 | { 256 | SetTimer, RemoveToolTip, off 257 | ToolTip 258 | return 259 | } 260 | ParentStructure: 261 | { 262 | { 263 | SetBatchLines, -1 264 | if Not Stored.pelt.tagName 265 | return 266 | nodes := object() 267 | elem := Stored.pelt 268 | Gui 2: Default 269 | TV_Delete() 270 | Loop { 271 | if A_Index != 1 272 | elem := elem.parentNode 273 | nodes.insert( 1, elem.tagName 274 | . (elem.id!=""? " id= """ elem.id """":"") 275 | . (elem.name!=""? " name= """ elem.name """":"") ) 276 | } Until, elem.tagName = "html" 277 | GuiControl, -Redraw, TView 278 | For, Each, item in nodes 279 | Stored.TVitem := TV_Add(item) 280 | nodes := Stored.pelt.childNodes 281 | Loop, % nodes.length { 282 | elem := nodes.item(A_Index-1) 283 | TV_Add("[" A_Index-1 "] " elem.tagName 284 | . (elem.id!=""? " id= """ elem.id """":"") 285 | . (elem.name!=""? " name= """ elem.name """":"") 286 | , Stored.TVitem ) 287 | } 288 | nodes:=elem:="" 289 | GuiControl, +Redraw, TView 290 | TV_Modify(Stored.TVitem, "Select Bold") 291 | if Not WinVisible("ahk_id" Stored.2GUIhwnd) { 292 | WinGetPos, x, y, w, , ahk_id %GuiWinHWND% 293 | WinMove, % "ahk_id" Stored.2GUIhwnd, 294 | , (x+w+2GuiW > A_ScreenWidth? x-2GuiW-5:x+w+5) 295 | , %y%, %2GuiW%, %2GuiH% 296 | WinShow, % "ahk_id" Stored.2GUIhwnd 297 | temp:="" 298 | } 299 | return 300 | } 301 | 2GuiClose: 302 | { 303 | Gui 2: Hide 304 | Gui 1: Default 305 | Stored.TVitem := "" 306 | return 307 | } 308 | 2GuiSize: 309 | { 310 | Anchor(TView, "wh") 311 | return 312 | } 313 | 2GuiContextMenu: 314 | { 315 | if (A_GuiControl = "TView") { 316 | Acc_ObjectFromPoint(child).accSelect(0x3, child) 317 | Menu, RClickMenu, DeleteAll 318 | TV_GetText(text, TV_GetSelection()) 319 | if RegExMatch(text, "id= ""\K[^""]+", ElemID) 320 | Menu, RClickMenu, Add, Copy ID, RClick 321 | if RegExMatch(text, "name= ""\K[^""]+", ElemName) 322 | Menu, RClickMenu, Add, Copy Name, RClick 323 | Menu, RClickMenu, Add, Use Element, RClick 324 | Menu, RClickMenu, Show 325 | } 326 | return 327 | } 328 | RClick: 329 | { 330 | Gui, 2: +OwnDialogs 331 | if (A_ThisMenuItem = "Copy ID") 332 | clipboard := ElemID 333 | else if (A_ThisMenuItem = "Copy Name") 334 | clipboard := ElemName 335 | else if (A_ThisMenuItem = "Use Element") { 336 | temp := Stored.pelt 337 | Gui, 2: Default 338 | if TV_GetParent(TVsel:=TV_GetSelection()) { 339 | TV_GetText(text, TVsel) 340 | RegExMatch(text, "\d+", child) 341 | Stored.pelt := Stored.pelt.childNodes[child] 342 | } 343 | else, 344 | Loop, % TV_GetDiffCount(Stored.TVitem, TVsel) 345 | Stored.pelt := Stored.pelt.parentNode 346 | if Not Stored.pelt.sourceIndex { 347 | MsgBox, 262160, Selection Error, Cannot access this element. 348 | Stored.pelt := temp 349 | } 350 | else { 351 | Gui, 1: Default 352 | Gui, Show, NA, % Stored.AppName " :: <" Stored.pelt.tagName ">" 353 | . (Stored.pelt.tagName="HTML"? "":" [" GetTagIndex(Stored.pelt) "]") 354 | GoSub, UpdateGuiControls 355 | if WinVisible("ahk_id" Stored.2GUIhwnd) 356 | GoSub, ParentStructure 357 | } 358 | } 359 | ElemName:=ElemID:=TVsel:=child:=temp:="" 360 | return 361 | } 362 | } 363 | { 364 | Outline(color="red") { 365 | self := object( "base", object( "show", "Outline_Show" 366 | , "hide", "Outline_Hide" 367 | , "setAbove", "Outline_SetAbove" 368 | , "transparent", "Outline_Transparent" 369 | , "color", "Outline_Color" 370 | , "destroy", "Outline_Destroy" 371 | , "__delete", "Object_Delete" ) ) 372 | Loop, 4 { 373 | Gui, % A_Index+95 ": -Caption +ToolWindow -DPIScale" 374 | Gui, % A_Index+95 ": Color", %color% 375 | Gui, % A_Index+95 ": Show", NA h0 w0, outline%A_Index% 376 | self[A_Index] := WinExist("outline" A_Index " ahk_class AutoHotkeyGUI") 377 | } 378 | self.visible := false 379 | , self.color := color 380 | , self.top := self[1] 381 | , self.right := self[2] 382 | , self.bottom := self[3] 383 | , self.left := self[4] 384 | Return, self 385 | } 386 | Outline_Show(self, x1, y1, x2, y2, sides="TRBL") { 387 | if InStr( sides, "T" ) 388 | try Gui, 96:Show, % "NA X" x1-2 " Y" y1-2 " W" x2-x1+4 " H" 2,outline1 389 | Else, Gui, 96: Hide 390 | if InStr( sides, "R" ) 391 | Gui, 97:Show, % "NA X" x2 " Y" y1 " W" 2 " H" y2-y1,outline2 392 | Else, Gui, 97: Hide 393 | if InStr( sides, "B" ) 394 | Gui, 98:Show, % "NA X" x1-2 " Y" y2 " W" x2-x1+4 " H" 2,outline3 395 | Else, Gui, 98: Hide 396 | if InStr( sides, "L" ) 397 | try Gui, 99:Show, % "NA X" x1-2 " Y" y1 " W" 2 " H" y2-y1,outline4 398 | Else, Gui, 99: Hide 399 | self.visible := true 400 | } 401 | Outline_Hide(self) { 402 | Loop, 4 403 | Gui, % A_Index+95 ": Hide" 404 | self.visible := false 405 | } 406 | Outline_SetAbove(self, hwnd) { 407 | ABOVE := DllCall("GetWindow", "uint", hwnd, "uint", 0x3) 408 | Loop, 4 409 | DllCall( "SetWindowPos", "uint", self[ A_Index ], "uint", ABOVE 410 | , "int", 0, "int", 0, "int", 0, "int", 0 411 | , "uint", 0x1|0x2|0x10 ) 412 | } 413 | Outline_Transparent(self, param) { 414 | Loop, 4 415 | WinSet, Transparent, % param=1? 0:255, % "ahk_id" self[A_Index] 416 | self.visible := !param 417 | } 418 | Outline_Color(self, color) { 419 | Loop, 4 420 | Gui, % A_Index+95 ": Color" , %color% 421 | self.color := color 422 | } 423 | Outline_Destroy(self) { 424 | VarSetCapacity(self, 0) 425 | } 426 | Object_Delete() { 427 | Loop, 4 428 | Gui, % A_Index+95 ": Destroy" 429 | } 430 | } 431 | CrossHair(OnOff=1) { 432 | static AndMask, XorMask, $, h_cursor, IDC_CROSS := 32515 433 | ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 434 | , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 435 | , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 436 | if (OnOff = "Init" or OnOff = "I" or $ = "") { 437 | $ := "h" 438 | , VarSetCapacity( h_cursor,4444, 1 ) 439 | , VarSetCapacity( AndMask, 32*4, 0xFF ) 440 | , VarSetCapacity( XorMask, 32*4, 0 ) 441 | , system_cursors := "32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650" 442 | StringSplit c, system_cursors, `, 443 | Loop, %c0% 444 | h_cursor := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% ) 445 | , h%A_Index% := DllCall( "CopyImage", "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 ) 446 | , b%A_Index% := DllCall("LoadCursor", "Uint", "", "Int", IDC_CROSS, "Uint") 447 | } 448 | $ := (OnOff = 0 || OnOff = "Off" || $ = "h" && (OnOff < 0 || OnOff = "Toggle" || OnOff = "T")) ? "b" : "h" 449 | Loop, %c0% 450 | h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 ) 451 | , DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% ) 452 | } 453 | inpt(i) { 454 | global Stored 455 | tag := i.tagName 456 | if tag in BUTTON,INPUT,OPTION,SELECT,TEXTAREA 457 | { 458 | if (Stored.TextLabel = "InnerText") 459 | GuiControl, , Text, % Stored.TextLabel:="Value" 460 | return, i.value 461 | } 462 | if (Stored.TextLabel = "Value") 463 | GuiControl, , Text, % Stored.TextLabel:="InnerText" 464 | return, i.innerText 465 | } 466 | GetCoord( x1,y1,x2,y2, WinHWND ) { 467 | global Frame, outline 468 | WinGetPos, Wx, Wy, , , ahk_id %WinHWND% 469 | ControlGetPos, Cx1, Cy1, Cw, Ch, Internet Explorer_Server1, ahk_id %WinHWND% 470 | Cx1+=Wx 471 | , Cy1+=Wy 472 | , Cx2:=Cx1+Cw 473 | , Cy2:=Cy1+Ch 474 | Return, object( "x1", Value( x1,Cx1,Frame["x1"], ">" ) 475 | , "y1", Value( y1,Cy1,Frame["y1"], ">" ) 476 | , "x2", Value( x2,Cx2,Frame["x2"], "<" ) 477 | , "y2", Value( y2,Cy2,Frame["y2"], "<" ) 478 | , "sides", ( ElemCoord( y1,Cy1,Frame["y1"], ">" ) ? "T" : "" ) 479 | . ( ElemCoord( x2,Cx2,Frame["x2"], "<" ) ? "R" : "" ) 480 | . ( ElemCoord( y2,Cy2,Frame["y2"], "<" ) ? "B" : "" ) 481 | . ( ElemCoord( x1,Cx1,Frame["x1"], ">" ) ? "L" : "" ) ) 482 | } 483 | Value( E,C,F, option=">" ) { 484 | return, F+0=""? (option=">"? (E>=C? E:C) : (E<=C? E:C)) 485 | : (option=">"? (E>=C? (E>=F? E:F) : (C>=F? C:F)) : (E<=C? (E<=F? E:F) : (C<=F? C:F))) 486 | } 487 | ElemCoord( E,C,F, option=">" ) { 488 | return, F+0=""? (option=">"? (E>=C? 1:0):(E<=C? 1:0)) 489 | : (option=">"? (E>=C && E>=F? 1:0):(E<=C && E<=F? 1:0)) 490 | } 491 | GetTagIndex(element) { 492 | if IsMemberOf(element, "sourceIndex") 493 | and (index:=element.sourceIndex) 494 | and (tags:=element.ownerDocument.all.tags(element.tagName)) 495 | and (top:=tags.length, bottom:=0) 496 | Loop { 497 | test := Floor( (top+bottom)/2 ) 498 | i := tags[test].sourceIndex 499 | if (index < i) 500 | top := test 501 | else if (index > i) 502 | bottom := test 503 | else, 504 | return, test 505 | } 506 | } 507 | IsMemberOf(obj, name) { 508 | return, DllCall(NumGet(NumGet(1*p:=ComObjUnwrap(obj))+A_PtrSize*5) 509 | , "Ptr", p 510 | , "Ptr", VarSetCapacity(iid,16,0)*0+&iid 511 | , "Ptr*", &name 512 | , "UInt", 1 513 | , "UInt", 1024 514 | , "Int*", dispID)=0 515 | && dispID+1, ObjRelease(p) 516 | } 517 | TV_GetDiffCount(p1, p2) { 518 | count = 0 519 | while, p1 != p2 520 | p1 := TV_GetPrev(p1) 521 | , count++ 522 | return, count 523 | } 524 | WinVisible(WinTitle) { 525 | temp := A_DetectHiddenWindows 526 | DetectHiddenWindows, Off 527 | out := WinExist(WinTitle) 528 | DetectHiddenWindows, %temp% 529 | return, out 530 | } 531 | BCobj(elem, color) { 532 | static base := object("__delete","BCobj_Delete") 533 | return, object("elem",elem, "color",elem.style.backgroundColor, "base",base) 534 | , elem.style.backgroundColor := color 535 | } 536 | BCobj_Delete(self) { 537 | self.elem.style.backgroundColor := self.color 538 | } 539 | RemoveFocus() { 540 | global GuiWinHWND 541 | ControlGetFocus, focus, ahk_id %GuiWinHWND% 542 | if (SubStr(focus,1,4) == "Edit") { 543 | ControlGet, text, Selected, , %focus%, ahk_id %GuiWinHWND% 544 | if Not text 545 | ControlFocus, Static7, ahk_id %GuiWinHWND% 546 | } 547 | } 548 | CColor(Hwnd, Background="", Foreground="") { 549 | return CColor_(Background, Foreground, "", Hwnd+0) 550 | } 551 | CColor_(Wp, Lp, Msg, Hwnd) { 552 | static 553 | static WM_CTLCOLOREDIT=0x0133, WM_CTLCOLORLISTBOX=0x134, WM_CTLCOLORSTATIC=0x0138 554 | ,LVM_SETBKCOLOR=0x1001, LVM_SETTEXTCOLOR=0x1024, LVM_SETTEXTBKCOLOR=0x1026, TVM_SETTEXTCOLOR=0x111E, TVM_SETBKCOLOR=0x111D 555 | ,BS_CHECKBOX=2, BS_RADIOBUTTON=8, ES_READONLY=0x800 556 | ,CLR_NONE=-1, CSILVER=0xC0C0C0, CGRAY=0x808080, CWHITE=0xFFFFFF, CMAROON=0x80, CRED=0x0FF, CPURPLE=0x800080, CFUCHSIA=0xFF00FF,CGREEN=0x8000, CLIME=0xFF00, COLIVE=0x8080, CYELLOW=0xFFFF, CNAVY=0x800000, CBLUE=0xFF0000, CTEAL=0x808000, CAQUA=0xFFFF00 557 | ,CLASSES := "Button,ComboBox,Edit,ListBox,Static,RICHEDIT50W,SysListView32,SysTreeView32" 558 | If (Msg = "") { 559 | if !adrSetTextColor 560 | adrSetTextColor := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "Gdi32.dll"), "str", "SetTextColor") 561 | ,adrSetBkColor := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "Gdi32.dll"), "str", "SetBkColor") 562 | ,adrSetBkMode := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "Gdi32.dll"), "str", "SetBkMode") 563 | BG := !Wp ? "" : C%Wp% != "" ? C%Wp% : "0x" SubStr(WP,5,2) SubStr(WP,3,2) SubStr(WP,1,2) 564 | FG := !Lp ? "" : C%Lp% != "" ? C%Lp% : "0x" SubStr(LP,5,2) SubStr(LP,3,2) SubStr(LP,1,2) 565 | WinGetClass, class, ahk_id %Hwnd% 566 | If class not in %CLASSES% 567 | return A_ThisFunc "> Unsupported control class: " class 568 | ControlGet, style, Style, , , ahk_id %Hwnd% 569 | if (class = "Edit") && (Style & ES_READONLY) 570 | class := "Static" 571 | if (class = "Button") 572 | if (style & BS_RADIOBUTTON) || (style & BS_CHECKBOX) 573 | class := "Static" 574 | else return A_ThisFunc "> Unsupported control class: " class 575 | if (class = "ComboBox") { 576 | VarSetCapacity(CBBINFO, 52, 0), NumPut(52, CBBINFO), DllCall("GetComboBoxInfo", "UInt", Hwnd, "UInt", &CBBINFO) 577 | hwnd := NumGet(CBBINFO, 48) 578 | %hwnd%BG := BG, %hwnd%FG := FG, %hwnd% := BG ? DllCall("CreateSolidBrush", "UInt", BG) : -1 579 | IfEqual, CTLCOLORLISTBOX,,SetEnv, CTLCOLORLISTBOX, % OnMessage(WM_CTLCOLORLISTBOX, A_ThisFunc) 580 | If NumGet(CBBINFO,44) 581 | Hwnd := Numget(CBBINFO,44), class := "Edit" 582 | } 583 | if class in SysListView32,SysTreeView32 584 | { 585 | m := class="SysListView32" ? "LVM" : "TVM" 586 | SendMessage, %m%_SETBKCOLOR, ,BG, ,ahk_id %Hwnd% 587 | SendMessage, %m%_SETTEXTCOLOR, ,FG, ,ahk_id %Hwnd% 588 | SendMessage, %m%_SETTEXTBKCOLOR, ,CLR_NONE, ,ahk_id %Hwnd% 589 | return 590 | } 591 | if (class = "RICHEDIT50W") 592 | return f := "RichEdit_SetBgColor", %f%(Hwnd, -BG) 593 | if (!CTLCOLOR%Class%) 594 | CTLCOLOR%Class% := OnMessage(WM_CTLCOLOR%Class%, A_ThisFunc) 595 | return %Hwnd% := BG ? DllCall("CreateSolidBrush", "UInt", BG) : CLR_NONE, %Hwnd%BG := BG, %Hwnd%FG := FG 596 | } 597 | critical 598 | Hwnd := Lp + 0, hDC := Wp + 0 599 | If (%Hwnd%) { 600 | DllCall(adrSetBkMode, "uint", hDC, "int", 1) 601 | if (%Hwnd%FG) 602 | DllCall(adrSetTextColor, "UInt", hDC, "UInt", %Hwnd%FG) 603 | if (%Hwnd%BG) 604 | DllCall(adrSetBkColor, "UInt", hDC, "UInt", %Hwnd%BG) 605 | return (%Hwnd%) 606 | } 607 | } 608 | Acc_Init() 609 | { 610 | Static h 611 | If Not h 612 | h:=DllCall("LoadLibrary","Str","oleacc","Ptr") 613 | } 614 | Acc_ObjectFromEvent(ByRef _idChild_, hWnd, idObject, idChild) 615 | { 616 | Acc_Init() 617 | If DllCall("oleacc\AccessibleObjectFromEvent", "Ptr", hWnd, "UInt", idObject, "UInt", idChild, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0 618 | Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt") 619 | } 620 | Acc_ObjectFromPoint(ByRef _idChild_ = "", x = "", y = "") 621 | { 622 | Acc_Init() 623 | If DllCall("oleacc\AccessibleObjectFromPoint", "Int64", x==""||y==""?0*DllCall("GetCursorPos","Int64*",pt)+pt:x&0xFFFFFFFF|y<<32, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0 624 | Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt") 625 | } 626 | Acc_ObjectFromWindow(hWnd, idObject = 0) 627 | { 628 | Acc_Init() 629 | If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0 630 | Return ComObjEnwrap(9,pacc,1) 631 | } 632 | Acc_WindowFromObject(pacc) 633 | { 634 | If DllCall("oleacc\WindowFromAccessibleObject", "Ptr", IsObject(pacc)?ComObjValue(pacc):pacc, "Ptr*", hWnd)=0 635 | Return hWnd 636 | } 637 | Acc_GetRoleText(nRole) 638 | { 639 | nSize := DllCall("oleacc\GetRoleText", "Uint", nRole, "Ptr", 0, "Uint", 0) 640 | VarSetCapacity(sRole, (A_IsUnicode?2:1)*nSize) 641 | DllCall("oleacc\GetRoleText", "Uint", nRole, "str", sRole, "Uint", nSize+1) 642 | Return sRole 643 | } 644 | Acc_GetStateText(nState) 645 | { 646 | nSize := DllCall("oleacc\GetStateText", "Uint", nState, "Ptr", 0, "Uint", 0) 647 | VarSetCapacity(sState, (A_IsUnicode?2:1)*nSize) 648 | DllCall("oleacc\GetStateText", "Uint", nState, "str", sState, "Uint", nSize+1) 649 | Return sState 650 | } 651 | Acc_SetWinEventHook(eventMin, eventMax, pCallback) 652 | { 653 | Return DllCall("SetWinEventHook", "Uint", eventMin, "Uint", eventMax, "Uint", 0, "Ptr", pCallback, "Uint", 0, "Uint", 0, "Uint", 0) 654 | } 655 | Acc_UnhookWinEvent(hHook) 656 | { 657 | Return DllCall("UnhookWinEvent", "Ptr", hHook) 658 | } 659 | Acc_Role(Acc, ChildId=0) { 660 | try return ComObjType(Acc,"Name")="IAccessible"?Acc_GetRoleText(Acc.accRole(ChildId)):"invalid object" 661 | } 662 | Acc_State(Acc, ChildId=0) { 663 | try return ComObjType(Acc,"Name")="IAccessible"?Acc_GetStateText(Acc.accState(ChildId)):"invalid object" 664 | } 665 | Acc_Location(Acc, ChildId=0, byref Position="") { 666 | try Acc.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId) 667 | catch 668 | return 669 | Position := "x" NumGet(x,0,"int") " y" NumGet(y,0,"int") " w" NumGet(w,0,"int") " h" NumGet(h,0,"int") 670 | return {x:NumGet(x,0,"int"), y:NumGet(y,0,"int"), w:NumGet(w,0,"int"), h:NumGet(h,0,"int")} 671 | } 672 | Acc_Parent(Acc) { 673 | try parent:=Acc.accParent 674 | return parent?Acc_Query(parent): 675 | } 676 | Acc_Child(Acc, ChildId=0) { 677 | try child:=Acc.accChild(ChildId) 678 | return child?Acc_Query(child): 679 | } 680 | Acc_Query(Acc) { 681 | try return ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1) 682 | } 683 | Acc_Error(p="") { 684 | static setting:=0 685 | return p=""?setting:setting:=p 686 | } 687 | Acc_Children(Acc) { 688 | if ComObjType(Acc,"Name") != "IAccessible" 689 | ErrorLevel := "Invalid IAccessible Object" 690 | else { 691 | Acc_Init(), cChildren:=Acc.accChildCount, Children:=[] 692 | if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 { 693 | Loop %cChildren% 694 | i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child): 695 | return Children.MaxIndex()?Children: 696 | } else 697 | ErrorLevel := "AccessibleChildren DllCall Failed" 698 | } 699 | if Acc_Error() 700 | throw Exception(ErrorLevel,-1) 701 | } 702 | Acc_ChildrenByRole(Acc, Role) { 703 | if ComObjType(Acc,"Name")!="IAccessible" 704 | ErrorLevel := "Invalid IAccessible Object" 705 | else { 706 | Acc_Init(), cChildren:=Acc.accChildCount, Children:=[] 707 | if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 { 708 | Loop %cChildren% { 709 | i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i) 710 | if NumGet(varChildren,i-8)=9 711 | AccChild:=Acc_Query(child), ObjRelease(child), Acc_Role(AccChild)=Role?Children.Insert(AccChild): 712 | else 713 | Acc_Role(Acc, child)=Role?Children.Insert(child): 714 | } 715 | return Children.MaxIndex()?Children:, ErrorLevel:=0 716 | } else 717 | ErrorLevel := "AccessibleChildren DllCall Failed" 718 | } 719 | if Acc_Error() 720 | throw Exception(ErrorLevel,-1) 721 | } 722 | Acc_Get(Cmd, ChildPath="", ChildID=0, WinTitle="", WinText="", ExcludeTitle="", ExcludeText="") { 723 | static properties := {Action:"DefaultAction", DoAction:"DoDefaultAction", Keyboard:"KeyboardShortcut"} 724 | AccObj := IsObject(WinTitle)? WinTitle 725 | : Acc_ObjectFromWindow( WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText), 0 ) 726 | if ComObjType(AccObj, "Name") != "IAccessible" 727 | ErrorLevel := "Could not access an IAccessible Object" 728 | else { 729 | StringReplace, ChildPath, ChildPath, _, %A_Space%, All 730 | AccError:=Acc_Error(), Acc_Error(true) 731 | Loop Parse, ChildPath, ., %A_Space% 732 | try { 733 | if A_LoopField is digit 734 | Children:=Acc_Children(AccObj), m2:=A_LoopField 735 | else 736 | RegExMatch(A_LoopField, "(\D*)(\d*)", m), Children:=Acc_ChildrenByRole(AccObj, m1), m2:=(m2?m2:1) 737 | if Not Children.HasKey(m2) 738 | throw 739 | AccObj := Children[m2] 740 | } catch { 741 | ErrorLevel:="Cannot access ChildPath Item #" A_Index " -> " A_LoopField, Acc_Error(AccError) 742 | if Acc_Error() 743 | throw Exception("Cannot access ChildPath Item", -1, "Item #" A_Index " -> " A_LoopField) 744 | return 745 | } 746 | Acc_Error(AccError) 747 | StringReplace, Cmd, Cmd, %A_Space%, , All 748 | properties.HasKey(Cmd)? Cmd:=properties[Cmd]: 749 | try { 750 | if (Cmd = "Location") 751 | AccObj.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId) 752 | , ret_val := "x" NumGet(x,0,"int") " y" NumGet(y,0,"int") " w" NumGet(w,0,"int") " h" NumGet(h,0,"int") 753 | else if (Cmd = "Object") 754 | ret_val := AccObj 755 | else if Cmd in Role,State 756 | ret_val := Acc_%Cmd%(AccObj, ChildID+0) 757 | else if Cmd in ChildCount,Selection,Focus 758 | ret_val := AccObj["acc" Cmd] 759 | else 760 | ret_val := AccObj["acc" Cmd](ChildID+0) 761 | } catch { 762 | ErrorLevel := """" Cmd """ Cmd Not Implemented" 763 | if Acc_Error() 764 | throw Exception("Cmd Not Implemented", -1, Cmd) 765 | return 766 | } 767 | return ret_val, ErrorLevel:=0 768 | } 769 | if Acc_Error() 770 | throw Exception(ErrorLevel,-1) 771 | } 772 | Anchor(i, a = "", r = false) { 773 | static c, cs = 12, cx = 255, cl = 0, g, gs = 8, gl = 0, gpi, gw, gh, z = 0, k = 0xffff, ptr 774 | If z = 0 775 | VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), ptr := A_PtrSize ? "Ptr" : "UInt", z := true 776 | If (!WinExist("ahk_id" . i)) { 777 | GuiControlGet, t, Hwnd, %i% 778 | If ErrorLevel = 0 779 | i := t 780 | Else ControlGet, i, Hwnd, , %i% 781 | } 782 | VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), ptr, &gi) 783 | , giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int") 784 | If (gp != gpi) { 785 | gpi := gp 786 | Loop, %gl% 787 | If (NumGet(g, cb := gs * (A_Index - 1)) == gp, "UInt") { 788 | gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1 789 | Break 790 | } 791 | If (!gf) 792 | NumPut(gp, g, gl, "UInt"), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs 793 | } 794 | ControlGetPos, dx, dy, dw, dh, , ahk_id %i% 795 | Loop, %cl% 796 | If (NumGet(c, cb := cs * (A_Index - 1), "UInt") == i) { 797 | If a = 798 | { 799 | cf = 1 800 | Break 801 | } 802 | giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short") 803 | , cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short") 804 | Loop, Parse, a, xywh 805 | If A_Index > 1 806 | av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField) 807 | , d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1) 808 | DllCall("SetWindowPos", "UInt", i, "UInt", 0, "Int", dx, "Int", dy 809 | , "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4) 810 | If r != 0 811 | DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) 812 | Return 813 | } 814 | If cf != 1 815 | cb := cl, cl += cs 816 | bx := NumGet(gi, 48, "UInt"), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52, "UInt") 817 | If cf = 1 818 | dw -= giw - gw, dh -= gih - gh 819 | NumPut(i, c, cb, "UInt"), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short") 820 | , NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short") 821 | Return, true 822 | } 823 | -------------------------------------------------------------------------------- /Old/AhkSpy.ahk: -------------------------------------------------------------------------------- 1 | ; AhkSpy 2 | 3 | ; Автор - serzh82saratov 4 | ; E-Mail: serzh82saratov@mail.ru 5 | 6 | ; Спасибо wisgest за помощь в создании HTML интерфейса 7 | ; Также благодарность teadrinker, Malcev, YMP, Irbis за их решения 8 | ; Описание - http://forum.script-coding.com/viewtopic.php?pid=72459#p72459 9 | ; Обсуждение - http://forum.script-coding.com/viewtopic.php?pid=72244#p72244 10 | ; GitHub - https://github.com/serzh82saratov/AhkSpy/blob/master/AhkSpy.ahk 11 | 12 | #NoTrayIcon 13 | #SingleInstance Force 14 | #NoEnv 15 | SetBatchLines, -1 16 | ListLines, Off 17 | DetectHiddenWindows, On 18 | CoordMode, Pixel 19 | 20 | Global AhkSpyVersion := 2.52 21 | Gosub, CheckAhkVersion 22 | Menu, Tray, UseErrorLevel 23 | Menu, Tray, Icon, Shell32.dll, % A_OSVersion = "WIN_XP" ? 222 : 278 24 | 25 | Global ThisMode := "Mouse" ; Стартовый режим - Win|Mouse|Hotkey 26 | , MemoryFontSize := IniRead("MemoryFontSize", 0) 27 | , FontSize := MemoryFontSize ? IniRead("FontSize", "15") : 15 ; Размер шрифта 28 | , FontFamily := "Arial" ; Шрифт - Times New Roman | Georgia | Myriad Pro | Arial 29 | , ColorFont := "" ; Цвет шрифта 30 | , ColorBg := ColorBgOriginal := "F8F8F8" ; Цвет фона "F0F0F0" E4E4E4 31 | , ColorBgPaused := "F0F0F0" ; Цвет фона при паузе 32 | , ColorSelMouseHover := "#96C3DC" ; Цвет фона элемента при наведении мыши 33 | , ColorDelimiter := "E14B30" ; Цвет шрифта разделителя заголовков и параметров 34 | , ColorTitle := "27419B" ; Цвет шрифта заголовка 35 | , ColorParam := "189200" ; Цвет шрифта параметров 36 | , # := "▪" ; Символ разделителя заголовков - • | ▪ 37 | 38 | , DP := " " # " ", D1, D2, DB 39 | , copy_button := "" 40 | , ThisMode := IniRead("StartMode", "Mouse"), ThisMode := ThisMode = "LastMode" ? IniRead("LastMode", "Mouse") : ThisMode 41 | , ActiveNoPause := IniRead("ActiveNoPause", 0), MemoryPos := IniRead("MemoryPos", 0), MemorySize := IniRead("MemorySize", 0) 42 | , MemoryZoomSize := IniRead("MemoryZoomSize", 0), MemoryStateZoom := IniRead("MemoryStateZoom", 0), StateLight := IniRead("StateLight", 1) 43 | , StateLightAcc := IniRead("StateLightAcc", 1), SendCode := IniRead("SendCode", "vk"), StateLightMarker := IniRead("StateLightMarker", 1) 44 | , StateUpdate := IniRead("StateUpdate", 1), SendMode := IniRead("SendMode", "send"), SendModeStr := Format("{:L}", SendMode) 45 | , StateAllwaysSpot := IniRead("AllwaysSpot", 0), ScrollPos := {}, AccCoord := [], oOther := {}, oFind := {}, Edits := [], oMS := {} 46 | , hGui, hActiveX, hMarkerGui, hMarkerAccGui, hFindGui, oDoc, ShowMarker, isFindView, isIE, isPaused, w_ShowStyles, MsgAhkSpyZoom, Sleep 47 | , HTML_Win, HTML_Mouse, HTML_Hotkey, o_edithotkey, o_editkeyname, rmCtrlX, rmCtrlY, widthTB, HeigtButton, FullScreenMode 48 | , pause_button := "" 49 | , set_button_pos := " " : "" 71 | , m_run_iWB2Learner := ExtraFile("iWB2 Learner") 72 | ? DB " " : "" 73 | , m_run_AhkSpyZoom := ExtraFile("AhkSpyZoom") 74 | ? " " DB " " : "" 75 | FixIE() 76 | SeDebugPrivilege() 77 | 78 | Gui, +AlwaysOnTop +HWNDhGui +ReSize -DPIScale 79 | Gui, Color, %ColorBgPaused% 80 | Gui, Add, ActiveX, Border voDoc HWNDhActiveX x0 y+0, HTMLFile 81 | 82 | ComObjError(false), ComObjConnect(oDoc, Events) 83 | OnMessage(0x133, "WM_CTLCOLOREDIT") 84 | OnMessage(0x201, "WM_LBUTTONDOWN") 85 | OnMessage(0xA1, "WM_NCLBUTTONDOWN") 86 | OnMessage(0x7B, "WM_CONTEXTMENU") 87 | OnMessage(0x6, "WM_ACTIVATE") 88 | OnMessage(0x03, "WM_MOVE") 89 | OnMessage(0x05, "WM_SIZE") 90 | OnExit, Exit 91 | OnMessage(MsgAhkSpyZoom := DllCall("RegisterWindowMessage", "Str", "MsgAhkSpyZoom"), "MsgZoom") 92 | DllCall("RegisterShellHookWindow", "Ptr", A_ScriptHwnd) 93 | OnMessage(DllCall("RegisterWindowMessage", "str", "SHELLHOOK"), "ShellProc") 94 | DllCall("PostMessage", "Ptr", A_ScriptHWND, "UInt", 0x50, "UInt", 0, "UInt", 0x409) ; eng layout 95 | 96 | Gui, TB: +HWNDhTBGui -Caption -DPIScale +Parent%hGui% +E0x08000000 +0x40000000 -0x80000000 97 | Gui, TB: Font, % " s" (A_ScreenDPI = 120 ? 8 : 10), Verdana 98 | Gui, TB: Add, Button, x0 y0 h%HeigtButton% w%wKey% vBut1 gMode_Win, Window 99 | Gui, TB: Add, Button, x+0 yp hp wp vBut2 gMode_Mouse, Mouse && Control 100 | Gui, TB: Add, Progress, x+0 yp hp w%wColor% vColorProgress cWhite, 100 101 | Gui, TB: Add, Button, x+0 yp hp w%wKey% vBut3 gMode_Hotkey, Button 102 | Gui, TB: Show, % "x0 y0 NA h" HeigtButton " w" widthTB := wKey*3+wColor 103 | 104 | Gui, F: +HWNDhFindGui -Caption -DPIScale +Parent%hGui% +0x40000000 -0x80000000 105 | Gui, F: Color, %ColorBgPaused% 106 | Gui, F: Font, % " s" (A_ScreenDPI = 120 ? 10 : 12) 107 | Gui, F: Add, Edit, x1 y0 w180 h26 gFindNew WantTab HWNDhFindEdit 108 | SendMessage, 0x1501, 1, "Find to page",, ahk_id %hFindEdit% ; EM_SETCUEBANNER 109 | Gui, F: Add, UpDown, -16 Horz Range0-1 x+0 yp h26 w52 gFindNext vFindUpDown 110 | GuiControl, F: Move, FindUpDown, h26 w52 111 | Gui, F: Font, % (A_ScreenDPI = 120 ? "" : "s10") 112 | Gui, F: Add, Text, x+10 yp+1 h24 c2F2F2F +0x201 gFindOption, % " case sensitive " 113 | Gui, F: Add, Text, x+10 yp hp c2F2F2F +0x201 gFindOption, % " whole word " 114 | Gui, F: Add, Text, x+3 yp hp +0x201 w52 vFindMatches 115 | Gui, F: Add, Button, % "+0x300 +0xC00 y3 h20 w20 gFindHide x" widthTB - 21, X 116 | 117 | Gui, M: Margin, 0, 0 118 | Gui, M: -DPIScale +AlwaysOnTop +HWNDhMarkerGui +E0x08000000 +E0x20 -Caption +Owner +0x40000000 -0x80000000 119 | Gui, M: Color, E14B30 120 | WinSet, TransParent, 250, ahk_id %hMarkerGui% 121 | Gui, AcM: Margin, 0, 0 122 | Gui, AcM: -DPIScale +AlwaysOnTop +HWNDhMarkerAccGui +E0x08000000 +E0x20 -Caption +Owner +0x40000000 -0x80000000 123 | Gui, AcM: Color, 26419F 124 | WinSet, TransParent, 250, ahk_id %hMarkerAccGui% 125 | ShowMarker(0, 0, 0, 0, 0), ShowAccMarker(0, 0, 0, 0, 0), HideMarker(), HideAccMarker() 126 | 127 | Menu, Sys, Add, Backlight allways, Sys_Backlight 128 | Menu, Sys, Add, Backlight hold shift button, Sys_Backlight 129 | Menu, Sys, Add, Backlight disable, Sys_Backlight 130 | Menu, Sys, Check, % BLGroup[StateLight] 131 | Menu, Sys, Add 132 | Menu, Sys, Add, Window or control backlight, Sys_WClight 133 | Menu, Sys, % StateLightMarker ? "Check" : "UnCheck", Window or control backlight 134 | Menu, Sys, Add, Acc object backlight, Sys_Acclight 135 | Menu, Sys, % StateLightAcc ? "Check" : "UnCheck", Acc object backlight 136 | Menu, Sys, Add 137 | Menu, Sys, Add, Spot together (low speed), Spot_Together 138 | Menu, Sys, % StateAllwaysSpot ? "Check" : "UnCheck", Spot together (low speed) 139 | Menu, Sys, Add, Work with the active window, Active_No_Pause 140 | Menu, Sys, % ActiveNoPause ? "Check" : "UnCheck", Work with the active window 141 | Menu, Sys, Add 142 | If !A_IsCompiled 143 | { 144 | Menu, Sys, Add, Check updates, CheckUpdate 145 | Menu, Sys, % StateUpdate ? "Check" : "UnCheck", Check updates 146 | Menu, Sys, Add 147 | If StateUpdate 148 | SetTimer, UpdateAhkSpy, -1000 149 | } 150 | Else 151 | StateUpdate := IniWrite(0, "StateUpdate") 152 | Menu, Startmode, Add, Window, SelStartMode 153 | Menu, Startmode, Add, Mouse && Control, SelStartMode 154 | Menu, Startmode, Add, Button, SelStartMode 155 | Menu, Startmode, Add 156 | Menu, Startmode, Add, Last Mode, SelStartMode 157 | Menu, Sys, Add, Start mode, :Startmode 158 | Menu, Startmode, Check, % {"Win":"Window","Mouse":"Mouse && Control","Hotkey":"Button","LastMode":"Last Mode"}[IniRead("StartMode", "Mouse")] 159 | Menu, Sys, Add 160 | Menu, Sys, Add, Remember position, MemoryPos 161 | Menu, Sys, % MemoryPos ? "Check" : "UnCheck", Remember position 162 | Menu, Sys, Add, Remember size, MemorySize 163 | Menu, Sys, % MemorySize ? "Check" : "UnCheck", Remember size 164 | Menu, Sys, Add, Remember font size, MemoryFontSize 165 | Menu, Sys, % MemoryFontSize ? "Check" : "UnCheck", Remember font size 166 | 167 | If m_run_AhkSpyZoom != 168 | { 169 | Menu, Sys, Add 170 | Menu, Sys, Add, Remember state zoom, MemoryStateZoom 171 | Menu, Sys, % MemoryStateZoom ? "Check" : "UnCheck", Remember state zoom 172 | Menu, Sys, Add, Remember zoom size, MemoryZoomSize 173 | Menu, Sys, % MemoryZoomSize ? "Check" : "UnCheck", Remember zoom size 174 | } 175 | Menu, Sys, Add 176 | Menu, Sys, Add, Full screen, FullScreenMode 177 | Menu, Sys, Add, Default size, DefaultSize 178 | Menu, Sys, Add, Open script dir, Sys_OpenScriptDir 179 | Menu, Sys, Add 180 | Menu, Help, Add, About, Sys_Help 181 | Menu, Help, Add 182 | If FileExist(SubStr(A_AhkPath,1,InStr(A_AhkPath,"\",,0,1)) "AutoHotkey.chm") 183 | Menu, Help, Add, AutoHotKey help file, LaunchHelp 184 | Menu, Help, Add, AutoHotKey official help online, Sys_Help 185 | Menu, Help, Add, AutoHotKey russian help online, Sys_Help 186 | Menu, Sys, Add, Help, :Help 187 | Menu, Sys, Add 188 | Menu, Sys, Add, Reload, Reload 189 | Menu, Sys, Add, Suspend hotkeys, Suspend 190 | Menu, Sys, Add, Pause, PausedScript 191 | Menu, Sys, Add, Exit, Exit 192 | Menu, Sys, Add 193 | Menu, Sys, Add, Find to page, FindView 194 | Menu, Sys, Add, Word wrap, WordWrap 195 | Menu, Sys, % WordWrap ? "Check" : "UnCheck", Word wrap 196 | Menu, Sys, Color, % ColorBgOriginal 197 | Gui, Show, % "NA" (MemoryPos ? " x" IniRead("MemoryPosX", "Center") " y" IniRead("MemoryPosY", "Center") : "") 198 | . (MemorySize ? " h" IniRead("MemorySizeH", HeightStart) " w" IniRead("MemorySizeW", widthTB) : " h" HeightStart " w" widthTB) 199 | Gui, % "+MinSize" widthTB "x" HeigtButton 200 | 201 | Hotkey_Init("Write_Hotkey", "MLRJ") 202 | Gosub, Mode_%ThisMode% 203 | 204 | If (m_run_AhkSpyZoom != "" && MemoryStateZoom && IniRead("ZoomShow", 0)) 205 | AhkSpyZoomShow() 206 | 207 | #Include *i %A_ScriptDir%\AhkSpyInclude.ahk 208 | Return 209 | 210 | ; _________________________________________________ Hotkey`s _________________________________________________ 211 | 212 | #If ActiveNoPause 213 | 214 | +Tab:: Goto PausedScript 215 | 216 | #If (Sleep != 1 && !isPaused && ThisMode != "Hotkey") 217 | 218 | +Tab:: 219 | SpotProc: 220 | (ThisMode = "Mouse" ? (Spot_Mouse() (StateAllwaysSpot ? Spot_Win() : 0) Write_Mouse()) : (Spot_Win() (StateAllwaysSpot ? Spot_Mouse() : 0) Write_Win())) 221 | If !WinActive("ahk_id" hGui) 222 | { 223 | ZoomMsg(1) 224 | WinActivate ahk_id %hGui% 225 | GuiControl, 1:Focus, oDoc 226 | } 227 | Else 228 | ZoomMsg(2) 229 | Return 230 | 231 | #If ShowMarker && (StateLight = 3 || WinActive("ahk_id" hGui)) 232 | 233 | ~RShift Up:: 234 | ~LShift Up:: HideMarker(), HideAccMarker() 235 | 236 | #If Sleep != 1 237 | 238 | Break:: 239 | Pause:: 240 | PausedScript: 241 | isPaused := !isPaused 242 | oDoc.body.style.backgroundColor := (ColorBg := isPaused ? ColorBgPaused : ColorBgOriginal) 243 | Try SetTimer, Loop_%ThisMode%, % isPaused ? "Off" : "On" 244 | If (ThisMode = "Hotkey" && WinActive("ahk_id" hGui)) 245 | Hotkey_Hook(!isPaused) 246 | If (isPaused && !WinActive("ahk_id" hGui)) 247 | (ThisMode = "Mouse" ? Spot_Win() : ThisMode = "Win" ? Spot_Mouse() : 0) 248 | HideMarker(), HideAccMarker() 249 | Menu, Sys, % isPaused ? "Check" : "UnCheck", Pause 250 | ZoomMsg(isPaused || (!ActiveNoPause && WinActive("ahk_id" hGui)) ? 1 : 0) 251 | ZoomMsg(7, isPaused) 252 | isPaused ? TaskbarProgress(4, hGui, 100) : TaskbarProgress(0, hGui) 253 | Return 254 | 255 | ~RShift Up:: 256 | ~LShift Up:: CheckHideMarker() 257 | 258 | #If WinActive("ahk_id" hGui) 259 | 260 | ^WheelUp:: 261 | ^WheelDown:: 262 | FontSize := InStr(A_ThisHotkey, "Up") ? ++FontSize : --FontSize 263 | FontSize := FontSize < 1 ? 1 : FontSize > 32 ? 32 : FontSize 264 | oDoc.getElementById("pre").style.fontSize := FontSize 265 | TitleText("FontSize: " FontSize) 266 | IniWrite(FontSize, "FontSize") 267 | Return 268 | 269 | F1:: 270 | +WheelUp:: NextLink("-") 271 | 272 | F2:: 273 | +WheelDown:: NextLink() 274 | 275 | F3:: 276 | ~!WheelUp:: WheelLeft 277 | 278 | F4:: 279 | ~!WheelDown:: WheelRight 280 | 281 | F5:: oDoc.body.innerHTML := HTML_%ThisMode%, oDoc.body.scrollLeft := 0 ; Return original HTML 282 | 283 | F6:: AppsKey 284 | 285 | F7::Menu, Sys, Show, 5, 5 286 | 287 | !Space:: SetTimer, ShowSys, -1 288 | 289 | Esc:: 290 | If isFindView 291 | FindHide() 292 | Else If FullScreenMode 293 | FullScreenMode() 294 | Else 295 | GoSub, Exit 296 | Return 297 | 298 | F8:: 299 | ^vk46:: FindView() ; Ctrl+F 300 | 301 | F11::FullScreenMode() 302 | 303 | #If WinActive("ahk_id" hGui) && IsIEFocus() 304 | 305 | ^vk5A:: oDoc.execCommand("Undo") ; Ctrl+Z 306 | 307 | ^vk59:: oDoc.execCommand("Redo") ; Ctrl+Y 308 | 309 | ^vk43:: Clipboard := oDoc.selection.createRange().text ; Ctrl+C 310 | 311 | ^vk56:: oDoc.execCommand("Paste") ; Ctrl+V 312 | 313 | ~^vk41:: oDoc.execCommand("SelectAll") ; Ctrl+A 314 | 315 | ^vk58:: oDoc.execCommand("Cut") ; Ctrl+X 316 | 317 | Del:: oDoc.execCommand("Delete") ; Delete 318 | 319 | Enter:: oDoc.selection.createRange().text := " `n" ; ­ 320 | 321 | Tab:: oDoc.selection.createRange().text := " " ; &emsp 322 | 323 | #If (WinActive("ahk_id" hGui) && !Hotkey_Arr("Hook") && IsIEFocus()) 324 | 325 | #RButton:: ClipPaste() 326 | 327 | #If (Sleep != 1 && ThisMode != "Hotkey" && oMS.ELSel) && (oMS.ELSel.OuterText != "" || MS_Cancel()) 328 | 329 | RButton:: 330 | ^RButton:: 331 | ToolTip("copy", 300) 332 | CopyText := oMS.ELSel.OuterText 333 | If (A_ThisHotkey = "^RButton") 334 | CopyText := CopyCommaParam(CopyText) 335 | Clipboard := CopyText 336 | TitleText(CopyText) 337 | Return 338 | 339 | +RButton:: ClipAdd(CopyText := oMS.ELSel.OuterText, 1), TitleText(CopyText) 340 | ^+RButton:: ClipAdd(CopyText := CopyCommaParam(oMS.ELSel.OuterText), 1), TitleText(CopyText) 341 | 342 | #If (Sleep != 1 && oMS.ELSel) && (oMS.ELSel.OuterText != "" || MS_Cancel()) ; Mode = Hotkey 343 | 344 | RButton:: 345 | CopyText := oMS.ELSel.OuterText 346 | KeyWait, RButton, T0.3 347 | If ErrorLevel 348 | ClipAdd(CopyText, 1) 349 | Else 350 | Clipboard := CopyText, ToolTip("copy", 300) 351 | TitleText(CopyText) 352 | Return 353 | 354 | #If WinActive("ahk_id" hGui) && ExistSelectedText(CopyText) 355 | 356 | ^RButton:: 357 | RButton:: 358 | CopyText: 359 | ToolTip("copy", 300) 360 | If (A_ThisHotkey = "^RButton") 361 | CopyText := CopyCommaParam(CopyText) 362 | Clipboard := CopyText 363 | TitleText(CopyText) 364 | Return 365 | 366 | +RButton:: ClipAdd(CopyText, 1), TitleText(CopyText) 367 | ^+RButton:: ClipAdd(CopyText := CopyCommaParam(CopyText), 1), TitleText(CopyText) 368 | 369 | #If (Sleep != 1 && !DllCall("IsWindowVisible", "Ptr", oOther.hZoom)) 370 | 371 | +#Up::MouseStep(0, -1) 372 | +#Down::MouseStep(0, 1) 373 | +#Left::MouseStep(-1, 0) 374 | +#Right::MouseStep(1, 0) 375 | 376 | #If 377 | 378 | ; _________________________________________________ Mode_Win _________________________________________________ 379 | 380 | Mode_Win: 381 | If A_GuiControl 382 | GuiControl, 1:Focus, oDoc 383 | oDoc.body.createTextRange().execCommand("RemoveFormat") 384 | GuiControl, TB: -0x0001, But1 385 | If ThisMode = Win 386 | oDoc.body.scrollLeft := 0 387 | If (ThisMode = "Hotkey") 388 | Hotkey_Hook(0) 389 | Try SetTimer, Loop_%ThisMode%, Off 390 | ScrollPos[ThisMode,1] := oDoc.body.scrollLeft, ScrollPos[ThisMode,2] := oDoc.body.scrollTop 391 | If ThisMode != Win 392 | HTML_%ThisMode% := oDoc.body.innerHTML 393 | ThisMode := "Win" 394 | If (HTML_Win = "") 395 | Spot_Win(1) 396 | TitleText := "AhkSpy - Window" TitleTextP2 397 | SendMessage, 0xC, 0, &TitleText, , ahk_id %hGui% 398 | Write_Win(), oDoc.body.scrollLeft := ScrollPos[ThisMode,1], oDoc.body.scrollTop := ScrollPos[ThisMode,2] 399 | IniWrite(ThisMode, "LastMode") 400 | If isFindView 401 | FindSearch(1) 402 | 403 | Loop_Win: 404 | If ((WinActive("ahk_id" hGui) && !ActiveNoPause) || Sleep = 1) 405 | GoTo Repeat_Loop_Win 406 | If Spot_Win() 407 | Write_Win(), StateAllwaysSpot ? Spot_Mouse() : 0 408 | Repeat_Loop_Win: 409 | If !isPaused 410 | SetTimer, Loop_Win, -%RangeTimer% 411 | Return 412 | 413 | Spot_Win(NotHTML = 0) { 414 | Static PrWinPID, ComLine, WinProcessPath, ProcessBitSize, WinProcessName 415 | If NotHTML 416 | GoTo HTML_Win 417 | MouseGetPos,,,WinID 418 | If (WinID = hGui || WinID = oOther.hZoom) 419 | Return HideMarker(), HideAccMarker() 420 | WinGetTitle, WinTitle, ahk_id %WinID% 421 | WinTitle := TransformHTML(WinTitle) 422 | WinGetPos, WinX, WinY, WinWidth, WinHeight, ahk_id %WinID% 423 | WinX2 := WinX + WinWidth, WinY2 := WinY + WinHeight 424 | WinGetClass, WinClass, ahk_id %WinID% 425 | WinGet, WinPID, PID, ahk_id %WinID% 426 | If (WinPID != PrWinPID) { 427 | GetCommandLineProc(WinPID, ComLine, ProcessBitSize) 428 | ComLine := TransformHTML(ComLine), PrWinPID := WinPID 429 | WinGet, WinProcessPath, ProcessPath, ahk_pid %WinPID% 430 | Loop, %WinProcessPath% 431 | WinProcessPath = %A_LoopFileLongPath% 432 | SplitPath, WinProcessPath, WinProcessName 433 | } 434 | If (WinClass ~= "(Cabinet|Explore)WClass") 435 | CLSID := GetCLSIDExplorer(WinID) 436 | WinGet, WinCountProcess, Count, ahk_pid %WinPID% 437 | WinGet, WinStyle, Style, ahk_id %WinID% 438 | WinGet, WinExStyle, ExStyle, ahk_id %WinID% 439 | WinGet, WinTransparent, Transparent, ahk_id %WinID% 440 | If WinTransparent != 441 | WinTransparent := "`nTransparent: " WinTransparent "" 442 | WinGet, WinTransColor, TransColor, ahk_id %WinID% 443 | If WinTransColor != 444 | WinTransColor := (WinTransparent = "" ? "`n" : DP) "TransColor: " WinTransColor "" 445 | WinGet, CountControl, ControlListHwnd, ahk_id %WinID% 446 | RegExReplace(CountControl, "m`a)$", "", CountControl) 447 | GetClientPos(WinID, caX, caY, caW, caH) 448 | caWinRight := WinWidth - caW - caX , caWinBottom := WinHeight - caH - caY 449 | Loop 450 | { 451 | StatusBarGetText, SBFieldText, %A_Index%, ahk_id %WinID% 452 | If SBFieldText = 453 | Break 454 | SBFieldText := TransformHTML(SBFieldText "`r`n") 455 | SBText = %SBText%(%A_Index%): %SBFieldText% 456 | } 457 | If SBText != 458 | SBText := "`n" D1 " ( StatusBarText ) " DB " " copy_button " " D2 "`n" (SubStr(SBText, 1, -13) "") "" 459 | WinGetText, WinText, ahk_id %WinID% 460 | If WinText != 461 | WinText := "`n" D1 " ( Window Text ) " D2 "`n" TransformHTML(RTrim(WinText, "`r`n")) "" 462 | CoordMode, Mouse 463 | MouseGetPos, WinXS, WinYS 464 | PixelGetColor, ColorRGB, %WinXS%, %WinYS%, RGB 465 | GuiControl, TB: -Redraw, ColorProgress 466 | GuiControl, % "TB: +c" SubStr(ColorRGB, 3), ColorProgress 467 | GuiControl, TB: +Redraw, ColorProgress 468 | If w_ShowStyles 469 | WinStyles := GetStyles(WinStyle, WinExStyle), ButStyleTip := "hide styles" 470 | If WordWrap 471 | Break := "word-wrap: break-word;" 472 | 473 | HTML_Win: 474 | ButStyleTip := !w_ShowStyles ? "show styles" : ButStyleTip 475 | HTML_Win = 476 | ( Ltrim 477 |
 478 | 	%D1% ( Title ) %DB% %pause_button%%m_run_AhkSpyZoom% %D2%
 479 | 	%WinTitle%
 480 | 	%D1% ( Class ) %D2%
 481 | 	ahk_class %WinClass%
 482 | 	%D1% ( ProcessName ) %DB%  %D2%
 483 | 	ahk_exe %WinProcessName%
 484 | 	%D1% ( ProcessPath ) %DB%     %D2%
 485 | 	ahk_exe %WinProcessPath%
 486 | 	%D1% ( CommandLine ) %DB%   %D2%
 487 | 	%ComLine%
 488 | 	%D1% ( Position ) %D2%
 489 | 	%set_button_pos%Pos:  x%WinX% y%WinY%%DP%x²%WinX2% y²%WinY2%%DP%%set_button_pos%Size:  w%WinWidth% h%WinHeight%%DP%%WinX%, %WinY%, %WinX2%, %WinY2%%DP%%WinX%, %WinY%, %WinWidth%, %WinHeight%
 490 | 	Client area size:  w%caW% h%caH%%DP%left %caX% top %caY% right %caWinRight% bottom %caWinBottom%
 491 | 	%D1% ( Other ) %D2%
 492 | 	PID:  %WinPID%%DP%%ProcessBitSize%Window count this PID: %WinCountProcess%%DP%
 493 | 	HWND:  %WinID%%DP%%DP%Control count:  %CountControl%
 494 | 	Style:  %WinStyle%%DP%ExStyle:  %WinExStyle%%DP%%WinTransparent%%WinTransColor%%CLSID%%WinStyles%%SBText%%WinText%
 495 | 	%D2%
496 | 497 | 506 | ) 507 | oOther.WinPID := WinPID 508 | oOther.WinID := WinID 509 | If StateLightMarker && (ThisMode = "Win") && (StateLight = 1 || (StateLight = 3 && GetKeyState("Shift", "P"))) 510 | ShowMarker(WinX, WinY, WinWidth, WinHeight, 5) 511 | Return 1 512 | } 513 | 514 | Write_Win() { 515 | oDoc.body.innerHTML := HTML_Win, oDoc.getElementById("pre").style.fontSize := FontSize 516 | oDoc.getElementById("pre").style.wordWrap := WordWrap ? "break-word" : "normal" 517 | Return 1 518 | } 519 | 520 | ; _________________________________________________ Mode_Mouse _________________________________________________ 521 | 522 | Mode_Mouse: 523 | If A_GuiControl 524 | GuiControl, 1:Focus, oDoc 525 | oDoc.body.createTextRange().execCommand("RemoveFormat") 526 | GuiControl, TB: -0x0001, But2 527 | If (ThisMode = "Hotkey") 528 | Hotkey_Hook(0) 529 | If ThisMode = Mouse 530 | oDoc.body.scrollLeft := 0 531 | Try SetTimer, Loop_%ThisMode%, Off 532 | ScrollPos[ThisMode,1] := oDoc.body.scrollLeft, ScrollPos[ThisMode,2] := oDoc.body.scrollTop 533 | If ThisMode != Mouse 534 | HTML_%ThisMode% := oDoc.body.innerHTML 535 | ThisMode := "Mouse" 536 | If (HTML_Mouse = "") 537 | Spot_Mouse(1) 538 | TitleText := "AhkSpy - Mouse & Control" TitleTextP2 539 | SendMessage, 0xC, 0, &TitleText, , ahk_id %hGui% 540 | Write_Mouse(), oDoc.body.scrollLeft := ScrollPos[ThisMode,1], oDoc.body.scrollTop := ScrollPos[ThisMode,2] 541 | IniWrite(ThisMode, "LastMode") 542 | If isFindView 543 | FindSearch(1) 544 | 545 | Loop_Mouse: 546 | If (WinActive("ahk_id" hGui) && !ActiveNoPause) || Sleep = 1 547 | GoTo Repeat_Loop_Mouse 548 | If Spot_Mouse() 549 | Write_Mouse(), StateAllwaysSpot ? Spot_Win() : 0 550 | Repeat_Loop_Mouse: 551 | If !isPaused 552 | SetTimer, Loop_Mouse, -%RangeTimer% 553 | Return 554 | 555 | Spot_Mouse(NotHTML = 0) { 556 | If NotHTML 557 | GoTo HTML_Mouse 558 | WinGet, ProcessName_A, ProcessName, A 559 | WinGet, HWND_A, ID, A 560 | WinGetClass, WinClass_A, A 561 | CoordMode, Mouse 562 | MouseGetPos, MXS, MYS, WinID, tControlNN 563 | CoordMode, Mouse, Window 564 | MouseGetPos, MXWA, MYWA, , tControlID, 2 565 | If (WinID = hGui || WinID = oOther.hZoom) 566 | Return HideMarker(), HideAccMarker() 567 | CtrlInfo := "", isIE := 0 568 | ControlNN := tControlNN, ControlID := tControlID 569 | WinGetPos, WinX, WinY, , , ahk_id %WinID% 570 | RWinX := MXS - WinX, RWinY := MYS - WinY 571 | GetClientPos(WinID, caX, caY, caW, caH) 572 | MXC := RWinX - caX, MYC := RWinY - caY 573 | PixelGetColor, ColorBGR, %MXS%, %MYS% 574 | ColorRGB := Format("0x{:06X}", (ColorBGR & 0xFF) << 16 | (ColorBGR & 0xFF00) | (ColorBGR >> 16)) 575 | sColorBGR := SubStr(ColorBGR, 3) 576 | sColorRGB := SubStr(ColorRGB, 3) 577 | GuiControl, TB: -Redraw, ColorProgress 578 | GuiControl, % "TB: +c" sColorRGB, ColorProgress 579 | GuiControl, TB: +Redraw, ColorProgress 580 | WinGetPos, WinX2, WinY2, WinW, WinH, ahk_id %WinID% 581 | WithRespectWin := "`n" set_button_mouse_pos "Relative window: " 582 | . Round(RWinX / WinW, 4) ", " Round(RWinY / WinH, 4) " for w" WinW " h" WinH "" 583 | ControlGetPos, CtrlX, CtrlY, CtrlW, CtrlH,, ahk_id %ControlID% 584 | CtrlCAX := CtrlX - caX, CtrlCAY := CtrlY - caY 585 | CtrlX2 := CtrlX+CtrlW, CtrlY2 := CtrlY+CtrlH 586 | CtrlCAX2 := CtrlX2-caX, CtrlCAY2 := CtrlY2-caY 587 | WithRespectClient := set_button_mouse_pos "Relative client: " Round(MXC / caW, 4) ", " Round(MYC / caH, 4) 588 | . " for w" caW " h" caH "" 589 | ControlGetText, CtrlText, , ahk_id %ControlID% 590 | If CtrlText != 591 | CtrlText := "`n" D1 " ( Control Text ) " D2 "`n" TransformHTML(CtrlText) "" 592 | AccText := AccInfoUnderMouse(MXS, MYS, WinX, WinY, CtrlX, CtrlY) 593 | If AccText != 594 | AccText = `n%D1% ( AccInfo ) %m_run_AccViewer%%D2%%AccText% 595 | If ControlNN != 596 | { 597 | rmCtrlX := MXS - WinX - CtrlX, rmCtrlY := MYS - WinY - CtrlY 598 | ControlNN_Sub := RegExReplace(ControlNN, "S)\d+| ") 599 | If IsFunc("GetInfo_" ControlNN_Sub) 600 | { 601 | CtrlInfo := GetInfo_%ControlNN_Sub%(ControlID, ClassNN), ml_run_iWB2Learner := isIE ? m_run_iWB2Learner : "" 602 | If CtrlInfo != 603 | CtrlInfo = `n%D1% ( Info - %ClassNN% ) %ml_run_iWB2Learner%%D2%%CtrlInfo% 604 | } 605 | WithRespectControl := DP "" Round(rmCtrlX / CtrlW, 4) ", " Round(rmCtrlY / CtrlH, 4) "" 606 | } 607 | Else 608 | rmCtrlX := rmCtrlY := "" 609 | If (!isIE && ThisMode = "Mouse" && (StateLight = 1 || (StateLight = 3 && GetKeyState("Shift", "P")))) 610 | { 611 | StateLightMarker ? ShowMarker(WinX2+CtrlX, WinY2+CtrlY, CtrlW, CtrlH) : 0 612 | StateLightAcc ? ShowAccMarker(AccCoord[1], AccCoord[2], AccCoord[3], AccCoord[4]) : 0 613 | } 614 | ControlGet, CtrlStyle, Style,,, ahk_id %ControlID% 615 | ControlGet, CtrlExStyle, ExStyle,,, ahk_id %ControlID% 616 | WinGetClass, CtrlClass, ahk_id %ControlID% 617 | ControlGetFocus, CtrlFocus, ahk_id %WinID% 618 | WinGet, ProcessName, ProcessName, ahk_id %WinID% 619 | WinGetClass, WinClass, ahk_id %WinID% 620 | If WordWrap 621 | Break := "word-wrap: break-word;" 622 | 623 | HTML_Mouse: 624 | HTML_Mouse = 625 | ( Ltrim 626 |
 627 | 	%D1% ( Mouse ) %DB% %pause_button%%m_run_AhkSpyZoom% %D2%
 628 | 	%set_button_mouse_pos%Screen:  x%MXS% y%MYS%%DP%%set_button_mouse_pos%Window:  x%RWinX% y%RWinY%%DP%%set_button_mouse_pos%Client:  x%MXC% y%MYC%%WithRespectWin%%DP%%WithRespectClient%
 629 | 	Relative active window:  x%MXWA% y%MYWA%%DP%exe %ProcessName_A% class %WinClass_A% hwnd %HWND_A%
 630 | 	%D1% ( PixelGetColor ) %D2%
 631 | 	RGB:  %ColorRGB%%DP%#%sColorRGB%%DP%BGR:  %ColorBGR%%DP%#%sColorBGR%
 632 | 	%D1% ( Window: Class & Process & HWND ) %D2%
 633 | 	ahk_class %WinClass% ahk_exe %ProcessName% ahk_id %WinID%
 634 | 	%D1% ( Control ) %D2%
 635 | 	Class NN:  %ControlNN%%DP%Win class:  %CtrlClass%
 636 | 	%set_button_pos%Pos:  x%CtrlX% y%CtrlY%%DP%x²%CtrlX2% y²%CtrlY2%%DP%%set_button_pos%Size:  w%CtrlW% h%CtrlH%%DP%%CtrlX%, %CtrlY%, %CtrlX2%, %CtrlY2%%DP%%CtrlX%, %CtrlY%, %CtrlW%, %CtrlH%
 637 | 	Pos relative client area:  x%CtrlCAX% y%CtrlCAY%%DP%x²%CtrlCAX2% y²%CtrlCAY2%%DP%%CtrlCAX%, %CtrlCAY%, %CtrlCAX2%, %CtrlCAY2%%DP%%CtrlCAX%, %CtrlCAY%, %CtrlW%, %CtrlH%
 638 | 	%set_button_mouse_pos%Mouse relative control:  x%rmCtrlX% y%rmCtrlY%%WithRespectControl%%DP%Client area:  x%caX% y%caY% w%caW% h%caH%
 639 | 	HWND:  %ControlID%%DP%Style:  %CtrlStyle%%DP%ExStyle:  %CtrlExStyle%
 640 | 	%set_button_focus_ctrl%Focus control:  %CtrlFocus%%DP%Cursor type:  %A_Cursor%%DP%Caret pos:  x%A_CaretX% y%A_CaretY%%CtrlInfo%%CtrlText%%AccText%
 641 | 	%D2%
642 | 643 | 653 | ) 654 | oOther.MouseControlID := ControlID 655 | oOther.MouseWinID := WinID 656 | Return 1 657 | } 658 | 659 | Write_Mouse() { 660 | oDoc.body.innerHTML := HTML_Mouse, oDoc.getElementById("pre").style.fontSize := FontSize 661 | oDoc.getElementById("pre").style.wordWrap := WordWrap ? "break-word" : "normal" 662 | Return 1 663 | } 664 | 665 | ; _________________________________________________ Get Info Control _________________________________________________ 666 | 667 | GetInfo_SysListView(hwnd, ByRef ClassNN) { 668 | ClassNN := "SysListView32" 669 | ControlGet, ListText, List,,, ahk_id %hwnd% 670 | ControlGet, RowCount, List, Count,, ahk_id %hwnd% 671 | ControlGet, ColCount, List, Count Col,, ahk_id %hwnd% 672 | ControlGet, SelectedCount, List, Count Selected,, ahk_id %hwnd% 673 | ControlGet, FocusedCount, List, Count Focused,, ahk_id %hwnd% 674 | Return "`nRow count: " RowCount "" DP 675 | . "Column count: " ColCount "`n" 676 | . "Selected count: " SelectedCount "" DP 677 | . "Focused row: " FocusedCount "" 678 | . "`n" D1 " ( Content ) " D2 "`n" TransformHTML(ListText) "" 679 | } 680 | 681 | GetInfo_SysTreeView(hwnd, ByRef ClassNN) { 682 | ClassNN := "SysTreeView32" 683 | SendMessage 0x1105, 0, 0, , ahk_id %hwnd% ; TVM_GETCOUNT 684 | ItemCount := ErrorLevel 685 | Return "`nItem count: " ItemCount "" 686 | } 687 | 688 | GetInfo_ListBox(hwnd, ByRef ClassNN) { 689 | ClassNN = ListBox 690 | Return GetInfo_ComboBox(hwnd, "") 691 | } 692 | GetInfo_TListBox(hwnd, ByRef ClassNN) { 693 | ClassNN = TListBox 694 | Return GetInfo_ComboBox(hwnd, "") 695 | } 696 | GetInfo_TComboBox(hwnd, ByRef ClassNN) { 697 | ClassNN = TComboBox 698 | Return GetInfo_ComboBox(hwnd, "") 699 | } 700 | GetInfo_ComboBox(hwnd, ByRef ClassNN) { 701 | ClassNN = ComboBox 702 | ControlGet, ListText, List,,, ahk_id %hwnd% 703 | SendMessage, 0x147, 0, 0, , ahk_id %hwnd% ; CB_GETCURSEL 704 | SelPos := ErrorLevel 705 | SelPos := SelPos = 0xffffffff || SelPos < 0 ? "NoSelect" : SelPos + 1 706 | RegExReplace(ListText, "m`a)$", "", RowCount) 707 | Return "`nRow count: " RowCount "" DP 708 | . "Row selected: " SelPos "" 709 | . "`n" D1 " ( Content ) " D2 "`n" TransformHTML(ListText) "" 710 | } 711 | 712 | GetInfo_CtrlNotifySink(hwnd, ByRef ClassNN) { 713 | ClassNN = CtrlNotifySink 714 | Return GetInfo_Scintilla(hwnd, "") 715 | } 716 | 717 | ; http://forum.script-coding.com/viewtopic.php?pid=117128#p117128 718 | ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645478(v=vs.85).aspx 719 | 720 | GetInfo_Edit(hwnd, ByRef ClassNN) { 721 | ClassNN = Edit 722 | Return GetInfo_Scintilla(hwnd, "") "`nDlgCtrlID: " DllCall("GetDlgCtrlID", Ptr, hwnd) "" 723 | } 724 | 725 | GetInfo_Scintilla(hwnd, ByRef ClassNN) { 726 | ClassNN = Scintilla 727 | ControlGet, LineCount, LineCount,,, ahk_id %hwnd% 728 | ControlGet, CurrentCol, CurrentCol,,, ahk_id %hwnd% 729 | ControlGet, CurrentLine, CurrentLine,,, ahk_id %hwnd% 730 | ControlGet, Selected, Selected,,, ahk_id %hwnd% 731 | SendMessage, 0x00B0, , , , ahk_id %hwnd% ; EM_GETSEL 732 | EM_GETSEL := ErrorLevel >> 16 733 | SendMessage, 0x00CE, , , , ahk_id %hwnd% ; EM_GETFIRSTVISIBLELINE 734 | EM_GETFIRSTVISIBLELINE := ErrorLevel + 1 735 | ; Control_GetFont(hwnd, FName, FSize) 736 | Return "`nRow count: " LineCount "" DP 737 | . "Selected length: " StrLen(Selected) "" 738 | . "`nCurrent row: " CurrentLine "" DP 739 | . "Current column: " CurrentCol "" 740 | . "`nCurrent select: " EM_GETSEL "" DP 741 | . "First visible line: " EM_GETFIRSTVISIBLELINE "" 742 | ; . "`nFontSize: " FSize DP "FontName: " FName 743 | } 744 | 745 | Control_GetFont(hwnd, byref FontName, byref FontSize) { 746 | SendMessage 0x31, 0, 0, , ahk_id %hwnd% ; WM_GETFONT 747 | IfEqual, ErrorLevel, FAIL, Return 748 | hFont := Errorlevel, VarSetCapacity(LF, szLF := 60 * (A_IsUnicode ? 2 : 1)) 749 | DllCall("GetObject", UInt, hFont, Int, szLF, UInt, &LF) 750 | hDC := DllCall("GetDC", UInt,hwnd ), DPI := DllCall("GetDeviceCaps", UInt, hDC, Int, 90) 751 | DllCall("ReleaseDC", Int, 0, UInt, hDC), S := Round((-NumGet(LF, 0, "Int") * 72) / DPI) 752 | FontName := DllCall("MulDiv", Int, &LF + 28, Int, 1, Int, 1, Str) 753 | DllCall("SetLastError", UInt, S), FontSize := A_LastError 754 | } 755 | 756 | GetInfo_msctls_progress(hwnd, ByRef ClassNN) { 757 | ClassNN := "msctls_progress32" 758 | SendMessage, 0x0400+7,"TRUE",,, ahk_id %hwnd% ; PBM_GETRANGE 759 | PBM_GETRANGEMIN := ErrorLevel 760 | SendMessage, 0x0400+7,,,, ahk_id %hwnd% ; PBM_GETRANGE 761 | PBM_GETRANGEMAX := ErrorLevel 762 | SendMessage, 0x0400+8,,,, ahk_id %hwnd% ; PBM_GETPOS 763 | PBM_GETPOS := ErrorLevel 764 | Return "`nLevel: " PBM_GETPOS "" DP 765 | . "Range: Min: " PBM_GETRANGEMIN "" 766 | . " Max: " PBM_GETRANGEMAX "" 767 | } 768 | 769 | GetInfo_msctls_trackbar(hwnd, ByRef ClassNN) { 770 | ClassNN := "msctls_trackbar32" 771 | SendMessage, 0x0400+1,,,, ahk_id %hwnd% ; TBM_GETRANGEMIN 772 | TBM_GETRANGEMIN := ErrorLevel 773 | SendMessage, 0x0400+2,,,, ahk_id %hwnd% ; TBM_GETRANGEMAX 774 | TBM_GETRANGEMAX := ErrorLevel 775 | SendMessage, 0x0400,,,, ahk_id %hwnd% ; TBM_GETPOS 776 | TBM_GETPOS := ErrorLevel 777 | ControlGet, CtrlStyle, Style,,, ahk_id %hwnd% 778 | (!(CtrlStyle & 0x0200)) ? (TBS_REVERSED := "No") 779 | : (TBM_GETPOS := TBM_GETRANGEMAX - (TBM_GETPOS - TBM_GETRANGEMIN), TBS_REVERSED := "Yes") 780 | Return "`nLevel: " TBM_GETPOS "" DP 781 | . "Invert style:" TBS_REVERSED 782 | . "`nRange: Min: " TBM_GETRANGEMIN "" DP 783 | . "Max: " TBM_GETRANGEMAX "" 784 | } 785 | 786 | GetInfo_msctls_updown(hwnd, ByRef ClassNN) { 787 | ClassNN := "msctls_updown32" 788 | SendMessage, 0x0400+102,,,, ahk_id %hwnd% ; UDM_GETRANGE 789 | UDM_GETRANGE := ErrorLevel 790 | SendMessage, 0x400+114,,,, ahk_id %hwnd% ; UDM_GETPOS32 791 | UDM_GETPOS32 := ErrorLevel 792 | Return "`nLevel: " UDM_GETPOS32 "" DP 793 | . "Range: Min: " UDM_GETRANGE >> 16 "" 794 | . " Max: " UDM_GETRANGE & 0xFFFF "" 795 | } 796 | 797 | GetInfo_SysTabControl(hwnd, ByRef ClassNN) { 798 | ClassNN := "SysTabControl32" 799 | ControlGet, SelTab, Tab,,, ahk_id %hwnd% 800 | SendMessage, 0x1300+44,,,, ahk_id %hwnd% ; TCM_GETROWCOUNT 801 | TCM_GETROWCOUNT := ErrorLevel 802 | SendMessage, 0x1300+4,,,, ahk_id %hwnd% ; TCM_GETITEMCOUNT 803 | TCM_GETITEMCOUNT := ErrorLevel 804 | Return "`nItem count: " TCM_GETITEMCOUNT "" DP 805 | . "Row count: " TCM_GETROWCOUNT "" DP 806 | . "Selected item: " SelTab "" 807 | } 808 | 809 | GetInfo_ToolbarWindow(hwnd, ByRef ClassNN) { 810 | ClassNN := "ToolbarWindow32" 811 | SendMessage, 0x0418,,,, ahk_id %hwnd% ; TB_BUTTONCOUNT 812 | BUTTONCOUNT := ErrorLevel 813 | Return "`nButton count: " BUTTONCOUNT "" 814 | } 815 | 816 | ; _________________________________________________ Get Internet Explorer Info _________________________________________________ 817 | 818 | ; http://www.autohotkey.com/board/topic/84258-iwb2-learner-iwebbrowser2/ 819 | 820 | GetInfo_AtlAxWin(hwnd, ByRef ClassNN) { 821 | ClassNN = AtlAxWin 822 | Return GetInfo_InternetExplorer_Server(hwnd, "") 823 | } 824 | 825 | GetInfo_InternetExplorer_Server(hwnd, ByRef ClassNN) { 826 | Static IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}" 827 | , ratios := [], IID_IHTMLWindow2 := "{332C4427-26CB-11D0-B483-00C04FD90119}" 828 | 829 | isIE := 1, ClassNN := "Internet Explorer_Server" 830 | MouseGetPos, , , , hwnd, 3 831 | If !(pwin := WBGet(hwnd)) 832 | Return 833 | If !ratios[hwnd] 834 | { 835 | ratio := pwin.window.screen.deviceXDPI / pwin.window.screen.logicalXDPI 836 | Sleep 10 ; при частом запросе deviceXDPI, возвращает пусто 837 | !ratio && (ratio := 1) 838 | ratios[hwnd] := ratio 839 | } 840 | ratio := ratios[hwnd] 841 | pelt := pwin.document.elementFromPoint(rmCtrlX / ratio, rmCtrlY / ratio) 842 | Tag := pelt.TagName 843 | If (Tag = "IFRAME" || Tag = "FRAME") { 844 | If pFrame := ComObjQuery(pwin.document.parentWindow.frames[pelt.id], IID_IHTMLWindow2, IID_IHTMLWindow2) 845 | iFrame := ComObject(9, pFrame, 1) 846 | Else 847 | iFrame := ComObj(9, ComObjQuery(pelt.contentWindow, IID_IHTMLWindow2, IID_IHTMLWindow2), 1) 848 | WB2 := ComObject(9, ComObjQuery(pelt.contentWindow, IID_IWebBrowserApp, IID_IWebBrowserApp), 1) 849 | If ((Var := WB2.LocationName) != "") 850 | Frame .= "`nTitle: " Var "" 851 | If ((Var := WB2.LocationURL) != "") 852 | Frame .= "`nURL: " Var "" 853 | If (iFrame.length) 854 | Frame .= "`nCount frames: " iFrame.length "" 855 | If (Tag != "") 856 | Frame .= "`nTagName: " Tag "" 857 | If ((Var := pelt.id) != "") 858 | Frame .= "`nID: " Var "" 859 | If ((Var := pelt.ClassName) != "") 860 | Frame .= "`nClass: " Var "" 861 | If ((Var := pelt.sourceIndex) != "") 862 | Frame .= "`nIndex: " Var "" 863 | If ((Var := pelt.name) != "") 864 | Frame .= "`nName: " TransformHTML(Var) "" 865 | 866 | If ((Var := pelt.OuterHtml) != "") { 867 | code = `n%D1% ( Outer HTML ) %D2%`n 868 | Frame .= code "" TransformHTML(Var) "" 869 | } 870 | If ((Var := pelt.OuterText) != "") { 871 | code = `n%D1% ( Outer Text ) %D2%`n 872 | Frame .= code "" TransformHTML(Var) "" 873 | } 874 | If Frame != 875 | Frame = `n%D1% ( FrameInfo ) %D2%%Frame% 876 | _pbrt := pelt.getBoundingClientRect() 877 | pelt := iFrame.document.elementFromPoint((rmCtrlX / ratio) - _pbrt.left, (rmCtrlY / ratio) - _pbrt.top) 878 | __pbrt := pelt.getBoundingClientRect(), pbrt := {} 879 | pbrt.left := __pbrt.left + _pbrt.left, pbrt.right := __pbrt.right + _pbrt.left 880 | pbrt.top := __pbrt.top + _pbrt.top, pbrt.bottom := __pbrt.bottom + _pbrt.top 881 | } 882 | Else 883 | pbrt := pelt.getBoundingClientRect() 884 | 885 | WB2 := ComObject(9, ComObjQuery(pwin, IID_IWebBrowserApp, IID_IWebBrowserApp), 1) 886 | If ((Location := WB2.LocationName) != "") 887 | Location = `nTitle: %Location% 888 | If ((URL := WB2.LocationURL) != "") 889 | URL = `nURL: %URL% 890 | If ((Var := pelt.id) != "") 891 | Info .= "`nID: " Var "" 892 | If ((Var := pelt.ClassName) != "") 893 | Info .= "`nClass: " Var "" 894 | If ((Var := pelt.sourceIndex) != "") 895 | Info .= "`nIndex: " Var "" 896 | If ((Var := pelt.name) != "") 897 | Info .= "`nName: " TransformHTML(Var) "" 898 | 899 | If ((Var := pelt.OuterHtml) != "") { 900 | code = `n%D1% ( Outer HTML ) %D2%`n 901 | Info .= code "" TransformHTML(Var) "" 902 | } 903 | If ((Var := pelt.OuterText) != "") { 904 | code = `n%D1% ( Outer Text ) %D2%`n 905 | Info .= code "" TransformHTML(Var) "" 906 | } 907 | x1 := pbrt.left * ratio, y1 := pbrt.top * ratio 908 | x2 := pbrt.right * ratio, y2 := pbrt.bottom * ratio 909 | If (ThisMode = "Mouse") && (StateLight = 1 || (StateLight = 3 && GetKeyState("Shift", "P"))) 910 | { 911 | WinGetPos, sX, sY, , , ahk_id %hwnd% 912 | StateLightMarker ? ShowMarker(sX + x1, sY + y1, x2 - x1, y2 - y1) : 0 913 | StateLightAcc ? ShowAccMarker(AccCoord[1], AccCoord[2], AccCoord[3], AccCoord[4]) : 0 914 | } 915 | If Info != 916 | Info := "`n" D1 " ( Tag name: " pelt.TagName " )" (Frame ? " " # " ( in frame )" : "") " " D2 917 | . "`nPos: x" Round(x1) " y" Round(y1) "" 918 | . DP "Size: w" Round(x2 - x1) " h" Round(y2 - y1) "" Info 919 | ObjRelease(pwin), ObjRelease(pelt), ObjRelease(WB2), ObjRelease(iFrame), ObjRelease(pbrt) 920 | Return Location URL Info Frame 921 | } 922 | 923 | WBGet(hwnd) { 924 | Static Msg := DllCall("RegisterWindowMessage", "Str", "WM_HTML_GETOBJECT") 925 | , IID_IHTMLWindow2 := "{332C4427-26CB-11D0-B483-00C04FD90119}" 926 | SendMessage, Msg, , , , ahk_id %hwnd% 927 | DllCall("oleacc\ObjectFromLresult", "Ptr", ErrorLevel, "Ptr", 0, "Ptr", 0, PtrP, pdoc) 928 | Return ComObj(9, ComObjQuery(pdoc, IID_IHTMLWindow2, IID_IHTMLWindow2), 1), ObjRelease(pdoc) 929 | } 930 | 931 | ; _________________________________________________ Get Acc Info _________________________________________________ 932 | 933 | ; http://www.autohotkey.com/board/topic/77888-accessible-info-viewer-alpha-release-2012-09-20/ 934 | 935 | AccInfoUnderMouse(x, y, wx, wy, cx, cy) { 936 | Static h 937 | If Not h 938 | h := DllCall("LoadLibrary","Str","oleacc","Ptr") 939 | If DllCall("oleacc\AccessibleObjectFromPoint" 940 | , "Int64", x&0xFFFFFFFF|y<<32, "Ptr*", pacc 941 | , "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild) = 0 942 | Acc := ComObjEnwrap(9,pacc,1), child := NumGet(varChild,8,"UInt") 943 | If !IsObject(Acc) 944 | Return 945 | Type := child ? "Child" DP "Id: " child "" 946 | : "Parent" DP "ChildCount: " ((C := Acc.accChildCount) != "" ? "" C "" : "N/A") 947 | code = `nType: %Type% 948 | code = %code%`n%D1% ( Position relative ) %D2%`n 949 | code .= "Screen: " AccGetLocation(Acc, child) 950 | . "`nMouse: x" x - AccCoord[1] " y" y - AccCoord[2] "" 951 | . DP "Window: x" AccCoord[1] - wx " y" AccCoord[2] - wy "" 952 | . (cx != "" ? DP "Control: x" (AccCoord[1] - wx - cx) " y" (AccCoord[2] - wy - cy) "" : "") 953 | 954 | If ((Name := Acc.accName(child)) != "") { 955 | code = %code%`n%D1% ( Name ) %D2%`n 956 | code .= "" TransformHTML(Name) "" 957 | } 958 | If ((Value := Acc.accValue(child)) != "") { 959 | code = %code%`n%D1% ( Value ) %D2%`n 960 | code .= "" TransformHTML(Value) "" 961 | } 962 | If ((State := AccGetStateText(StateCode := Acc.accState(child))) != "") { 963 | code = %code%`n%D1% ( State ) %D2%`n 964 | code .= "" TransformHTML(State) "" 965 | . DP "code: " StateCode "" 966 | } 967 | If ((Role := AccRole(Acc, child)) != "") { 968 | code = %code%`n%D1% ( Role ) %D2%`n 969 | code .= "" TransformHTML(Role) "" 970 | . DP "code: " Acc.accRole(child) "" 971 | } 972 | If (child &&(ObjRole := AccRole(Acc)) != "") { 973 | code = %code%`n%D1% ( Role - parent ) %D2%`n 974 | code .= "" TransformHTML(ObjRole) "" 975 | . DP "code: " Acc.accRole(0) "" 976 | } 977 | If ((Action := Acc.accDefaultAction(child)) != "") { 978 | code = %code%`n%D1% ( Action ) %D2%`n 979 | code .= "" TransformHTML(Action) "" 980 | } 981 | If ((Selection := Acc.accSelection) > 0) { 982 | code = %code%`n%D1% ( Selection - parent ) %D2%`n 983 | code .= "" TransformHTML(Selection) "" 984 | } 985 | If ((Focus := Acc.accFocus) > 0) { 986 | code = %code%`n%D1% ( Focus - parent ) %D2%`n 987 | code .= "" TransformHTML(Focus) "" 988 | } 989 | If ((Description := Acc.accDescription(child)) != "") { 990 | code = %code%`n%D1% ( Description ) %D2%`n 991 | code .= "" TransformHTML(Description) "" 992 | } 993 | If ((ShortCut := Acc.accKeyboardShortCut(child)) != "") { 994 | code = %code%`n%D1% ( ShortCut ) %D2%`n 995 | code .= "" TransformHTML(ShortCut) "" 996 | } 997 | If ((Help := Acc.accHelp(child)) != "") { 998 | code = %code%`n%D1% ( Help ) %D2%`n 999 | code .= "" TransformHTML(Help) "" 1000 | } 1001 | If ((HelpTopic := Acc.AccHelpTopic(child))) { 1002 | code = %code%`n%D1% ( HelpTopic ) %D2%`n 1003 | code .= "" TransformHTML(HelpTopic) "" 1004 | } 1005 | Return code 1006 | } 1007 | 1008 | AccRole(Acc, ChildId=0) { 1009 | Return ComObjType(Acc, "Name") = "IAccessible" ? AccGetRoleText(Acc.accRole(ChildId)) : "" 1010 | } 1011 | 1012 | AccGetRoleText(nRole) { 1013 | nSize := DllCall("oleacc\GetRoleText", "UInt", nRole, "Ptr", 0, "UInt", 0) 1014 | VarSetCapacity(sRole, (A_IsUnicode?2:1)*nSize) 1015 | DllCall("oleacc\GetRoleText", "UInt", nRole, "str", sRole, "UInt", nSize+1) 1016 | Return sRole 1017 | } 1018 | 1019 | AccGetStateText(nState) { 1020 | nSize := DllCall("oleacc\GetStateText", "UInt", nState, "Ptr", 0, "UInt", 0) 1021 | VarSetCapacity(sState, (A_IsUnicode?2:1)*nSize) 1022 | DllCall("oleacc\GetStateText", "UInt", nState, "str", sState, "UInt", nSize+1) 1023 | Return sState 1024 | } 1025 | 1026 | AccGetLocation(Acc, Child=0) { 1027 | Acc.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), Child) 1028 | Return "x" (AccCoord[1]:=NumGet(x,0,"int")) " y" (AccCoord[2]:=NumGet(y,0,"int")) "" 1029 | . DP "Size: w" (AccCoord[3]:=NumGet(w,0,"int")) " h" (AccCoord[4]:=NumGet(h,0,"int")) "" 1030 | } 1031 | 1032 | ; _________________________________________________ Mode_Hotkey _________________________________________________ 1033 | 1034 | Mode_Hotkey: 1035 | Try SetTimer, Loop_%ThisMode%, Off 1036 | If ThisMode = Hotkey 1037 | oDoc.body.scrollLeft := 0 1038 | oDoc.body.createTextRange().execCommand("RemoveFormat") 1039 | ScrollPos[ThisMode,1] := oDoc.body.scrollLeft, ScrollPos[ThisMode,2] := oDoc.body.scrollTop 1040 | If ThisMode != Hotkey 1041 | HTML_%ThisMode% := oDoc.body.innerHTML 1042 | ThisMode := "Hotkey", Hotkey_Hook(!isPaused), TitleText := "AhkSpy - Button" TitleTextP2 1043 | oDoc.body.scrollLeft := ScrollPos[ThisMode,1], oDoc.body.scrollTop := ScrollPos[ThisMode,2] 1044 | ShowMarker ? (HideMarker(), HideAccMarker()) : 0 1045 | (HTML_Hotkey != "") ? Write_HotkeyHTML() : Write_Hotkey({Mods:"Waiting pushed buttons..."}) 1046 | SendMessage, 0xC, 0, &TitleText, , ahk_id %hGui% 1047 | GuiControl, TB: -0x0001, But3 1048 | WinActivate ahk_id %hGui% 1049 | GuiControl, 1:Focus, oDoc 1050 | IniWrite(ThisMode, "LastMode") 1051 | If isFindView 1052 | FindSearch(1) 1053 | Return 1054 | 1055 | Write_Hotkey(K) { 1056 | Static PrHK1, PrHK2, PrKeysComm, KeysComm, Name ; , PrKeys1, PrKeys2 1057 | 1058 | Mods := K.Mods, KeyName := K.Name 1059 | Prefix := K.Pref, Hotkey := K.HK 1060 | LRMods := K.LRMods, LRPref := TransformHTML(K.LRPref) 1061 | ThisKey := K.TK, VKCode := K.VK, SCCode := K.SC 1062 | 1063 | If (K.NFP && Mods KeyName != "") 1064 | NotPhysical := " " DP " Not a physical press " 1065 | 1066 | HK1 := K.IsCode ? Hotkey : ThisKey 1067 | HK2 := HK1 = PrHK1 ? PrHK2 : PrHK1, PrHK1 := HK1, PrHK2 := HK2 1068 | HKComm1 := " `; """ (StrLen(Name := GetKeyName(HK2)) = 1 ? Format("{:U}", Name) : Name) 1069 | HKComm2 := (StrLen(Name := GetKeyName(HK1)) = 1 ? Format("{:U}", Name) : Name) """" 1070 | 1071 | ; If ((Keys1 := Prefix Hotkey) != "" && Keys1 != PrKeys1) 1072 | ; Keys2 := PrKeys1, PrKeys1 := Keys1 1073 | ; , KeysComm := " `; """ PrKeysComm " >> " Mods KeyName """" 1074 | ; , PrKeysComm := Mods KeyName, PrKeys2 := Keys2 1075 | ; Else 1076 | ; Keys1 := PrKeys1, Keys2 := PrKeys2 1077 | 1078 | If K.IsCode 1079 | Comment := " `; """ KeyName """" 1080 | If (Hotkey != "") 1081 | FComment := " `; """ Mods KeyName """" 1082 | 1083 | If (LRMods != "") 1084 | { 1085 | LRMStr := "" LRMods KeyName "" 1086 | If (Hotkey != "") 1087 | LRPStr := " " DP " " LRPref Hotkey ":: `; """ LRMods KeyName """" 1088 | } 1089 | inp_hk := o_edithotkey.value, inp_kn := o_editkeyname.value 1090 | 1091 | If Prefix != 1092 | DUMods := (K.MLCtrl ? "{LCtrl Down}" : "") (K.MRCtrl ? "{RCtrl Down}" : "") 1093 | . (K.MLAlt ? "{LAlt Down}" : "") (K.MRAlt ? "{RAlt Down}" : "") 1094 | . (K.MLShift ? "{LShift Down}" : "") (K.MRShift ? "{RShift Down}" : "") 1095 | . (K.MLWin ? "{LWin Down}" : "") (K.MRWin ? "{RWin Down}" : "") . "{" Hotkey "}" 1096 | . (K.MLCtrl ? "{LCtrl Up}" : "") (K.MRCtrl ? "{RCtrl Up}" : "") 1097 | . (K.MLAlt ? "{LAlt Up}" : "") (K.MRAlt ? "{RAlt Up}" : "") 1098 | . (K.MLShift ? "{LShift Up}" : "") (K.MRShift ? "{RShift Up}" : "") 1099 | . (K.MLWin ? "{LWin Up}" : "") (K.MRWin ? "{RWin Up}" : "") 1100 | 1101 | SendHotkey := Hotkey = "" ? ThisKey : Hotkey 1102 | 1103 | ControlSend := DUMods = "" ? "{" SendHotkey "}" : DUMods 1104 | 1105 | If (DUMods != "") 1106 | LRSend := " " DP " " SendMode " " DUMods "" Comment "" 1107 | If SCCode != 1108 | ThisKeySC := " " DP " " VKCode " " DP " " SCCode " " 1109 | . DP " 0x" SubStr(VKCode, 3) " " DP " 0x" SubStr(SCCode, 3) "" 1110 | Else 1111 | ThisKeySC := " " DP " 0x" SubStr(VKCode, 3) "" 1112 | If WordWrap 1113 | Break := "word-wrap: break-word;" 1114 | 1115 | HTML_Hotkey = 1116 | ( Ltrim 1117 |
1118 | 	%D1% ( Pushed buttons ) %DB% %pause_button% %D2%
1119 | 
1120 | 	%Mods%%KeyName%%NotPhysical%
1121 | 
1122 | 	%LRMStr%
1123 | 
1124 | 	%D1% ( Command syntax ) %DB%    %DB%   %D2%
1125 | 
1126 | 	%Prefix%%Hotkey%::%FComment%%LRPStr%
1127 | 	        
1128 | 	%SendMode% %Prefix%{%SendHotkey%}%Comment%  %DP%  ControlSend, ahk_parent, %ControlSend%, WinTitle%Comment%
1129 | 	        
1130 | 	%Prefix%{%SendHotkey%}%Comment%%LRSend%
1131 | 	        
1132 | 	GetKeyState("%SendHotkey%", "P")%Comment%   %DP%   KeyWait, %SendHotkey%, D T0.5%Comment%
1133 | 	        
1134 | 	%HK2% & %HK1%::%HKComm1% & %HKComm2%   %DP%   %HK2%::%HK1%%HKComm1% >> %HKComm2%
1135 | 	        
1136 | 	%D1% ( Key ) %DB%    %D2%
1137 | 
1138 | 	%ThisKey%   %DP%   %VKCode%%SCCode%%ThisKeySC%
1139 | 
1140 | 	%D1% ( GetKeyNameOrCode ) %DB%  %D2%
1141 | 
1142 | 	
1143 | 
1144 | 	%D2%
1145 | 1146 | 1158 | ) 1159 | ; %DB% 1160 | ; %DP% %Keys2%:: %Keys1%%KeysComm% 1161 | Write_HotkeyHTML() 1162 | } 1163 | 1164 | Write_HotkeyHTML() { 1165 | oDoc.body.innerHTML := HTML_Hotkey, oDoc.getElementById("pre").style.fontSize := FontSize 1166 | ComObjConnect(o_edithotkey := oDoc.getElementById("edithotkey"), Events) 1167 | ComObjConnect(o_editkeyname := oDoc.getElementById("editkeyname"), Events) 1168 | oDoc.getElementById("pre").style.wordWrap := WordWrap ? "break-word" : "normal" 1169 | } 1170 | 1171 | ; _________________________________________________ Hotkey Functions _________________________________________________ 1172 | 1173 | ; http://forum.script-coding.com/viewtopic.php?pid=69765#p69765 1174 | 1175 | Hotkey_Init(Func, Options = "") { 1176 | #HotkeyInterval 0 1177 | Hotkey_Arr("Func", Func) 1178 | Hotkey_Arr("Up", !!InStr(Options, "U")) 1179 | Hotkey_MouseAndJoyInit(Options) 1180 | OnExit("Hotkey_SetHook"), Hotkey_SetHook() 1181 | Hotkey_Arr("Hook") ? (Hotkey_Hook(0), Hotkey_Hook(1)) : 0 1182 | } 1183 | 1184 | Hotkey_Main(In) { 1185 | Static Prefix := {"LAlt":"!","RCtrl":">^","RShift":">+","RWin":">#"}, K := {}, ModsOnly 1187 | Local IsMod, sIsMod 1188 | IsMod := In.IsMod 1189 | If (In.Opt = "Down") { 1190 | If (K["M" IsMod] != "") 1191 | Return 1 1192 | sIsMod := SubStr(IsMod, 2) 1193 | K["M" sIsMod] := sIsMod "+", K["P" sIsMod] := SubStr(Prefix[IsMod], 2) 1194 | K["M" IsMod] := IsMod "+", K["P" IsMod] := Prefix[IsMod] 1195 | } 1196 | Else If (In.Opt = "Up") { 1197 | sIsMod := SubStr(IsMod, 2) 1198 | K.ModUp := 1, K["M" IsMod] := K["P" IsMod] := "" 1199 | If (K["ML" sIsMod] = "" && K["MR" sIsMod] = "") 1200 | K["M" sIsMod] := K["P" sIsMod] := "" 1201 | If (!Hotkey_Arr("Up") && K.HK != "") 1202 | Return 1 1203 | } 1204 | Else If (In.Opt = "OnlyMods") { 1205 | If !ModsOnly 1206 | Return 0 1207 | K.MCtrl := K.MAlt := K.MShift := K.MWin := K.Mods := "" 1208 | K.PCtrl := K.PAlt := K.PShift := K.PWin := K.Pref := "" 1209 | K.PRCtrl := K.PRAlt := K.PRShift := K.PRWin := "" 1210 | K.PLCtrl := K.PLAlt := K.PLShift := K.PLWin := K.LRPref := "" 1211 | K.MRCtrl := K.MRAlt := K.MRShift := K.MRWin := "" 1212 | K.MLCtrl := K.MLAlt := K.MLShift := K.MLWin := K.LRMods := "" 1213 | Func(Hotkey_Arr("Func")).Call(K) 1214 | Return ModsOnly := 0 1215 | } 1216 | Else If (In.Opt = "GetMod") 1217 | Return !!(K.PCtrl K.PAlt K.PShift K.PWin) 1218 | K.UP := In.UP, K.IsJM := 0, K.Time := In.Time, K.NFP := In.NFP, K.IsMod := IsMod 1219 | K.VK := In.VK, K.SC := In.SC 1220 | K.Mods := K.MCtrl K.MAlt K.MShift K.MWin 1221 | K.LRMods := K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin 1222 | K.TK := GetKeyName(K.VK K.SC), K.TK := K.TK = "" ? K.VK K.SC : (StrLen(K.TK) = 1 ? Format("{:U}", K.TK) : K.TK) 1223 | (IsMod) ? (K.HK := K.Pref := K.LRPref := K.Name := K.IsCode := "", ModsOnly := K.Mods = "" ? 0 : 1) 1224 | : (K.IsCode := (SendCode != "none" && StrLen(K.TK) = 1) ; && !Instr("1234567890-=", K.TK) 1225 | , K.HK := K.IsCode ? K[SendCode] : K.TK 1226 | , K.Name := K.HK = "vkBF" ? "/" : K.TK 1227 | , K.Pref := K.PCtrl K.PAlt K.PShift K.PWin 1228 | , K.LRPref := K.PLCtrl K.PRCtrl K.PLAlt K.PRAlt K.PLShift K.PRShift K.PLWin K.PRWin 1229 | , ModsOnly := 0) 1230 | Func(Hotkey_Arr("Func")).Call(K) 1231 | Return 1 1232 | 1233 | Hotkey_PressJoy: 1234 | Hotkey_PressMouse: 1235 | K.Time := A_TickCount 1236 | K.Mods := K.MCtrl K.MAlt K.MShift K.MWin 1237 | K.LRMods := K.MLCtrl K.MRCtrl K.MLAlt K.MRAlt K.MLShift K.MRShift K.MLWin K.MRWin 1238 | K.Pref := K.PCtrl K.PAlt K.PShift K.PWin 1239 | K.LRPref := K.PLCtrl K.PRCtrl K.PLAlt K.PRAlt K.PLShift K.PRShift K.PLWin K.PRWin 1240 | K.HK := K.Name := K.TK := A_ThisHotkey, ModsOnly := K.NFP := K.UP := K.IsCode := 0, K.IsMod := K.SC := "" 1241 | K.IsJM := A_ThisLabel = "Hotkey_PressJoy" ? 1 : 2 1242 | K.VK := A_ThisLabel = "Hotkey_PressJoy" ? "" : Format("vk{:X}", GetKeyVK(A_ThisHotkey)) 1243 | Func(Hotkey_Arr("Func")).Call(K) 1244 | Return 1 1245 | } 1246 | 1247 | Hotkey_MouseAndJoyInit(Options) { 1248 | Static MouseKey := "MButton|WheelDown|WheelUp|WheelRight|WheelLeft|XButton1|XButton2" 1249 | Local S_FormatInteger, Option 1250 | #If Hotkey_Arr("Hook") 1251 | #If Hotkey_Arr("Hook") && !Hotkey_Main({Opt:"GetMod"}) 1252 | #If Hotkey_Arr("Hook") && GetKeyState("RButton", "P") 1253 | #If 1254 | Option := InStr(Options, "M") ? "On" : "Off" 1255 | Hotkey, IF, Hotkey_Arr("Hook") 1256 | Loop, Parse, MouseKey, | 1257 | Hotkey, %A_LoopField%, Hotkey_PressMouse, % Option 1258 | Option := InStr(Options, "L") ? "On" : "Off" 1259 | Hotkey, IF, Hotkey_Arr("Hook") && GetKeyState("RButton"`, "P") 1260 | Hotkey, LButton, Hotkey_PressMouse, % Option 1261 | Option := InStr(Options, "R") ? "On" : "Off" 1262 | Hotkey, IF, Hotkey_Arr("Hook") 1263 | Hotkey, RButton, Hotkey_PressMouse, % Option 1264 | Option := InStr(Options, "J") ? "On" : "Off" 1265 | S_FormatInteger := A_FormatInteger 1266 | SetFormat, IntegerFast, D 1267 | Hotkey, IF, Hotkey_Arr("Hook") && !Hotkey_Main({Opt:"GetMod"}) 1268 | Loop, 128 1269 | Hotkey % Ceil(A_Index / 32) "Joy" Mod(A_Index - 1, 32) + 1, Hotkey_PressJoy, % Option 1270 | SetFormat, IntegerFast, %S_FormatInteger% 1271 | Hotkey, IF 1272 | } 1273 | 1274 | Hotkey_Hook(Val = 1) { 1275 | Hotkey_Arr("Hook", Val) 1276 | !Val && Hotkey_Main({Opt:"OnlyMods"}) 1277 | } 1278 | 1279 | Hotkey_Arr(P*) { 1280 | Static Arr := {} 1281 | Return P.MaxIndex() = 1 ? Arr[P[1]] : (Arr[P[1]] := P[2]) 1282 | } 1283 | 1284 | ; http://forum.script-coding.com/viewtopic.php?id=6350 1285 | 1286 | Hotkey_LowLevelKeyboardProc(nCode, wParam, lParam) { 1287 | Static Mods := {"vkA4":"LAlt","vkA5":"RAlt","vkA2":"LCtrl","vkA3":"RCtrl" 1288 | ,"vkA0":"LShift","vkA1":"RShift","vk5B":"LWin","vk5C":"RWin"}, oMem := [] 1289 | , HEAP_ZERO_MEMORY := 0x8, Size := 16, hHeap := DllCall("GetProcessHeap", Ptr) 1290 | Local pHeap, Lp, Ext, VK, SC, SC1, SC2, IsMod, Time, NFP, KeyUp 1291 | Critical 1292 | If !Hotkey_Arr("Hook") 1293 | Return DllCall("CallNextHookEx", "Ptr", 0, "Int", nCode, "UInt", wParam, "UInt", lParam) 1294 | pHeap := DllCall("HeapAlloc", Ptr, hHeap, UInt, HEAP_ZERO_MEMORY, Ptr, Size, Ptr) 1295 | DllCall("RtlMoveMemory", Ptr, pHeap, Ptr, lParam, Ptr, Size), oMem.Push(pHeap) 1296 | SetTimer, Hotkey_HookProcWork, -10 1297 | Return nCode < 0 ? DllCall("CallNextHookEx", "Ptr", 0, "Int", nCode, "UInt", wParam, "UInt", lParam) : 1 1298 | 1299 | Hotkey_HookProcWork: 1300 | While (oMem[1] != "") { 1301 | If Hotkey_Arr("Hook") { 1302 | Lp := oMem[1] 1303 | VK := Format("vk{:X}", NumGet(Lp + 0, "UInt")) 1304 | Ext := NumGet(Lp + 0, 8, "UInt") 1305 | SC1 := NumGet(Lp + 0, 4, "UInt") 1306 | NFP := (Ext >> 4) & 1 ; Не физическое нажатие 1307 | KeyUp := Ext >> 7 1308 | ; Time := NumGet(Lp + 12, "UInt") 1309 | IsMod := Mods[VK] 1310 | If !SC1 1311 | SC2 := GetKeySC(VK), SC := SC2 = "" ? "" : Format("sc{:X}", SC2) 1312 | Else 1313 | SC := Format("sc{:X}", (Ext & 1) << 8 | SC1) 1314 | If !KeyUp 1315 | IsMod ? Hotkey_Main({VK:VK, SC:SC, Opt:"Down", IsMod:IsMod, NFP:NFP, Time:Time, UP:0}) 1316 | : Hotkey_Main({VK:VK, SC:SC, NFP:NFP, Time:Time, UP:0}) 1317 | Else 1318 | IsMod ? Hotkey_Main({VK:VK, SC:SC, Opt:"Up", IsMod:IsMod, NFP:NFP, Time:Time, UP:1}) 1319 | : (Hotkey_Arr("Up") ? Hotkey_Main({VK:VK, SC:SC, NFP:NFP, Time:Time, UP:1}) : 0) 1320 | } 1321 | DllCall("HeapFree", Ptr, hHeap, UInt, 0, Ptr, Lp) 1322 | oMem.RemoveAt(1) 1323 | } 1324 | Return 1325 | } 1326 | 1327 | Hotkey_SetHook(On = 1) { 1328 | Static hHook 1329 | If (On = 1 && !hHook) 1330 | hHook := DllCall("SetWindowsHookEx" . (A_IsUnicode ? "W" : "A") 1331 | , "Int", 13 ; WH_KEYBOARD_LL 1332 | , "Ptr", RegisterCallback("Hotkey_LowLevelKeyboardProc", "Fast") 1333 | , "Ptr", DllCall("GetModuleHandle", "UInt", 0, "Ptr") 1334 | , "UInt", 0, "Ptr") 1335 | Else If (On != 1) 1336 | DllCall("UnhookWindowsHookEx", "Ptr", hHook), hHook := "", Hotkey_Hook(0) 1337 | } 1338 | 1339 | ; _________________________________________________ Labels _________________________________________________ 1340 | 1341 | GuiSize: 1342 | Sleep := A_EventInfo 1343 | If Sleep != 1 1344 | ControlsMove(A_GuiWidth, A_GuiHeight) 1345 | Else 1346 | ZoomMsg(1), HideMarker(), HideAccMarker() 1347 | Try SetTimer, Loop_%ThisMode%, % Sleep = 1 || isPaused ? "Off" : "On" 1348 | Return 1349 | 1350 | Exit: 1351 | GuiClose: 1352 | oDoc := "" 1353 | DllCall("DeregisterShellHookWindow", "Ptr", A_ScriptHwnd) 1354 | ExitApp 1355 | 1356 | TitleShow: 1357 | SendMessage, 0xC, 0, &TitleText, , ahk_id %hGui% 1358 | Return 1359 | 1360 | CheckAhkVersion: 1361 | If A_AhkVersion < 1.1.17.00 1362 | { 1363 | MsgBox Requires AutoHotkey_L version 1.1.17.00+ 1364 | RunPath("http://ahkscript.org/download/") 1365 | ExitApp 1366 | } 1367 | Return 1368 | 1369 | LaunchHelp: 1370 | IfWinNotExist AutoHotkey Help ahk_class HH Parent ahk_exe hh.exe 1371 | Run % SubStr(A_AhkPath,1,InStr(A_AhkPath,"\",,0,1)) "AutoHotkey.chm" 1372 | WinActivate 1373 | Minimize() 1374 | Return 1375 | 1376 | DefaultSize: 1377 | If FullScreenMode 1378 | { 1379 | FullScreenMode() 1380 | Gui, 1: Restore 1381 | Sleep 200 1382 | } 1383 | Gui, 1: Show, % "NA w" widthTB "h" HeightStart 1384 | ZoomMsg(6) 1385 | If !MemoryFontSize 1386 | oDoc.getElementById("pre").style.fontSize := FontSize := 15 1387 | Return 1388 | 1389 | Reload: 1390 | Reload 1391 | Return 1392 | 1393 | Suspend: 1394 | Suspend 1395 | Menu, Sys, % A_IsSuspended ? "Check" : "UnCheck", % A_ThisMenuItem 1396 | Return 1397 | 1398 | UpdateAhkSpy: 1399 | Update() 1400 | Return 1401 | 1402 | CheckUpdate: 1403 | StateUpdate := IniWrite(!StateUpdate, "StateUpdate") 1404 | Menu, Sys, % StateUpdate ? "Check" : "UnCheck", Check updates 1405 | If StateUpdate 1406 | GoSub, UpdateAhkSpy 1407 | Return 1408 | 1409 | SelStartMode: 1410 | Menu, Startmode, UnCheck, Window 1411 | Menu, Startmode, UnCheck, Mouse && Control 1412 | Menu, Startmode, UnCheck, Button 1413 | Menu, Startmode, UnCheck, Last Mode 1414 | IniWrite({"Window":"Win","Mouse && Control":"Mouse","Button":"Hotkey","Last Mode":"LastMode"}[A_ThisMenuItem], "StartMode") 1415 | Menu, Startmode, Check, % A_ThisMenuItem 1416 | Return 1417 | 1418 | ShowSys: 1419 | Menu, Sys, Show 1420 | Return 1421 | 1422 | Sys_Backlight: 1423 | Menu, Sys, UnCheck, % BLGroup[StateLight] 1424 | Menu, Sys, Check, % A_ThisMenuItem 1425 | IniWrite((StateLight := InArr(A_ThisMenuItem, BLGroup*)), "StateLight") 1426 | Return 1427 | 1428 | Sys_Acclight: 1429 | StateLightAcc := IniWrite(!StateLightAcc, "StateLightAcc"), HideAccMarker() 1430 | Menu, Sys, % StateLightAcc ? "Check" : "UnCheck", Acc object backlight 1431 | Return 1432 | 1433 | Sys_WClight: 1434 | StateLightMarker := IniWrite(!StateLightMarker, "StateLightMarker"), HideMarker() 1435 | Menu, Sys, % StateLightMarker ? "Check" : "UnCheck", Window or control backlight 1436 | Return 1437 | 1438 | Sys_Help: 1439 | If A_ThisMenuItem = AutoHotKey official help online 1440 | RunPath("http://ahkscript.org/docs/AutoHotkey.htm") 1441 | Else If A_ThisMenuItem = AutoHotKey russian help online 1442 | RunPath("http://www.script-coding.com/AutoHotkeyTranslation.html") 1443 | Else If A_ThisMenuItem = About 1444 | RunPath("http://forum.script-coding.com/viewtopic.php?pid=72459#p72459") 1445 | Return 1446 | 1447 | Sys_OpenScriptDir: 1448 | SelectFilePath(A_ScriptFullPath) 1449 | Minimize() 1450 | Return 1451 | 1452 | Spot_Together: 1453 | StateAllwaysSpot := IniWrite(!StateAllwaysSpot, "AllwaysSpot") 1454 | Menu, Sys, % StateAllwaysSpot ? "Check" : "UnCheck", Spot together (low speed) 1455 | Return 1456 | 1457 | Active_No_Pause: 1458 | ActiveNoPause := IniWrite(!ActiveNoPause, "ActiveNoPause") 1459 | Menu, Sys, % ActiveNoPause ? "Check" : "UnCheck", Work with the active window 1460 | ZoomMsg(8, ActiveNoPause) 1461 | (ActiveNoPause && Sleep != 1 && !isPaused) && ZoomMsg(0) 1462 | Return 1463 | 1464 | MemoryPos: 1465 | IniWrite(MemoryPos := !MemoryPos, "MemoryPos") 1466 | Menu, Sys, % MemoryPos ? "Check" : "UnCheck", Remember position 1467 | SavePos() 1468 | Return 1469 | 1470 | MemorySize: 1471 | IniWrite(MemorySize := !MemorySize, "MemorySize") 1472 | Menu, Sys, % MemorySize ? "Check" : "UnCheck", Remember size 1473 | SaveSize() 1474 | Return 1475 | 1476 | MemoryFontSize: 1477 | IniWrite(MemoryFontSize := !MemoryFontSize, "MemoryFontSize") 1478 | Menu, Sys, % MemoryFontSize ? "Check" : "UnCheck", Remember font size 1479 | If MemoryFontSize 1480 | IniWrite(FontSize, "FontSize") 1481 | Return 1482 | 1483 | MemoryZoomSize: 1484 | IniWrite(MemoryZoomSize := !MemoryZoomSize, "MemoryZoomSize") 1485 | Menu, Sys, % MemoryZoomSize ? "Check" : "UnCheck", Remember zoom size 1486 | ZoomMsg(5, MemoryZoomSize) 1487 | Return 1488 | 1489 | MemoryStateZoom: 1490 | IniWrite(MemoryStateZoom := !MemoryStateZoom, "MemoryStateZoom") 1491 | Menu, Sys, % MemoryStateZoom ? "Check" : "UnCheck", Remember state zoom 1492 | IniWrite(DllCall("IsWindowVisible", "Ptr", oOther.hZoom) ? 1 : 0, "ZoomShow") 1493 | Return 1494 | 1495 | WordWrap: 1496 | IniWrite(WordWrap := !WordWrap, "WordWrap") 1497 | Menu, Sys, % WordWrap ? "Check" : "UnCheck", Word wrap 1498 | oDoc.getElementById("pre").style.wordWrap := WordWrap ? "break-word" : "normal" 1499 | Return 1500 | 1501 | ; _________________________________________________ Functions _________________________________________________ 1502 | 1503 | ShellProc(nCode, wParam) { 1504 | If (nCode = 4) 1505 | { 1506 | If (wParam = hGui) 1507 | (ThisMode = "Hotkey" && !isPaused ? Hotkey_Hook(1) : ""), HideMarker(), HideAccMarker(), CheckHideMarker() 1508 | Else If Hotkey_Arr("Hook") 1509 | Hotkey_Hook(0) 1510 | ZoomMsg(!ActiveNoPause && wParam = hGui ? 1 : Sleep != 1 && !isPaused ? 0 : 1) 1511 | } 1512 | } 1513 | 1514 | WM_ACTIVATE(wp) { 1515 | Critical 1516 | If (wp & 0xFFFF) 1517 | (ThisMode = "Hotkey" && !isPaused ? Hotkey_Hook(1) : 0), HideMarker(), HideAccMarker(), CheckHideMarker() 1518 | Else If (wp & 0xFFFF = 0 && Hotkey_Arr("Hook")) 1519 | Hotkey_Hook(0) 1520 | ZoomMsg(!ActiveNoPause && (wp & 0xFFFF) ? 1 : Sleep != 1 && !isPaused ? 0 : 1) 1521 | } 1522 | 1523 | WM_NCLBUTTONDOWN(wp) { 1524 | Static HTMINBUTTON := 8 1525 | If (wp = HTMINBUTTON) 1526 | { 1527 | SetTimer, Minimize, -10 1528 | Return 0 1529 | } 1530 | } 1531 | 1532 | WM_LBUTTONDOWN() { 1533 | If A_GuiControl = ColorProgress 1534 | { 1535 | If ThisMode = Hotkey 1536 | oDoc.execCommand("Paste"), ToolTip("Paste", 300) 1537 | Else 1538 | { 1539 | SendInput {LAlt Down}{Escape}{LAlt Up} 1540 | If (Sleep != 1 && !isPaused) 1541 | ZoomMsg(0) 1542 | ToolTip("Alt+Escape", 300) 1543 | } 1544 | } 1545 | } 1546 | 1547 | WM_CONTEXTMENU() { 1548 | MouseGetPos, , , wid, cid, 2 1549 | If (cid != hActiveX && wid = hGui) 1550 | { 1551 | SetTimer, ShowSys, -1 1552 | Return 0 1553 | } 1554 | } 1555 | 1556 | WM_MOVE() { 1557 | If MemoryPos 1558 | SetTimer, SavePos, -200 1559 | } 1560 | 1561 | WM_SIZE() { 1562 | If MemorySize 1563 | SetTimer, SaveSize, -200 1564 | } 1565 | 1566 | ControlsMove(Width, Height) { 1567 | Gui, TB: Show, % "NA y0 x" (Width - widthTB) // 2.2 1568 | If isFindView 1569 | Gui, F: Show, % "NA x" (Width - widthTB) // 2.2 " y" (Height - (Height < HeigtButton * 2 ? -2 : 27)) 1570 | WinMove, ahk_id %hActiveX%, , 0, HeigtButton, Width, Height - HeigtButton - (isFindView ? 28 : 0) 1571 | } 1572 | 1573 | Minimize() { 1574 | Sleep := 1 1575 | ZoomMsg(1) 1576 | Gui, 1: Minimize 1577 | } 1578 | 1579 | ZoomSpot() { 1580 | If (!isPaused && Sleep != 1 && WinActive("ahk_id" hGui)) 1581 | (ThisMode = "Mouse" ? (Spot_Mouse() (StateAllwaysSpot ? Spot_Win() : 0) Write_Mouse()) : (Spot_Win() (StateAllwaysSpot ? Spot_Mouse() : 0) Write_Win())) 1582 | } 1583 | 1584 | MsgZoom(wParam, lParam) { 1585 | If (wParam = 1) 1586 | { 1587 | SetTimer, ZoomSpot, -10 1588 | Return 1 1589 | } 1590 | oOther.hZoom := lParam 1591 | ZoomMsg(Sleep != 1 && !isPaused && (!WinActive("ahk_id" hGui) || ActiveNoPause) ? 0 : 1) 1592 | } 1593 | 1594 | ZoomMsg(wParam = -1, lParam = -1) { 1595 | If WinExist("AhkSpyZoom ahk_id" oOther.hZoom) 1596 | PostMessage, % MsgAhkSpyZoom, wParam, lParam, , % "ahk_id" oOther.hZoom 1597 | } 1598 | 1599 | SavePos() { 1600 | If FullScreenMode 1601 | Return 1602 | WinGet, Min, MinMax, ahk_id %hGui% 1603 | If (Min = 0) 1604 | { 1605 | WinGetPos, WinX, WinY, , , ahk_id %hGui% 1606 | IniWrite(WinX, "MemoryPosX"), IniWrite(WinY, "MemoryPosY") 1607 | } 1608 | } 1609 | 1610 | SaveSize() { 1611 | If FullScreenMode 1612 | Return 1613 | WinGet, Min, MinMax, ahk_id %hGui% 1614 | If (Min = 0) 1615 | { 1616 | GetClientPos(hGui, _, _, WinWidth, WinHeight) 1617 | IniWrite(WinWidth, "MemorySizeW"), IniWrite(WinHeight, "MemorySizeH") 1618 | } 1619 | } 1620 | 1621 | ; http://forum.script-coding.com/viewtopic.php?pid=87817#p87817 1622 | ; http://www.autohotkey.com/board/topic/93660-embedded-ie-shellexplorer-render-issues-fix-force-it-to-use-a-newer-render-engine/ 1623 | 1624 | FixIE() { 1625 | Static Key := "Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION" 1626 | If A_IsCompiled 1627 | ExeName := A_ScriptName 1628 | Else 1629 | SplitPath, A_AhkPath, ExeName 1630 | RegRead, Value, HKCU, %Key%, %ExeName% 1631 | If (Value != "") 1632 | RegDelete, HKCU, %Key%, %ExeName% 1633 | } 1634 | 1635 | RunPath(Link, WorkingDir = "", Option = "") { 1636 | Run %Link%, %WorkingDir%, %Option% 1637 | Minimize() 1638 | } 1639 | 1640 | ExtraFile(Name, GetNoCompile = 0) { 1641 | Static Dir := A_ScriptDir 1642 | If GetNoCompile 1643 | Return Dir "\" Name ".ahk" 1644 | If FileExist(Dir "\" Name ".exe") 1645 | Return Dir "\" Name ".exe" 1646 | If FileExist(Dir "\" Name ".ahk") 1647 | Return Dir "\" Name ".ahk" 1648 | } 1649 | 1650 | RunRealPath(Path) { 1651 | SplitPath, Path, , Dir 1652 | Dir := LTrim(Dir, """") 1653 | While !InStr(FileExist(Dir), "D") 1654 | Dir := SubStr(Dir, 1, -1) 1655 | Run, %Path%, %Dir% 1656 | } 1657 | 1658 | ShowMarker(x, y, w, h, b := 4) { 1659 | w < 8 || h < 8 ? b := 2 : 0 1660 | Gui, M: +AlwaysOnTop 1661 | Try Gui, M: Show, NA x%x% y%y% w%w% h%h% 1662 | Catch 1663 | Return HideMarker(), ShowMarker := 0 1664 | ShowMarker := 1 1665 | WinSet, Region, % "0-0 " w "-0 " w "-" h " 0-" h " 0-0 " b "-" b 1666 | . " " w-b "-" b " " w-b "-" h-b " " b "-" h-b " " b "-" b, ahk_id %hMarkerGui% 1667 | } 1668 | 1669 | ShowAccMarker(x, y, w, h, b := 2) { 1670 | Gui, AcM: +AlwaysOnTop 1671 | Try Gui, AcM: Show, NA x%x% y%y% w%w% h%h% 1672 | Catch 1673 | Return HideAccMarker(), (ShowMarker := ShowMarker ? 1 : 0) 1674 | ShowMarker := 1 1675 | WinSet, Region, % "0-0 " w "-0 " w "-" h " 0-" h " 0-0 " b "-" b 1676 | . " " w-b "-" b " " w-b "-" h-b " " b "-" h-b " " b "-" b, ahk_id %hMarkerAccGui% 1677 | } 1678 | 1679 | HideMarker() { 1680 | Gui, M: Show, Hide 1681 | } 1682 | 1683 | HideAccMarker() { 1684 | Gui, AcM: Show, Hide 1685 | } 1686 | 1687 | CheckHideMarker() { 1688 | Static Try := 0 1689 | SetTimer, CheckHideMarker, -150 1690 | Return 1691 | 1692 | CheckHideMarker: 1693 | If !(Try := ++Try > 2 ? 0 : Try) 1694 | Return 1695 | WinActive("ahk_id" hGui) ? (HideMarker(), HideAccMarker()) : 0 1696 | SetTimer, CheckHideMarker, -250 1697 | Return 1698 | } 1699 | 1700 | SetEditColor(hwnd, BG, FG) { 1701 | Edits[hwnd] := {BG:BG,FG:FG} 1702 | WM_CTLCOLOREDIT(DllCall("GetDC", "Ptr", hwnd), hwnd) 1703 | DllCall("RedrawWindow", "Ptr", hwnd, "Uint", 0, "Uint", 0, "Uint", 0x1|0x4) 1704 | } 1705 | 1706 | WM_CTLCOLOREDIT(wParam, lParam) { 1707 | If !Edits.HasKey(lParam) 1708 | Return 0 1709 | hBrush := DllCall("CreateSolidBrush", UInt, Edits[lParam].BG) 1710 | DllCall("SetTextColor", Ptr, wParam, UInt, Edits[lParam].FG) 1711 | DllCall("SetBkColor", Ptr, wParam, UInt, Edits[lParam].BG) 1712 | DllCall("SetBkMode", Ptr, wParam, UInt, 2) 1713 | Return hBrush 1714 | } 1715 | 1716 | IniRead(Key, Error := " ") { 1717 | IniRead, Value, %A_AppData%\AhkSpy.ini, AhkSpy, %Key%, %Error% 1718 | Return Value 1719 | } 1720 | 1721 | IniWrite(Value, Key) { 1722 | IniWrite, %Value%, %A_AppData%\AhkSpy.ini, AhkSpy, %Key% 1723 | Return Value 1724 | } 1725 | 1726 | InArr(Val, Arr*) { 1727 | For k, v in Arr 1728 | If (v == Val) 1729 | Return k 1730 | } 1731 | 1732 | TransformHTML(str) { 1733 | StringReplace, str, str, `r`n, `n, 1 1734 | StringReplace, str, str, `n, `r`n, 1 1735 | Transform, str, HTML, %str%, 3 1736 | Return str 1737 | } 1738 | 1739 | ExistSelectedText(byref Copy) { 1740 | MouseGetPos, , , , ControlID, 2 1741 | If (ControlID != hActiveX) 1742 | Return 0 1743 | Copy := oDoc.selection.createRange().text 1744 | If Copy is space 1745 | Return 0 1746 | ; html := oDoc.selection.createRange().htmlText 1747 | ; While pos := RegExMatch(html, "i)(.)(.)(\d+)", m, pos) 1748 | ; Copy := StrReplace(Copy, m1 m2 m3, m1 m3, , 1), pos++ 1749 | Copy := RegExReplace(Copy, Chr(9642) "+", Chr(9642)) 1750 | ; StringReplace, Copy, Copy, % Chr(9642), #, 1 1751 | ; StringReplace, Copy, Copy, #!# copy #!#, #!#, 1 1752 | ; StringReplace, Copy, Copy, #!# pause #!#, #!# 1753 | Return 1 1754 | } 1755 | 1756 | TitleText(Text, Time = 1000) { 1757 | StringReplace, Text, Text, `r`n, % Chr(8629), 1 1758 | SendMessage, 0xC, 0, &Text, , ahk_id %hGui% 1759 | SetTimer, TitleShow, -%Time% 1760 | } 1761 | 1762 | ClipAdd(Text, AddTip = 0) { 1763 | If ClipAdd_Before 1764 | Clipboard := Text ClipAdd_Delimiter Clipboard 1765 | Else 1766 | Clipboard := Clipboard ClipAdd_Delimiter Text 1767 | If AddTip 1768 | ToolTip("add", 300) 1769 | } 1770 | 1771 | ClipPaste() { 1772 | If oMS.ELSel && (oMS.ELSel.OuterText != "" || MS_Cancel()) 1773 | oMS.ELSel.innerHTML := TransformHTML(Clipboard), oMS.ELSel.Name := "MS:" 1774 | Else 1775 | oDoc.execCommand("Paste") 1776 | } 1777 | 1778 | CopyCommaParam(Text) { 1779 | If !(Text ~= "(x|y|w|h|" Chr(178) ")-*\d+") 1780 | Return Text 1781 | Text := RegExReplace(Text, "i)(x|y|w|h|#|\s|" Chr(178) "|" Chr(9642) ")+", " ") 1782 | Text := TRim(Text, " "), Text := RegExReplace(Text, "(\s|,)+", ", ") 1783 | Return Text 1784 | } 1785 | 1786 | ; http://forum.script-coding.com/viewtopic.php?pid=53516#p53516 1787 | 1788 | ; GetCommandLineProc(pid) { 1789 | ; ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process WHERE ProcessId = " pid)._NewEnum.next(X) 1790 | ; Return Trim(X.CommandLine) 1791 | ; } 1792 | 1793 | ; http://forum.script-coding.com/viewtopic.php?pid=111775#p111775 1794 | 1795 | GetCommandLineProc(PID, ByRef Cmd, ByRef Bit) { 1796 | Static PROCESS_QUERY_INFORMATION := 0x400, PROCESS_VM_READ := 0x10, STATUS_SUCCESS := 0 1797 | 1798 | hProc := DllCall("OpenProcess", UInt, PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, Int, 0, UInt, PID, Ptr) 1799 | if A_Is64bitOS 1800 | DllCall("IsWow64Process", Ptr, hProc, UIntP, IsWow64), Bit := (IsWow64 ? "32" : "64") " bit" DP 1801 | if (!A_Is64bitOS || IsWow64) 1802 | PtrSize := 4, PtrType := "UInt", pPtr := "UIntP", offsetCMD := 0x40 1803 | else 1804 | PtrSize := 8, PtrType := "Int64", pPtr := "Int64P", offsetCMD := 0x70 1805 | hModule := DllCall("GetModuleHandle", "str", "Ntdll", Ptr) 1806 | if (A_PtrSize < PtrSize) { ; скрипт 32, целевой процесс 64 1807 | if !QueryInformationProcess := DllCall("GetProcAddress", Ptr, hModule, AStr, "NtWow64QueryInformationProcess64", Ptr) 1808 | failed := "NtWow64QueryInformationProcess64" 1809 | if !ReadProcessMemory := DllCall("GetProcAddress", Ptr, hModule, AStr, "NtWow64ReadVirtualMemory64", Ptr) 1810 | failed := "NtWow64ReadVirtualMemory64" 1811 | info := 0, szPBI := 48, offsetPEB := 8 1812 | } 1813 | else { 1814 | if !QueryInformationProcess := DllCall("GetProcAddress", Ptr, hModule, AStr, "NtQueryInformationProcess", Ptr) 1815 | failed := "NtQueryInformationProcess" 1816 | ReadProcessMemory := "ReadProcessMemory" 1817 | if (A_PtrSize > PtrSize) ; скрипт 64, целевой процесс 32 1818 | info := 26, szPBI := 8, offsetPEB := 0 1819 | else ; скрипт и целевой процесс одной битности 1820 | info := 0, szPBI := PtrSize * 6, offsetPEB := PtrSize 1821 | } 1822 | if failed { 1823 | DllCall("CloseHandle", Ptr, hProc) 1824 | Return 1825 | } 1826 | VarSetCapacity(PBI, 48, 0) 1827 | if DllCall(QueryInformationProcess, Ptr, hProc, UInt, info, Ptr, &PBI, UInt, szPBI, UIntP, bytes) != STATUS_SUCCESS { 1828 | DllCall("CloseHandle", Ptr, hProc) 1829 | Return 1830 | } 1831 | pPEB := NumGet(&PBI + offsetPEB, PtrType) 1832 | DllCall(ReadProcessMemory, Ptr, hProc, PtrType, pPEB + PtrSize * 4, pPtr, pRUPP, PtrType, PtrSize, UIntP, bytes) 1833 | DllCall(ReadProcessMemory, Ptr, hProc, PtrType, pRUPP + offsetCMD, UShortP, szCMD, PtrType, 2, UIntP, bytes) 1834 | DllCall(ReadProcessMemory, Ptr, hProc, PtrType, pRUPP + offsetCMD + PtrSize, pPtr, pCMD, PtrType, PtrSize, UIntP, bytes) 1835 | VarSetCapacity(buff, szCMD, 0) 1836 | DllCall(ReadProcessMemory, Ptr, hProc, PtrType, pCMD, Ptr, &buff, PtrType, szCMD, UIntP, bytes) 1837 | Cmd := StrGet(&buff, "UTF-16") 1838 | 1839 | DllCall("CloseHandle", Ptr, hProc) 1840 | } 1841 | 1842 | SeDebugPrivilege() { 1843 | Static PROCESS_QUERY_INFORMATION := 0x400, TOKEN_ADJUST_PRIVILEGES := 0x20, SE_PRIVILEGE_ENABLED := 0x2 1844 | 1845 | hProc := DllCall("OpenProcess", UInt, PROCESS_QUERY_INFORMATION, Int, false, UInt, DllCall("GetCurrentProcessId"), Ptr) 1846 | DllCall("Advapi32\OpenProcessToken", Ptr, hProc, UInt, TOKEN_ADJUST_PRIVILEGES, PtrP, token) 1847 | DllCall("Advapi32\LookupPrivilegeValue", Ptr, 0, Str, "SeDebugPrivilege", Int64P, luid) 1848 | VarSetCapacity(TOKEN_PRIVILEGES, 16, 0) 1849 | NumPut(1, TOKEN_PRIVILEGES, "UInt") 1850 | NumPut(luid, TOKEN_PRIVILEGES, 4, "Int64") 1851 | NumPut(SE_PRIVILEGE_ENABLED, TOKEN_PRIVILEGES, 12, "UInt") 1852 | DllCall("Advapi32\AdjustTokenPrivileges", Ptr, token, Int, false, Ptr, &TOKEN_PRIVILEGES, UInt, 0, Ptr, 0, Ptr, 0) 1853 | res := A_LastError 1854 | DllCall("CloseHandle", Ptr, token) 1855 | DllCall("CloseHandle", Ptr, hProc) 1856 | Return res ; в случае удачи 0 1857 | } 1858 | 1859 | ; http://www.autohotkey.com/board/topic/69254-func-api-getwindowinfo-ahk-l/#entry438372 1860 | 1861 | GetClientPos(hwnd, ByRef left, ByRef top, ByRef w, ByRef h) { 1862 | VarSetCapacity(pwi, 60, 0), NumPut(60, pwi, 0, "UInt") 1863 | DllCall("GetWindowInfo", "Ptr", hwnd, "UInt", &pwi) 1864 | top := NumGet(pwi, 24, "Int") - NumGet(pwi, 8, "Int") 1865 | left := NumGet(pwi, 52, "Int") 1866 | w := NumGet(pwi, 28, "Int") - NumGet(pwi, 20, "Int") 1867 | h := NumGet(pwi, 32, "Int") - NumGet(pwi, 24, "Int") 1868 | } 1869 | 1870 | ; http://forum.script-coding.com/viewtopic.php?pid=81833#p81833 1871 | 1872 | SelectFilePath(FilePath) { 1873 | If !FileExist(FilePath) 1874 | Return 1875 | SplitPath, FilePath,, Dir 1876 | for window in ComObjCreate("Shell.Application").Windows { 1877 | ShellFolderView := window.Document 1878 | Try If ((Folder := ShellFolderView.Folder).Self.Path != Dir) 1879 | Continue 1880 | Catch 1881 | Continue 1882 | for item in Folder.Items { 1883 | If (item.Path != FilePath) 1884 | Continue 1885 | ShellFolderView.SelectItem(item, 1|4|8|16) 1886 | WinActivate, % "ahk_id" window.hwnd 1887 | Return 1888 | } 1889 | } 1890 | Run, %A_WinDir%\explorer.exe /select`, "%FilePath%", , UseErrorLevel 1891 | } 1892 | 1893 | GetCLSIDExplorer(hwnd) { 1894 | for window in ComObjCreate("Shell.Application").Windows 1895 | If (window.hwnd = hwnd) 1896 | Return (CLSID := window.Document.Folder.Self.Path) ~= "^::\{" ? "`nCLSID: " CLSID "": "" 1897 | } 1898 | 1899 | ViewStyles(elem) { 1900 | elem.innerText := (w_ShowStyles := !w_ShowStyles) ? "hide styles" : "show styles" 1901 | If w_ShowStyles 1902 | { 1903 | Styles := GetStyles(oDoc.getElementById("c_Style").innerText, oDoc.getElementById("c_ExStyle").innerText) 1904 | HTML_Win := oDoc.body.innerHTML 1905 | StringReplace, HTML_Win, HTML_Win, , %Styles% 1906 | oDoc.body.innerHTML := HTML_Win 1907 | } 1908 | Else 1909 | oDoc.getElementById("AllWinStyles").innerHTML := "", HTML_Win := oDoc.body.innerHTML 1910 | } 1911 | 1912 | ; http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx 1913 | ; http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx 1914 | 1915 | GetStyles(Style, ExStyle) { 1916 | Static Styles := {"WS_BORDER":"0x00800000", "WS_CAPTION":"0x00C00000", "WS_CHILD":"0x40000000", "WS_CHILDWINDOW":"0x40000000" 1917 | , "WS_CLIPCHILDREN":"0x02000000", "WS_CLIPSIBLINGS":"0x04000000", "WS_DISABLED":"0x08000000", "WS_DLGFRAME":"0x00400000" 1918 | , "WS_GROUP":"0x00020000", "WS_HSCROLL":"0x00100000", "WS_ICONIC":"0x20000000", "WS_MAXIMIZE":"0x01000000" 1919 | , "WS_MAXIMIZEBOX":"0x00010000", "WS_MINIMIZE":"0x20000000", "WS_MINIMIZEBOX":"0x00020000", "WS_POPUP":"0x80000000" 1920 | , "WS_OVERLAPPED":"0x00000000", "WS_SIZEBOX":"0x00040000", "WS_SYSMENU":"0x00080000", "WS_TABSTOP":"0x00010000" 1921 | , "WS_THICKFRAME":"0x00040000", "WS_TILED":"0x00000000", "WS_VISIBLE":"0x10000000", "WS_VSCROLL":"0x00200000"} 1922 | 1923 | , ExStyles := {"WS_EX_ACCEPTFILES":"0x00000010", "WS_EX_APPWINDOW":"0x00040000", "WS_EX_CLIENTEDGE":"0x00000200" 1924 | , "WS_EX_COMPOSITED":"0x02000000", "WS_EX_CONTEXTHELP":"0x00000400", "WS_EX_CONTROLPARENT":"0x00010000" 1925 | , "WS_EX_DLGMODALFRAME":"0x00000001", "WS_EX_LAYERED":"0x00080000", "WS_EX_LAYOUTRTL":"0x00400000" 1926 | , "WS_EX_LEFT":"0x00000000", "WS_EX_LEFTSCROLLBAR":"0x00004000", "WS_EX_LTRREADING":"0x00000000" 1927 | , "WS_EX_MDICHILD":"0x00000040", "WS_EX_NOACTIVATE":"0x08000000", "WS_EX_NOINHERITLAYOUT":"0x00100000" 1928 | , "WS_EX_NOPARENTNOTIFY":"0x00000004", "WS_EX_NOREDIRECTIONBITMAP":"0x00200000", "WS_EX_RIGHT":"0x00001000" 1929 | , "WS_EX_RIGHTSCROLLBAR":"0x00000000", "WS_EX_RTLREADING":"0x00002000", "WS_EX_STATICEDGE":"0x00020000" 1930 | , "WS_EX_TOOLWINDOW":"0x00000080", "WS_EX_TOPMOST":"0x00000008", "WS_EX_TRANSPARENT":"0x00000020" 1931 | , "WS_EX_WINDOWEDGE":"0x00000100"} 1932 | 1933 | For K, V In Styles 1934 | Ret .= Style & V ? "" K " := " V "`r`n" : "" 1935 | For K, V In ExStyles 1936 | RetEx .= ExStyle & V ? "" K " := " V "`r`n" : "" 1937 | If Ret != 1938 | Res .= D1 " ( Styles ) " D2 "`r`n" Ret 1939 | If RetEx != 1940 | Res .= D1 " ( ExStyles ) " D2 "`r`n" RetEx 1941 | Return (Res = "" ? "" : "`r`n") . RTrim(Res, "`r`n") 1942 | } 1943 | 1944 | GetLangName(hWnd) { 1945 | Static LOCALE_SENGLANGUAGE := 0x1001 1946 | Locale := DllCall("GetKeyboardLayout", Ptr, DllCall("GetWindowThreadProcessId", Ptr, hWnd, UInt, 0, Ptr), Ptr) & 0xFFFF 1947 | Size := DllCall("GetLocaleInfo", UInt, Locale, UInt, LOCALE_SENGLANGUAGE, UInt, 0, UInt, 0) * 2 1948 | VarSetCapacity(lpLCData, Size, 0) 1949 | DllCall("GetLocaleInfo", UInt, Locale, UInt, LOCALE_SENGLANGUAGE, Str, lpLCData, UInt, Size) 1950 | Return lpLCData 1951 | } 1952 | 1953 | ChangeLocal(hWnd) { 1954 | Static WM_INPUTLANGCHANGEREQUEST := 0x0050, INPUTLANGCHANGE_FORWARD := 0x0002 1955 | SendMessage, WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_FORWARD, , , % "ahk_id" hWnd 1956 | } 1957 | 1958 | ToolTip(text, time) { 1959 | CoordMode, Mouse 1960 | CoordMode, ToolTip 1961 | MouseGetPos, X, Y 1962 | ToolTip, %text%, X-10, Y-45 1963 | SetTimer, HideToolTip, -%time% 1964 | Return 1 1965 | 1966 | HideToolTip: 1967 | ToolTip 1968 | Return 1969 | } 1970 | 1971 | MouseStep(x, y) { 1972 | MouseMove, x, y, 0, R 1973 | If (Sleep != 1 && !isPaused && ThisMode != "Hotkey" && WinActive("ahk_id" hGui)) 1974 | { 1975 | (ThisMode = "Mouse" ? (Spot_Mouse() (StateAllwaysSpot ? Spot_Win() : 0) Write_Mouse()) : (Spot_Win() (StateAllwaysSpot ? Spot_Mouse() : 0) Write_Win())) 1976 | ZoomMsg(2) 1977 | } 1978 | } 1979 | 1980 | AhkSpyZoomShow() { 1981 | WindowVisible := DllCall("IsWindowVisible", "Ptr", oOther.hZoom) 1982 | ; If (!isPaused && !WindowVisible) 1983 | ; SendInput {LAlt Down}{Escape}{LAlt Up} 1984 | If !WinExist("AhkSpyZoom ahk_id" oOther.hZoom) && IniWrite(1, "ZoomShow") 1985 | Run % """" ExtraFile("AhkSpyZoom") """" " " hGui " " ActiveNoPause 1986 | Else If WindowVisible 1987 | ZoomMsg(3), IniWrite(0, "ZoomShow") 1988 | Else 1989 | ZoomMsg(4), IniWrite(1, "ZoomShow") 1990 | ZoomMsg(7, isPaused), ZoomMsg(8, ActiveNoPause) 1991 | ZoomMsg(Sleep != 1 && !isPaused && (!WinActive("ahk_id" hGui) || ActiveNoPause) ? 0 : 1) 1992 | } 1993 | 1994 | IsIEFocus() { 1995 | ControlGetFocus, Focus 1996 | Return InStr(Focus, "Internet") 1997 | } 1998 | 1999 | NextLink(s = "") { 2000 | curpos := oDoc.body.scrollTop, oDoc.body.scrollLeft := 0 2001 | If (!curpos && s = "-") 2002 | Return 2003 | While (pos := oDoc.getElementsByTagName("a").item(A_Index-1).getBoundingClientRect().top) != "" 2004 | (s 1) * pos > 0 && (!res || abs(res) > abs(pos)) ? res := pos : "" ; http://forum.script-coding.com/viewtopic.php?pid=82360#p82360 2005 | If (res = "" && s = "") 2006 | Return 2007 | st := !res ? -curpos : res, co := abs(st) > 150 ? 80 : 30 2008 | Loop % co 2009 | oDoc.body.scrollTop := curpos + (st*(A_Index/co)) 2010 | oDoc.body.scrollTop := curpos + res 2011 | } 2012 | 2013 | Update(in = 1) { 2014 | Static att, Ver, req 2015 | , url1 := "https://raw.githubusercontent.com/serzh82saratov/AhkSpy/master/Readme.txt" 2016 | , url2 := "https://raw.githubusercontent.com/serzh82saratov/AhkSpy/master/AhkSpy.ahk" 2017 | , urlZoom := "https://raw.githubusercontent.com/serzh82saratov/AhkSpy/master/Extra/AhkSpyZoom.ahk" 2018 | If !req 2019 | req := ComObjCreate("WinHttp.WinHttpRequest.5.1"), req.Option(6) := 0 2020 | req.open("GET", url%in%, 1), req.send(), att := 0 2021 | SetTimer, Upd_Verifi, -3000 2022 | Return 2023 | 2024 | Upd_Verifi: 2025 | If (Status := req.Status) = 200 2026 | { 2027 | Text := req.responseText 2028 | If (req.Option(1) = url1) 2029 | Return (Ver := RegExReplace(Text, "i).*?version\s*(.*?)\R.*", "$1")) > AhkSpyVersion ? Update(2) : 0 2030 | If (!InStr(Text, "AhkSpyVersion")) 2031 | Return 2032 | If InStr(FileExist(A_ScriptFullPath), "R") 2033 | { 2034 | MsgBox, % 16+262144+8192, AhkSpy, Exist new version %Ver%!`n`nBut the file has an attribute "READONLY".`nUpdate imposible. 2035 | Return 2036 | } 2037 | MsgBox, % 4+32+262144+8192, AhkSpy, Exist new version!`nUpdate v%AhkSpyVersion% to v%Ver%? 2038 | IfMsgBox, No 2039 | Return 2040 | File := FileOpen(A_ScriptFullPath, "w", "UTF-8") 2041 | File.Length := 0, File.Write(Text), File.Close() 2042 | If FileExist(ExtraFile("AhkSpyZoom", 1)) 2043 | { 2044 | req.open("GET", urlZoom, 0), req.send() 2045 | Text := req.responseText 2046 | File := FileOpen(ExtraFile("AhkSpyZoom", 1), "w", "UTF-8") 2047 | File.Length := 0, File.Write(Text), File.Close() 2048 | } 2049 | Reload 2050 | } 2051 | Error := (++att = 20 || Status != "") 2052 | SetTimer, % Error ? "UpdateAhkSpy" : "Upd_Verifi", % Error ? -60000 : -3000 2053 | Return 2054 | } 2055 | 2056 | TaskbarProgress(state, hwnd, pct = "") { 2057 | static tbl 2058 | if !tbl { 2059 | try tbl := ComObjCreate("{56FDF344-FD6D-11d0-958A-006097C9A090}", "{ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf}") 2060 | catch 2061 | tbl := "error" 2062 | } 2063 | if tbl = error 2064 | Return 2065 | DllCall(NumGet(NumGet(tbl+0)+10*A_PtrSize), "ptr", tbl, "ptr", hwnd, "uint", state) 2066 | if pct != 2067 | DllCall(NumGet(NumGet(tbl+0)+9*A_PtrSize), "ptr", tbl, "ptr", hwnd, "int64", pct, "int64", 100) 2068 | } 2069 | 2070 | HighLight(elem, time = "", RemoveFormat = 1) { 2071 | Try SetTimer, UnHighLight, % "-" time 2072 | R := oDoc.body.createTextRange() 2073 | RemoveFormat ? R.execCommand("RemoveFormat") : 0 2074 | R.moveToElementText(elem) 2075 | R.collapse(1), R.select() 2076 | R.moveToElementText(elem) 2077 | R.execCommand("BackColor", 0, "3399FF") 2078 | R.execCommand("ForeColor", 0, "FFEEFF") 2079 | Return 2080 | 2081 | UnHighLight: 2082 | oDoc.body.createTextRange().execCommand("RemoveFormat") 2083 | Return 2084 | } 2085 | 2086 | ; _________________________________________________ FullScreen _________________________________________________ 2087 | 2088 | FullScreenMode() { 2089 | Static Max, hFunc 2090 | hwnd := WinExist("ahk_id" hGui) 2091 | If !FullScreenMode 2092 | { 2093 | FullScreenMode := 1 2094 | Menu, Sys, Check, Full screen 2095 | WinGetNormalPos(hwnd, X, Y, W, H) 2096 | WinGet, Max, MinMax, ahk_id %hwnd% 2097 | If Max = 1 2098 | WinSet, Style, -0x01000000 ; WS_MAXIMIZE 2099 | Gui, 1: -ReSize -Caption 2100 | Gui, 1: Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight% 2101 | Gui, 1: Maximize 2102 | WinSetNormalPos(hwnd, X, Y, W, H) 2103 | hFunc := Func("ControlsMove").Bind(A_ScreenWidth, A_ScreenHeight) 2104 | } 2105 | Else 2106 | { 2107 | Gui, 1: +ReSize +Caption 2108 | If Max = 1 2109 | { 2110 | WinGetNormalPos(hwnd, X, Y, W, H) 2111 | Gui, 1: Maximize 2112 | WinSetNormalPos(hwnd, X, Y, W, H) 2113 | } 2114 | Else 2115 | Gui, 1: Restore 2116 | Sleep 20 2117 | GetClientPos(hwnd, _, _, Width, Height) 2118 | hFunc := Func("ControlsMove").Bind(Width, Height) 2119 | FullScreenMode := 0 2120 | Menu, Sys, UnCheck, Full screen 2121 | } 2122 | SetTimer, % hFunc, % Max ? -150 : -50 2123 | } 2124 | 2125 | WinGetNormalPos(hwnd, ByRef x, ByRef y, ByRef w, ByRef h) { 2126 | VarSetCapacity(wp, 44), NumPut(44, wp) 2127 | DllCall("GetWindowPlacement", "Ptr", hwnd, "Ptr", &wp) 2128 | x := NumGet(wp, 28, "int"), y := NumGet(wp, 32, "int") 2129 | w := NumGet(wp, 36, "int") - x, h := NumGet(wp, 40, "int") - y 2130 | } 2131 | 2132 | WinSetNormalPos(hwnd, x, y, w, h) { 2133 | VarSetCapacity(wp, 44, 0), NumPut(44, wp, 0, "uint") 2134 | DllCall("GetWindowPlacement", "Ptr", hWnd, "Ptr", &wp) 2135 | NumPut(x, wp, 28, "int"), NumPut(y, wp, 32, "int") 2136 | NumPut(w + x, wp, 36, "int"), NumPut(h + y, wp, 40, "int") 2137 | DllCall("SetWindowPlacement", "Ptr", hWnd, "Ptr", &wp) 2138 | } 2139 | 2140 | ; _________________________________________________ Find _________________________________________________ 2141 | 2142 | FindView() { 2143 | If !isFindView 2144 | { 2145 | GuiControlGet, p, 1:Pos, %hActiveX% 2146 | GuiControl, 1:Move, %hActiveX%, % "x" pX " y" pY " w" pW " h" pH - 28 2147 | Gui, F: Show, % "NA x" (pW - widthTB) // 2.2 " h26 y" (pY + pH - 27) 2148 | isFindView := 1 2149 | } 2150 | GuiControl, F:Focus, Edit1 2151 | FindSearch(1) 2152 | } 2153 | 2154 | FindHide() { 2155 | Gui, F: Show, Hide 2156 | GuiControlGet, a, 1:Pos, %hActiveX% 2157 | GuiControl, 1:Move, %hActiveX%, % "x" aX "y" aY "w" aW "h" aH + 28 2158 | isFindView := 0 2159 | GuiControl, Focus, %hActiveX% 2160 | } 2161 | 2162 | FindOption(Hwnd) { 2163 | GuiControlGet, p, Pos, %Hwnd% 2164 | If pX = 2165 | Return 2166 | ControlGet, Style, Style,, , ahk_id %Hwnd% 2167 | ControlGetText, Text, , ahk_id %Hwnd% 2168 | DllCall("DestroyWindow", "Ptr", Hwnd) 2169 | Gui, %A_Gui%: Add, Text, % "x" pX " y" pY " w" pW " h" pH " g" A_ThisFunc " " (Style & 0x1000 ? "c2F2F2F +0x0201" : "+Border +0x1201"), % Text 2170 | InStr(Text, "sensitive") ? (oFind.Registr := !(Style & 0x1000)) : (oFind.Whole := !(Style & 0x1000)) 2171 | FindSearch(1) 2172 | FindAll() 2173 | } 2174 | 2175 | FindNew(Hwnd) { 2176 | ControlGetText, Text, , ahk_id %Hwnd% 2177 | oFind.Text := Text 2178 | hFunc := Func("FindSearch").Bind(1) 2179 | SetTimer, FindAll, -150 2180 | SetTimer, % hFunc, -150 2181 | } 2182 | 2183 | FindNext(Hwnd) { 2184 | SendMessage, 0x400+114,,,, ahk_id %Hwnd% ; UDM_GETPOS32 2185 | Back := !ErrorLevel 2186 | FindSearch(0, Back) 2187 | } 2188 | 2189 | FindAll() { 2190 | If (oFind.Text = "") 2191 | { 2192 | GuiControl, F:Text, FindMatches 2193 | Return 2194 | } 2195 | R := oDoc.selection.createRange(), Matches := 0 2196 | R.moveToElementText(oDoc.getElementById("pre")), R.collapse(1) 2197 | Option := (oFind.Whole ? 2 : 0) ^ (oFind.Registr ? 4 : 0) 2198 | Loop 2199 | { 2200 | F := R.findText(oFind.Text, 1, Option) 2201 | If (F = 0) 2202 | Break 2203 | El := R.parentElement() 2204 | If (El.TagName ~= "^(BUTTON|INPUT)$" || El.ID ~= "^(delimiter|title|param)$") && !R.collapse(0) 2205 | Continue 2206 | ; R.execCommand("BackColor", 0, "EF0FFF") 2207 | ; R.execCommand("ForeColor", 0, "FFEEFF") 2208 | R.collapse(0), ++Matches 2209 | } 2210 | GuiControl, F:Text, FindMatches, % Matches ? Matches : "" 2211 | } 2212 | 2213 | FindSearch(This, Back = 0) { 2214 | Global hFindEdit 2215 | R := oDoc.selection.createRange(), sR := R.duplicate() 2216 | R.collapse(This || Back ? 1 : 0) 2217 | If (oFind.Text = "" && !R.select()) 2218 | SetEditColor(hFindEdit, 0xFFFFFF, 0x000000) 2219 | Else { 2220 | Option := (Back ? 1 : 0) ^ (oFind.Whole ? 2 : 0) ^ (oFind.Registr ? 4 : 0) 2221 | Loop { 2222 | F := R.findText(oFind.Text, 1, Option) 2223 | If (F = 0) { 2224 | If !A { 2225 | R.moveToElementText(oDoc.getElementById("pre")), R.collapse(!Back), A := 1 2226 | Continue 2227 | } 2228 | If This 2229 | sR.collapse(1), sR.select() 2230 | Break 2231 | } 2232 | If (!This && R.isEqual(sR)) { 2233 | If A { 2234 | hFunc := Func("SetEditColor").Bind(hFindEdit, 0xFFFFFF, 0x000000) 2235 | SetTimer, % hFunc, -200 2236 | } 2237 | Break 2238 | } 2239 | El := R.parentElement() 2240 | If (El.TagName ~= "^(BUTTON|INPUT)$" || El.ID ~= "^(delimiter|title|param)$") && !R.collapse(Back) 2241 | Continue 2242 | R.select(), F := 1 2243 | Break 2244 | } 2245 | If (F != 1) 2246 | SetEditColor(hFindEdit, 0x6666FF, 0x000000) 2247 | Else 2248 | SetEditColor(hFindEdit, 0xFFFFFF, 0x000000) 2249 | } 2250 | } 2251 | ; _________________________________________________ Mouse hover selection _________________________________________________ 2252 | 2253 | MS_Cancel() { 2254 | If oMS.ELSel 2255 | oMS.ELSel.style.backgroundColor := "", oMS.ELSel := "" 2256 | } 2257 | 2258 | MS_SelectionCheck() { 2259 | Selection := oDoc.selection.createRange().text != "" 2260 | If Selection 2261 | (!oMS.Selection && MS_Cancel()) 2262 | Else If oMS.Selection && MS_IsSelect(EL := oDoc.elementFromPoint(oMS.SCX, oMS.SCY)) 2263 | MS_Select(EL) 2264 | oMS.Selection := Selection 2265 | } 2266 | 2267 | MS_MouseOver() { 2268 | EL := oMS.EL 2269 | If !MS_IsSelect(EL) 2270 | Return 2271 | MS_Select(EL) 2272 | } 2273 | 2274 | MS_IsSelect(EL) { 2275 | If InStr(EL.Name, "MS:") 2276 | Return 1 2277 | } 2278 | 2279 | MS_Select(EL) { 2280 | If InStr(EL.Name, ":S") 2281 | oMS.ELSel := EL.ParentElement, oMS.ELSel.style.background := ColorSelMouseHover 2282 | Else If InStr(EL.Name, ":N") 2283 | oMS.ELSel := oDoc.all.item(EL.sourceIndex + 1), oMS.ELSel.style.background := ColorSelMouseHover 2284 | Else If InStr(EL.Name, ":P") 2285 | oMS.ELSel := oDoc.all.item(EL.sourceIndex - 1).ParentElement, oMS.ELSel.style.background := ColorSelMouseHover 2286 | Else 2287 | oMS.ELSel := EL, EL.style.background := ColorSelMouseHover 2288 | } 2289 | 2290 | ; _________________________________________________ Doc Events _________________________________________________ 2291 | 2292 | ; http://forum.script-coding.com/viewtopic.php?pid=82283#p82283 2293 | 2294 | Class Events { 2295 | onclick() { 2296 | Global CopyText 2297 | oevent := oDoc.parentWindow.event.srcElement 2298 | tagname := oevent.tagname 2299 | If (tagname = "BUTTON") 2300 | { 2301 | thisid := oevent.id 2302 | oDoc.body.focus() 2303 | If (thisid = "copy_button" || thisid = "copy_button_1") 2304 | o := oDoc.all.item(oevent.sourceIndex + 2 + (thisid = "copy_button_1")) 2305 | , GetKeyState("Shift", "P") ? ClipAdd(o.OuterText, 1) : (Clipboard := o.OuterText), HighLight(o, 500) 2306 | Else If thisid = copy_alltitle 2307 | { 2308 | Text := (t:=oDoc.getElementById("wintitle1").OuterText) . (t = "" ? "" : " ") 2309 | . oDoc.getElementById("wintitle2").OuterText " " 2310 | . oDoc.getElementById("wintitle3").OuterText 2311 | GetKeyState("Shift", "P") ? ClipAdd(Text, 1) : (Clipboard := Text) 2312 | HighLight(oDoc.getElementById("wintitle1"), 500) 2313 | HighLight(oDoc.getElementById("wintitle2"), 500, 0) 2314 | HighLight(oDoc.getElementById("wintitle3"), 500, 0) 2315 | } 2316 | Else If thisid = keyname 2317 | { 2318 | v_edit := Format("{:L}", o_edithotkey.value), name := GetKeyName(v_edit) 2319 | If (name = v_edit) 2320 | o_editkeyname.value := Format("vk{:X}", GetKeyVK(v_edit)) (!(sc := GetKeySC(v_edit)) ? "" : Format("sc{:X}", sc)) 2321 | Else 2322 | o_editkeyname.value := (StrLen(name) = 1 ? (Format("{:U}", name)) : name) 2323 | o := name = "" ? o_edithotkey : o_editkeyname 2324 | o.focus(), o.createTextRange().select() 2325 | } 2326 | Else If thisid = pause_button 2327 | Gosub, PausedScript 2328 | Else If thisid = w_folder 2329 | { 2330 | If FileExist(FilePath := oDoc.getElementById("copy_processpath").OuterText) 2331 | SelectFilePath(FilePath), Minimize() 2332 | Else 2333 | ToolTip("Not file exist", 500) 2334 | } 2335 | Else If thisid = paste_process_path 2336 | oDoc.getElementById("copy_processpath").innerHTML := TransformHTML(Trim(Trim(Clipboard), """")) 2337 | Else If thisid = w_command_line 2338 | RunRealPath(oDoc.getElementById("c_command_line").OuterText) 2339 | Else If thisid = paste_command_line 2340 | oDoc.getElementById("c_command_line").innerHTML := TransformHTML(Clipboard) 2341 | Else If thisid = process_close 2342 | Process, Close, % oOther.WinPID 2343 | Else If thisid = win_close 2344 | WinClose, % "ahk_id" oOther.WinID 2345 | Else If (thisid = "SendCode") 2346 | Events.SendCode() 2347 | Else If (thisid = "SendMode") 2348 | Events.SendMode() 2349 | Else If (thisid = "numlock" || thisid = "scrolllock") 2350 | Events.num_scroll(thisid) 2351 | Else If thisid = locale_change 2352 | ToolTip(ChangeLocal(hActiveX) GetLangName(hActiveX), 500) 2353 | Else If thisid = paste_keyname 2354 | o_edithotkey.value := "", o_edithotkey.focus(), oDoc.execCommand("Paste"), oDoc.getElementById("keyname").click() 2355 | Else If (thisid = "copy_selected" && ExistSelectedText(CopyText) && ToolTip("copy", 500)) 2356 | GoSub CopyText 2357 | Else If thisid = get_styles 2358 | ViewStyles(oevent) 2359 | Else If thisid = run_AccViewer 2360 | RunPath(ExtraFile("AccViewer Source")) 2361 | Else If thisid = run_iWB2Learner 2362 | RunPath(ExtraFile("iWB2 Learner")) 2363 | Else If thisid = set_button_pos 2364 | { 2365 | HayStack := oevent.OuterText = "Pos:" 2366 | ? oDoc.all.item(oevent.sourceIndex + 1).OuterText " " oDoc.all.item(oevent.sourceIndex + 7).OuterText 2367 | : oDoc.all.item(oevent.sourceIndex - 5).OuterText " " oDoc.all.item(oevent.sourceIndex + 1).OuterText 2368 | RegExMatch(HayStack, "(-*\d+[\.\d+]*).*\s+.*?(-*\d+[\.\d+]*).*\s+.*?(-*\d+[\.\d+]*).*\s+.*?(-*\d+[\.\d+]*)", p) 2369 | If (p1 + 0 = "" || p2 + 0 = "" || p3 + 0 = "" || p4 + 0 = "") 2370 | Return ToolTip("Invalid parametrs", 500) 2371 | If (ThisMode = "Win") 2372 | WinMove, % "ahk_id " oOther.WinID, , p1, p2, p3, p4 2373 | Else 2374 | ControlMove, , p1, p2, p3, p4, % "ahk_id " oOther.MouseControlID 2375 | } 2376 | Else If thisid = set_button_focus_ctrl 2377 | { 2378 | hWnd := oOther.MouseControlID 2379 | ControlFocus, , ahk_id %hWnd% 2380 | WinGetPos, X, Y, W, H, ahk_id %hWnd% 2381 | If (X + Y != "") 2382 | DllCall("SetCursorPos", "Uint", X + W // 2, "Uint", Y + H // 2) 2383 | } 2384 | Else If thisid = set_button_mouse_pos 2385 | { 2386 | thisbutton := oevent.OuterText 2387 | If thisbutton != Screen: 2388 | { 2389 | hWnd := oOther.MouseWinID 2390 | If !WinExist("ahk_id " hwnd) 2391 | Return ToolTip("Window not exist", 500) 2392 | WinGet, Min, MinMax, % "ahk_id " hwnd 2393 | If Min = -1 2394 | Return ToolTip("Window minimize", 500) 2395 | WinGetPos, X, Y, W, H, ahk_id %hWnd% 2396 | } 2397 | If thisbutton = Relative window: 2398 | { 2399 | RegExMatch(oDoc.all.item(oevent.sourceIndex + 1).OuterText, "(-*\d+[\.\d+]*).*\s+.*?(-*\d+[\.\d+]*)", p) 2400 | If (p1 + 0 = "" || p2 + 0 = "") 2401 | Return ToolTip("Invalid parametrs", 500) 2402 | BlockInput, MouseMove 2403 | DllCall("SetCursorPos", "Uint", X + Round(W * p1), "Uint", Y + Round(H * p2)) 2404 | } 2405 | Else If thisbutton = Relative client: 2406 | { 2407 | RegExMatch(oDoc.all.item(oevent.sourceIndex + 1).OuterText, "(-*\d+[\.\d+]*).*\s+.*?(-*\d+[\.\d+]*)", p) 2408 | If (p1 + 0 = "" || p2 + 0 = "") 2409 | Return ToolTip("Invalid parametrs", 500) 2410 | GetClientPos(hWnd, caX, caY, caW, caH) 2411 | DllCall("SetCursorPos", "Uint", X + Round(caW * p1) + caX, "Uint", Y + Round(caH * p2) + caY) 2412 | } 2413 | Else 2414 | { 2415 | RegExMatch(oDoc.all.item(oevent.sourceIndex + 1).OuterText, "(-*\d+[\.\d+]*).*\s+.*?(-*\d+[\.\d+]*)", p) 2416 | If (p1 + 0 = "" || p2 + 0 = "") 2417 | Return ToolTip("Invalid parametrs", 500) 2418 | BlockInput, MouseMove 2419 | If thisbutton = Screen: 2420 | DllCall("SetCursorPos", "Uint", p1, "Uint", p2) 2421 | Else If thisbutton = Window: 2422 | DllCall("SetCursorPos", "Uint", X + p1, "Uint", Y + p2) 2423 | Else If thisbutton = Mouse relative control: 2424 | { 2425 | hWnd := oOther.MouseControlID 2426 | If !WinExist("ahk_id " hwnd) 2427 | Return ToolTip("Control not exist", 500) 2428 | WinGetPos, X, Y, W, H, ahk_id %hWnd% 2429 | DllCall("SetCursorPos", "Uint", X + p1, "Uint", Y + p2) 2430 | } 2431 | Else If thisbutton = Client: 2432 | { 2433 | GetClientPos(hWnd, caX, caY, caW, caH) 2434 | DllCall("SetCursorPos", "Uint", X + p1 + caX, "Uint", Y + p2 + caY) 2435 | } 2436 | } 2437 | If isPaused 2438 | { 2439 | BlockInput, MouseMoveOff 2440 | Return 2441 | } 2442 | GoSub, SpotProc 2443 | Sleep 350 2444 | HideMarker(), HideAccMarker() 2445 | BlockInput, MouseMoveOff 2446 | } 2447 | Else If thisid = run_AhkSpyZoom 2448 | AhkSpyZoomShow() 2449 | } 2450 | Else If (ThisMode = "Hotkey" && !Hotkey_Arr("Hook") && !isPaused && tagname ~= "PRE|SPAN") 2451 | Hotkey_Hook(1) 2452 | } 2453 | ondblclick() { 2454 | oevent := oDoc.parentWindow.event.srcElement 2455 | If (oevent.isContentEditable && oevent.tagname != "input" && (rng := oDoc.selection.createRange()).text != "") 2456 | { 2457 | While !t 2458 | rng.moveEnd("character", 1), (SubStr(rng.text, 0) = "_" ? rng.moveEnd("word", 1) 2459 | : (rng.moveEnd("character", -1), t := 1)) 2460 | While t 2461 | rng.moveStart("character", -1), (SubStr(rng.text, 1, 1) = "_" ? rng.moveStart("word", -1) 2462 | : (rng.moveStart("character", 1), t := 0)) 2463 | sel := rng.text, rng.moveEnd("character", StrLen(RTrim(sel)) - StrLen(sel)), rng.select() 2464 | } 2465 | Else If (oevent.tagname = "BUTTON") 2466 | { 2467 | thisid := oevent.id 2468 | oDoc.body.focus() 2469 | If (thisid = "numlock" || thisid = "scrolllock") 2470 | Events.num_scroll(thisid) 2471 | Else If (thisid = "SendCode") 2472 | Events.SendCode() 2473 | Else If (thisid = "SendMode") 2474 | Events.SendMode() 2475 | Else If thisid = pause_button 2476 | Gosub, PausedScript 2477 | Else If thisid = get_styles 2478 | ViewStyles(oevent) 2479 | Else If thisid = run_AhkSpyZoom 2480 | AhkSpyZoomShow() 2481 | Else If thisid = locale_change 2482 | ToolTip(ChangeLocal(hActiveX) GetLangName(hActiveX), 500) 2483 | } 2484 | } 2485 | SendMode() { 2486 | IniWrite(SendMode := {Send:"SendInput",SendInput:"SendPlay",SendPlay:"SendEvent",SendEvent:"Send"}[SendMode], "SendMode") 2487 | SendModeStr := Format("{:L}", SendMode), oDoc.getElementById("SendMode").innerText := SendModeStr 2488 | } 2489 | SendCode() { 2490 | IniWrite(SendCode := {vk:"sc",sc:"none",none:"vk"}[SendCode], "SendCode") 2491 | oDoc.getElementById("SendCode").innerText := SendCode " code" 2492 | } 2493 | num_scroll(thisid) { 2494 | (OnHook := Hotkey_Arr("Hook")) ? Hotkey_Hook(0) : 0 2495 | SendInput, {%thisid%} 2496 | (OnHook ? Hotkey_Hook(1) : 0) 2497 | ToolTip(thisid " " (GetKeyState(thisid, "T") ? "On" : "Off"), 500) 2498 | } 2499 | onfocus() { 2500 | Sleep 100 2501 | Hotkey_Hook(0) 2502 | } 2503 | onblur() { 2504 | Sleep 100 2505 | If (WinActive("ahk_id" hGui) && !isPaused && ThisMode = "Hotkey") 2506 | Hotkey_Hook(1) 2507 | } 2508 | onmouseover() { 2509 | If oMS.Selection 2510 | Return 2511 | oMS.EL := oDoc.parentWindow.event.srcElement 2512 | SetTimer, MS_MouseOver, -50 2513 | } 2514 | onmouseout() { 2515 | MS_Cancel() 2516 | } 2517 | onselectionchange() { 2518 | e := oDoc.parentWindow.event 2519 | oMS.SCX := e.clientX, oMS.SCY := e.clientY 2520 | SetTimer, MS_SelectionCheck, -70 2521 | } 2522 | onselectstart() { 2523 | SetTimer, MS_Cancel, -8 2524 | } 2525 | } 2526 | 2527 | ;) 2528 | -------------------------------------------------------------------------------- /Old/AhkSpy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serzh82saratov/AhkSpy/18816a663030e5bd19a080db024da49c5c5c4c93/Old/AhkSpy.exe -------------------------------------------------------------------------------- /Readme.txt: -------------------------------------------------------------------------------- 1 | version 5.28 2 | -------------------------------------------------------------------------------- /Test/art.test: -------------------------------------------------------------------------------- 1 | ▄████████ ▄█ █▄ ▄█ ▄█▄ ▄████████ ▄███████▄ ▄██ ▄ 2 | ███ ███ ███ ███ ███ ▄███▀ ███ ███ ███ ███ ███ ██▄ 3 | ███ ███ ███ ███ ███▐██▀ ███ █▀ ███ ███ ███▄▄▄███ 4 | ███ ███ ▄███▄▄▄▄███▄▄ ▄█████▀ ███ ███ ███ ▀▀▀▀▀▀███ 5 | ▀███████████ ▀▀███▀▀▀▀███▀ ▀▀█████▄ ▀███████████ ▀█████████▀ ▄██ ███ 6 | ███ ███ ███ ███ ███▐██▄ ███ ███ ███ ███ 7 | ███ ███ ███ ███ ███ ▀███▄ ▄█ ███ ███ ███ ███ 8 | ███ █▀ ███ █▀ ███ ▀█▀ ▄████████▀ ▄████▀ ▀█████▀ 9 | -------------------------------------------------------------------------------- /menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serzh82saratov/AhkSpy/18816a663030e5bd19a080db024da49c5c5c4c93/menu.png --------------------------------------------------------------------------------