+ cleanup AHK testing script, add test artifacts

This commit is contained in:
Rainer Kottenhoff 2017-10-10 13:55:05 +02:00
parent a3540e47a5
commit eb6772a3f9
7 changed files with 40 additions and 178 deletions

View File

@ -1,178 +0,0 @@
;
; Active Window Info
;
#NoEnv
#NoTrayIcon
#SingleInstance Ignore
SetWorkingDir, %A_ScriptDir%
SetBatchLines, -1
CoordMode, Pixel, Screen
IfExist, ..\toolicon.icl ; Seems useful enough to support standalone operation.
Menu, Tray, Icon, ..\toolicon.icl, 9
try
Hotkey #a, FreezeDisplay
catch
Hotkey #vk41, FreezeDisplay
isUpd := true
txtNotFrozen := "(Win+A to freeze display)"
txtFrozen := "(Win+A to unfreeze display)"
Gui, New, hwndhGui AlwaysOnTop Resize MinSize
Gui, Add, Text,, Window Title, Class and Process:
Gui, Add, Edit, w320 r3 ReadOnly -Wrap vCtrl_Title
Gui, Add, Text,, Mouse Position:
Gui, Add, Edit, w320 r3 ReadOnly vCtrl_MousePos
Gui, Add, Text,, Control Under Mouse Position:
Gui, Add, Edit, w320 r5 ReadOnly vCtrl_MouseCur
Gui, Add, Text,, Active Window Position:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_Pos
Gui, Add, Text,, Status Bar Text:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_SBText
Gui, Add, Checkbox, vCtrl_IsSlow, Slow TitleMatchMode
Gui, Add, Text,, Visible Text:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_VisText
Gui, Add, Text,, All Text:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_AllText
Gui, Add, Text, w320 r1 vCtrl_Freeze, % txtNotFrozen
Gui, Show,, Active Window Info
GetClientSize(hGui, temp)
horzMargin := temp*96//A_ScreenDPI - 320
SetTimer, Update, 250
return
GuiSize:
Gui %hGui%:Default
if !horzMargin
return
ctrlW := A_GuiWidth - horzMargin
list = Title,MousePos,MouseCur,Pos,SBText,VisText,AllText,Freeze
Loop, Parse, list, `,
GuiControl, Move, Ctrl_%A_LoopField%, w%ctrlW%
return
Update:
Gui %hGui%:Default
curWin := WinExist("A")
if (curWin = hGui)
return
WinGetTitle, t1
WinGetClass, t2
WinGet, t3, ProcessName
GuiControl,, Ctrl_Title, % t1 "`nahk_class " t2 "`nahk_exe " t3
CoordMode, Mouse, Screen
MouseGetPos, msX, msY, msWin, msCtrlHwnd, 2
CoordMode, Mouse, Relative
MouseGetPos, mrX, mrY,, msCtrl
CoordMode, Mouse, Client
MouseGetPos, mcX, mcY
GuiControl,, Ctrl_MousePos, % "Absolute:`t" msX ", " msY " (less often used)`nRelative:`t" mrX ", " mrY " (default)`nClient:`t" mcX ", " mcY " (recommended)"
PixelGetColor, mClr, %msX%, %msY%, RGB
mClr := SubStr(mClr, 3)
mText := "`nColor:`t" mClr " (Red=" SubStr(mClr, 1, 2) " Green=" SubStr(mClr, 3, 2) " Blue=" SubStr(mClr, 5) ")"
if (curWin = msWin)
{
ControlGetText, ctrlTxt, %msCtrl%
mText := "ClassNN:`t" msCtrl "`nText:`t" textMangle(ctrlTxt) mText
ControlGetPos cX, cY, cW, cH, %msCtrl%
mText .= "`n`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH
WinToClient(msWin, cX, cY)
GetClientSize(msCtrlHwnd, cW, cH)
mText .= "`nClient:`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH
} else mText := "`n" mText
GuiControl,, Ctrl_MouseCur, % mText
WinGetPos, wX, wY, wW, wH
GetClientSize(curWin, wcW, wcH)
GuiControl,, Ctrl_Pos, % "`tx: " wX "`ty: " wY "`tw: " wW "`th: " wH "`nClient:`t`t`tw: " wcW "`th: " wcH
sbTxt := ""
Loop
{
StatusBarGetText, ovi, %A_Index%
if ovi =
break
sbTxt .= "(" A_Index "):`t" textMangle(ovi) "`n"
}
StringTrimRight, sbTxt, sbTxt, 1
GuiControl,, Ctrl_SBText, % sbTxt
GuiControlGet, bSlow,, Ctrl_IsSlow
if bSlow
{
DetectHiddenText, Off
WinGetText, ovVisText
DetectHiddenText, On
WinGetText, ovAllText
}
else
{
ovVisText := WinGetTextFast(false)
ovAllText := WinGetTextFast(true)
}
GuiControl,, Ctrl_VisText, % ovVisText
GuiControl,, Ctrl_AllText, % ovAllText
return
GuiClose:
ExitApp
WinGetTextFast(detect_hidden)
{
; WinGetText ALWAYS uses the "fast" mode - TitleMatchMode only affects
; WinText/ExcludeText parameters. In Slow mode, GetWindowText() is used
; to retrieve the text of each control.
WinGet controls, ControlListHwnd
static WINDOW_TEXT_SIZE := 32767 ; Defined in AutoHotkey source.
VarSetCapacity(buf, WINDOW_TEXT_SIZE * (A_IsUnicode ? 2 : 1))
text := ""
Loop Parse, controls, `n
{
if !detect_hidden && !DllCall("IsWindowVisible", "ptr", A_LoopField)
continue
if !DllCall("GetWindowText", "ptr", A_LoopField, "str", buf, "int", WINDOW_TEXT_SIZE)
continue
text .= buf "`r`n"
}
return text
}
GetClientSize(hWnd, ByRef w := "", ByRef h := "")
{
VarSetCapacity(rect, 16)
DllCall("GetClientRect", "ptr", hWnd, "ptr", &rect)
w := NumGet(rect, 8, "int")
h := NumGet(rect, 12, "int")
}
WinToClient(hWnd, ByRef x, ByRef y)
{
WinGetPos wX, wY,,, ahk_id %hWnd%
x += wX, y += wY
VarSetCapacity(pt, 8), NumPut(y, NumPut(x, pt, "int"), "int")
if !DllCall("ScreenToClient", "ptr", hWnd, "ptr", &pt)
return false
x := NumGet(pt, 0, "int"), y := NumGet(pt, 4, "int")
return true
}
textMangle(x)
{
if pos := InStr(x, "`n")
x := SubStr(x, 1, pos-1), elli := true
if StrLen(x) > 40
{
StringLeft, x, x, 40
elli := true
}
if elli
x .= " (...)"
return x
}
FreezeDisplay:
Gui %hGui%:Default
isUpd := !isUpd
SetTimer, Update, % isUpd ? "On" : "Off"
GuiControl,, Ctrl_Freeze, % isUpd ? txtNotFrozen : txtFrozen
return

Binary file not shown.

View File

@ -0,0 +1,5 @@
정보화는 통일 비용을 줄이고 성장잠재력을 제고하는 가장 효과적인 방법일 것이다. 따라서 장기적 시각에서 추진전략을 수립해야 하고 단기적으로 성과를 거둘 수 있는 협력 분야를 우선 추진해야 한다. 북한과의 정보통신협력방안은 다양한 방법이 논의될 수 있을 것이다. 우선 인력 물적교류가 없이 기술교류가 가능한 분야가 우선 접촉되고, 상호시너지효과를 거둘 수 있는 분야의 교류가 이뤄질 것이라고 본다.
정보통신분야중 특히 분야의 육성은 비용이 많이 들지 않아, 북한에서는 이미 오래전부터 영재들을 선발하여 집중교육을 시켜왔으며, 그 결과 번역, 음성인식, 그래픽 분야 등은 열악한 환경에도 불구하고 북한이 상당한 수준에 도달해 있는 것으로 알려져 있다.
북한의 분야에서 협력가능한 분야를 강구하던 중 북한의 현황을 조사하게 되었고 협력가능한 분야를 검토하기 위해 수집된 를 국내 일부기술진의 평가를 받아 정리해 보았다.
이번 시연회가 갖는 의미는 단순하게 북한 소프트웨어의 현황을 본다는 차원이 아니라 그동안 우리에게 부분적으로 알려져 있는 북한의 소프트웨어의 실상을 그대로 알리고 각 부문의 소프트웨어의 협력방안을 모색해 보자는데 그 의의가 있다고 하겠다.
비록 제한적인 여건 때문에 많은 소프트웨어를 입수하지 못해 아쉬운 감은 있지만 나름대로 북한의 기술의 정도를 가름할 수 있다는 점에서 북한 소프트웨어 기술의 실상을 알 수 있다고 생각되어 시연회를 갖게 된 것이다.

26
test/txt/regex_find.txt Normal file
View File

@ -0,0 +1,26 @@
In "Find Text" dialog (or "Replace Text" and Regular expression search box ticked),
I can't "Find Previous" this string
(\d\d)\s\1
on this text (for example):
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
03 03 04 05 06 07 08 09
but, "Find Next" is working.
In Notepad2 and Notepad2BE works fine.

9
test/txt/strange.txt Normal file
View File

@ -0,0 +1,9 @@
∘ ○
⌀ ○
∈ ⊥
∘ ⊥
⌀ ⊥