Some code ideas:
Code: Select all
q::
;WinGetTitle, vWinTitle, % "ahk_id " hWnd
WinGetTitle, vWinTitle, A
Clipboard := vWinTitle
MsgBox, % vWinTitle
return
w::
;DetectHiddenWindows, On
DetectHiddenWindows, Off
WinGet, vWinList, List
vOutput := ""
Loop, % vWinList
{
hWnd := vWinList%A_Index%
WinGetTitle, vWinTitle, % "ahk_id " hWnd
;WinGetClass, vWinClass, % "ahk_id " hWnd
;WinGet, vPID, PID, % "ahk_id " hWnd
vOutput .= hWnd " " vWinTitle "`r`n"
}
Clipboard := vOutput
MsgBox, % vOutput
return
e::
vText := "how to store special chars like: " Chr(8730) ;square root sign
MsgBox, % vText
return
r:: ;replace non-Ascii characters (appears accurate but not thoroughly tested)
vText := Clipboard
vDQ := Chr(34)
vOutput := ""
VarSetCapacity(vOutput, StrLen(vText)*2*2)
Loop, Parse, vText
{
vChar := A_LoopField
vIsAscii := !!(Ord(vChar) <= 127)
(vChar = vDQ) && vChar .= vDQ
(vChar = "`t") && vChar := "``t"
(vChar = "`r") && vChar := "``r"
(vChar = "`n") && vChar := "``n"
if (A_Index=1 && vIsAscii)
vPfx := vDQ
else if (A_Index=1) || (vIsAscii && vIsAscii2)
vPfx := ""
else if vIsAscii && !vIsAscii2
vPfx := " " vDQ
else if !vIsAscii && vIsAscii2
vPfx := vDQ " "
else if !vIsAscii && !vIsAscii2
vPfx := " "
vIsAscii2 := vIsAscii
if vIsAscii
vOutput .= vPfx vChar
else
vOutput .= vPfx "Chr(" Ord(vChar) ")"
}
Clipboard := vOutput
MsgBox, % "done"
return
Cheers.