클립보드에서 마우스 커서 위치에 대한 정보 가져오기(Spy 대체)
5159 단어 WindowsAutoHotkey
명령에 대한 파라미터를 조사하는 것은 매우 번거롭다!
그래서 GUI 표시의 습작을 겸해 Windows Spy 대신 앱을 만들어 봤다.
사용법
이렇게 하면 클립보드에 다음 매개 변수의 명령이 복사됩니다.
sample_uncheck_radiobutton.ahkControl, UnCheck, , Button11, フォルダー オプション ahk_class #32770
그리고 직접 만든 스크립트에 붙여서 쓰면 돼.
소스 코드
MyAutoHotKeySpy.ahk; マウスカーソル位置の各種情報をクリップボードに取得する(WindowsSpyの代替)
; todo: マウスカーソルが重なったら、他の場所にウィンドウを逃がす
; マウスカーソル位置の各種情報を取得(座標=アクティブウィンドウからの相対位置)
GetInfoAtMousePosEx(ByRef X, ByRef Y, ByRef WinHWND, ByRef ControlHWND, ByRef ControlClassNN, ByRef WinTitle, ByRef ControlText, ByRef ClassName, ByRef ProcessName)
{
WM_NCHITTEST=0x84
ERROR=-1
; Get ControlHWND
MouseGetPos,X,Y,WinHWND,ControlHWND,3
lParam := (Y << 16) | X
SendMessage,%WM_NCHITTEST%,0,%lParam%,, ahk_id %ControlHWND%
IfEqual, ErrorLevel,%ERROR%
MouseGetPos,,,,ControlHWND,2
; Get othe info.
MouseGetPos,,,,ControlClassNN
ControlGetText, ControlText, , ahk_id %ControlHWND%
WinGetClass, ClassName, ahk_id %WinHWND%
WinGetTitle, WinTitle, ahk_id %WinHWND%
WinGet, ProcessName, ProcessName, ahk_id %WinHWND%
return True
}
; --- show form
CustomColor = 0x404040 ; RGB
Gui, Color, %CustomColor%
Gui, Font, s11 cWhite
Gui, Add, Text, cRed , [ESC] : Close
Gui, Add, Text, cRed , [WIN]+[SHIFT]+[C] : Copy Information to clipboard
Gui, Add, Text, cLime xm+0, ProcessName:
Gui, Add, Text, vMyProcessName x+4 w400,
Gui, Add, Text, cLime xm+0, Position:
Gui, Add, Text, vMyPosition x+4 w400,
Gui, Add, Text, cLime xm+0, ProcessID:
Gui, Add, Text, vMyPID x+4 w400,
Gui, Add, Text, cLime xm+0, WinTitle:
Gui, Add, Text, vMyWinTitle x+4 w400,
Gui, Add, Text, cLime xm+0, ClassName:
Gui, Add, Text, vMyClassName x+4 w400,
Gui, Add, Text, cYellow xm+0, ControlName:
Gui, Add, Text, vMyControlName x+4 w400,
Gui, Add, Text, cYellow xm+0, ControlHWND:
Gui, Add, Text, vMyControlHWND x+4 w400,
Gui, Add, Text, cYellow xm+0, ControlText:
Gui, Add, Text, vMyControlText x+4 w400 r2,
Gui +AlwaysOnTop +LastFound ; Make it always-on-top and make it the last found window.
Opacity=210
Winset, Transparent, %Opacity%
Gui, -Caption ; Remove the borders. Due to a quirk in Windows, this must be done after transparency.
Gosub, UpdateInfo
Gui, Show, x32 y32
Menu, RightClickMenu, Add, Sample Code: Click Control, MakeSnippetControlClick
Menu, RightClickMenu, Add, Sample Code: Click Position, MakeSnippetClickPosition
Menu, RightClickMenu, Add, Sample Code: Wait Window, MakeSnippetWinWait
Menu, RightClickMenu, Add, Sample Code: Send Keys to Control , MakeSnippetControlSend
Menu, RightClickMenu, Add, Sample Code: Check (Radio Button or CheckBox), MakeSnippetCheckButton
Menu, RightClickMenu, Add, Sample Code: UnCheck (Radio Button or CheckBox), MakeSnippetUnCheckButton
Menu, RightClickMenu, Add, Copy All Information, CopyAllInformation
SetTimer, UpdateInfo, 250
return
; --- Event Handler
UpdateInfo:
GetInfoAtMousePosEx(_MouseX, _MouseY, _WinHWND, _ControlHWND, _ControlClassNN, _WinTitle, _ControlText, _ClassName, _ProcessName)
GuiControl,, MyPosition, X%_MouseX%, Y%_MouseY%
GuiControl,, MyPID, %_WinHWND%
GuiControl,, MyWinTitle, %_WinTitle%
GuiControl,, MyControlName, %_ControlClassNN%
GuiControl,, MyControlText, %_ControlText%
GuiControl,, MyClassName, %_ClassName%
GuiControl,, MyControlHWND, %_ControlHWND%
GuiControl,, MyProcessName, %_ProcessName%
return
GuiEscape:
GuiClose:
ExitApp
; --- Right Click Menu
; --- WIN+SHIFT+C で、カーソル位置の情報を取得する
GuiContextMenu:
#+c::
GetInfoAtMousePosEx(MouseX, MouseY, WinHWND, ControlHWND, ControlClassNN, WinTitle, ControlText, ClassName, ProcessName)
Menu, RightClickMenu, Show
return
MakeSnippetCheckButton:
Clipboard=
(
Control, Check, , %ControlClassNN%, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetUnCheckButton:
Clipboard=
(
Control, UnCheck, , %ControlClassNN%, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetWinWait:
Clipboard=
(
WinWait, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetControlClick:
Clipboard=
(
ControlClick, %ControlClassNN%, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetClickPosition:
Clipboard=
(
ControlClick, x%MouseX% y%MouseY%, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetControlSend:
Clipboard=
(
ControlSend, %ControlClassNN%, {Space}, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
CopyAllInformation:
Clipboard=
(
Text= (X%MouseX%, Y%MouseY%)
PID= %WinHWND%
WinTitle= %WinTitle%
ControlName= %ControlClassNN%
ControlText= %ControlText%
ClassName= %ClassName%
ControlHWND= %ControlHWND%
ProcessName= %ProcessName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
Reference
이 문제에 관하여(클립보드에서 마우스 커서 위치에 대한 정보 가져오기(Spy 대체)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/rohinomiya/items/9dd1736cd79c0e8fd2d2
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Control, UnCheck, , Button11, フォルダー オプション ahk_class #32770
MyAutoHotKeySpy.ahk
; マウスカーソル位置の各種情報をクリップボードに取得する(WindowsSpyの代替)
; todo: マウスカーソルが重なったら、他の場所にウィンドウを逃がす
; マウスカーソル位置の各種情報を取得(座標=アクティブウィンドウからの相対位置)
GetInfoAtMousePosEx(ByRef X, ByRef Y, ByRef WinHWND, ByRef ControlHWND, ByRef ControlClassNN, ByRef WinTitle, ByRef ControlText, ByRef ClassName, ByRef ProcessName)
{
WM_NCHITTEST=0x84
ERROR=-1
; Get ControlHWND
MouseGetPos,X,Y,WinHWND,ControlHWND,3
lParam := (Y << 16) | X
SendMessage,%WM_NCHITTEST%,0,%lParam%,, ahk_id %ControlHWND%
IfEqual, ErrorLevel,%ERROR%
MouseGetPos,,,,ControlHWND,2
; Get othe info.
MouseGetPos,,,,ControlClassNN
ControlGetText, ControlText, , ahk_id %ControlHWND%
WinGetClass, ClassName, ahk_id %WinHWND%
WinGetTitle, WinTitle, ahk_id %WinHWND%
WinGet, ProcessName, ProcessName, ahk_id %WinHWND%
return True
}
; --- show form
CustomColor = 0x404040 ; RGB
Gui, Color, %CustomColor%
Gui, Font, s11 cWhite
Gui, Add, Text, cRed , [ESC] : Close
Gui, Add, Text, cRed , [WIN]+[SHIFT]+[C] : Copy Information to clipboard
Gui, Add, Text, cLime xm+0, ProcessName:
Gui, Add, Text, vMyProcessName x+4 w400,
Gui, Add, Text, cLime xm+0, Position:
Gui, Add, Text, vMyPosition x+4 w400,
Gui, Add, Text, cLime xm+0, ProcessID:
Gui, Add, Text, vMyPID x+4 w400,
Gui, Add, Text, cLime xm+0, WinTitle:
Gui, Add, Text, vMyWinTitle x+4 w400,
Gui, Add, Text, cLime xm+0, ClassName:
Gui, Add, Text, vMyClassName x+4 w400,
Gui, Add, Text, cYellow xm+0, ControlName:
Gui, Add, Text, vMyControlName x+4 w400,
Gui, Add, Text, cYellow xm+0, ControlHWND:
Gui, Add, Text, vMyControlHWND x+4 w400,
Gui, Add, Text, cYellow xm+0, ControlText:
Gui, Add, Text, vMyControlText x+4 w400 r2,
Gui +AlwaysOnTop +LastFound ; Make it always-on-top and make it the last found window.
Opacity=210
Winset, Transparent, %Opacity%
Gui, -Caption ; Remove the borders. Due to a quirk in Windows, this must be done after transparency.
Gosub, UpdateInfo
Gui, Show, x32 y32
Menu, RightClickMenu, Add, Sample Code: Click Control, MakeSnippetControlClick
Menu, RightClickMenu, Add, Sample Code: Click Position, MakeSnippetClickPosition
Menu, RightClickMenu, Add, Sample Code: Wait Window, MakeSnippetWinWait
Menu, RightClickMenu, Add, Sample Code: Send Keys to Control , MakeSnippetControlSend
Menu, RightClickMenu, Add, Sample Code: Check (Radio Button or CheckBox), MakeSnippetCheckButton
Menu, RightClickMenu, Add, Sample Code: UnCheck (Radio Button or CheckBox), MakeSnippetUnCheckButton
Menu, RightClickMenu, Add, Copy All Information, CopyAllInformation
SetTimer, UpdateInfo, 250
return
; --- Event Handler
UpdateInfo:
GetInfoAtMousePosEx(_MouseX, _MouseY, _WinHWND, _ControlHWND, _ControlClassNN, _WinTitle, _ControlText, _ClassName, _ProcessName)
GuiControl,, MyPosition, X%_MouseX%, Y%_MouseY%
GuiControl,, MyPID, %_WinHWND%
GuiControl,, MyWinTitle, %_WinTitle%
GuiControl,, MyControlName, %_ControlClassNN%
GuiControl,, MyControlText, %_ControlText%
GuiControl,, MyClassName, %_ClassName%
GuiControl,, MyControlHWND, %_ControlHWND%
GuiControl,, MyProcessName, %_ProcessName%
return
GuiEscape:
GuiClose:
ExitApp
; --- Right Click Menu
; --- WIN+SHIFT+C で、カーソル位置の情報を取得する
GuiContextMenu:
#+c::
GetInfoAtMousePosEx(MouseX, MouseY, WinHWND, ControlHWND, ControlClassNN, WinTitle, ControlText, ClassName, ProcessName)
Menu, RightClickMenu, Show
return
MakeSnippetCheckButton:
Clipboard=
(
Control, Check, , %ControlClassNN%, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetUnCheckButton:
Clipboard=
(
Control, UnCheck, , %ControlClassNN%, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetWinWait:
Clipboard=
(
WinWait, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetControlClick:
Clipboard=
(
ControlClick, %ControlClassNN%, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetClickPosition:
Clipboard=
(
ControlClick, x%MouseX% y%MouseY%, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
MakeSnippetControlSend:
Clipboard=
(
ControlSend, %ControlClassNN%, {Space}, %WinTitle% ahk_class %ClassName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
CopyAllInformation:
Clipboard=
(
Text= (X%MouseX%, Y%MouseY%)
PID= %WinHWND%
WinTitle= %WinTitle%
ControlName= %ControlClassNN%
ControlText= %ControlText%
ClassName= %ClassName%
ControlHWND= %ControlHWND%
ProcessName= %ProcessName%
)
TrayTip, クリップボードにコピーしました, %Clipboard%
return
Reference
이 문제에 관하여(클립보드에서 마우스 커서 위치에 대한 정보 가져오기(Spy 대체)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/rohinomiya/items/9dd1736cd79c0e8fd2d2텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)