 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
David Andersen
Joined: 15 Jul 2005 Posts: 140 Location: Denmark
|
Posted: Tue Feb 10, 2009 9:37 am Post subject: |
|
|
| Would this work for label controls as well. I have one named ThunderRT6UserControlDC10 (if this gives you a hint). Using OCR is not an option for me as the window is always hidden behind other windows. |
|
| Back to top |
|
 |
ahkiot0
Joined: 31 May 2008 Posts: 36
|
Posted: Tue May 05, 2009 1:17 am Post subject: |
|
|
i add that to script, but that not comfy
| Code: | F4::
pList = ahk_class TPlayerListForm
WinGet, active_id, ID, %pList%
;WinGet, active_id, ID, ahk_class TPlayerListForm
;MsgBox, The active window's ID is "%a_id%".
p0 := GetListViewItemText(0, 2, "TListView1", active_id)
p1 := GetListViewItemText(1, 2, "TListView1", active_id)
p2 := GetListViewItemText(2, 2, "TListView1", active_id)
p3 := GetListViewItemText(3, 2, "TListView1", active_id)
p4 := GetListViewItemText(4, 2, "TListView1", active_id)
p5 := GetListViewItemText(5, 2, "TListView1", active_id)
MsgBox %p0%`n %p1%`n %p2%`n %p3%`n %p4%`n %p5%
Return |
then i try make loop (coz i dont know how many column and string possible)
| Code: |
F3::
pList = ahk_class TPlayerListForm
WinGet, active_id, ID, %pList%
;MsgBox, The active window's ID is "%a_id%".
Loop, 3
p0 := GetListViewItemText(%A_Index%, %A_Index%, "TListView1", active_id)
MsgBox, %p0%
|
sorry for my stupidity, mb anyone help make.. need get all text info, but i dont know how many
for example there 6 players but, i dunno how many join after minute
(so i dont understand how create loop for subj function)
 |
|
| Back to top |
|
 |
ahkiot0
Joined: 31 May 2008 Posts: 36
|
Posted: Sat Jun 06, 2009 1:12 pm Post subject: |
|
|
somebody help!
so how get all column and save to file (if dont know how many players be?)
| Code: | ;Eight Column (yet, get for first player, how make loop?)
F3::
pList = ahk_class TPlayerListForm
WinGet, active_id, ID, %pList%
;MsgBox, The active window's ID is "%a_id%".
Loop, 8
{
FormatTime, 2DnT,, ddMMyy,HH-mm-sss
p0 := GetListViewItemText(0, A_Index, "TListView1", active_id)
MsgBox, %p0% `n%A_Index% is %A_LoopField%
IniWrite, %A_LoopField%, %A_ScriptDir%\PlayerS.ini, %2DnT%, %A_LoopField%
}
MsgBox %p0%`n
Return |
and problem with A_Index, he count from 1 need from 0 |
|
| Back to top |
|
 |
hd0202
Joined: 13 Aug 2006 Posts: 265 Location: Germany
|
Posted: Sat Jun 06, 2009 7:49 pm Post subject: |
|
|
Here is my solution, I tested it with an other listview.
| Code: | ;Eight Columns for every player
F3::
WinGet, active_id, ID, Player info
;MsgBox, The active window's ID is "%active_id%".
class = TListView1
keys = Name,Frags,Ping,Team,ngStats,Mesh,Skin,Face
stringsplit, key, keys, `,
Loop
{
outer_index := a_index - 1
FormatTime, 2DnT,, ddMMyy,HH-mm-sss ; used as section in ini
Loop, 8
{
p0 := GetListViewItemText(outer_index, A_Index - 1, class, active_id)
if p0 =
{
p0 = error ; end of listview
break
}
MsgBox, Column %A_Index% in Row %outer_index% is %p0%
IniWrite, %p0%, %A_ScriptDir%\PlayerS.ini, %2DnT%, % key%A_Index%
}
if p0 = error
break
sleep, 1000 ; to get new section for every row
}
|
I hope this can help.
Hubert |
|
| Back to top |
|
 |
ahkiot0
Joined: 31 May 2008 Posts: 36
|
Posted: Wed Jun 17, 2009 5:48 pm Post subject: |
|
|
| ^^ huge thanks hd0202 it's work, that very very fucn good! |
|
| Back to top |
|
 |
peanut
Joined: 05 Nov 2010 Posts: 1
|
Posted: Sat Nov 06, 2010 12:25 am Post subject: |
|
|
Here's a short version of the code posted by Tigerite, without separate function definitions. It is following the article www.codeproject.com/KB/threads/int64_memsteal.aspx and uses the lvItem structure implementation posted by Solar (www.autohotkey.com/forum/topic45234.html).
| Code: | DetectHiddenWindows, On
WinTitle := "title of the target window"
SendMessage, 0x1004, 1, 0, TListView1, %WinTitle% ; gives the no. of rows
MsgBox %ErrorLevel% lines
ControlGet, hListView, Hwnd, , TListView1, %WinTitle%
DllCall("GetWindowThreadProcessId", UInt,hListView, UIntP,dwProcessId)
hProcess := DllCall("OpenProcess", UInt,0x001F0FFF, Int,false, UInt,dwProcessId) ; 0x001F0FFF = PROCESS_ALL_ACCESS
lpProcessBuf1 := DllCall("VirtualAllocEx", UInt,hProcess, UInt,NULL, UInt,28, UInt,0x1000, UInt,4)
; 28 = size of lvItem, 0x1000 = MEM_COMMIT, 4 = PAGE_READWRITE
lpProcessBuf2 := DllCall("VirtualAllocEx", UInt,hProcess, UInt,NULL, UInt,512, UInt,0x1000, UInt,4) ; text buffer
VarSetCapacity(t, 511, 1)
VarSetCapacity(lvItem, 28)
NumPut(1, lvItem, 0) ; mask
NumPut(0, lvItem, 4) ; iItem 0 means the first row; anyhow, when sending the LVM_GETITEMTEXT message, we can specify a different item
NumPut(0, lvItem, 8) ; iSubItem 0 means the first column
NumPut(lpProcessBuf2, lvItem, 20) ; pszText
NumPut(512, lvItem, 24) ; cchTextMax
DllCall("WriteProcessMemory", UInt,hProcess, UInt,lpProcessBuf1, UInt,&lvItem, UInt,28, UInt,NULL)
r := 0 ; choice of the row
SendMessage, 0x102d, %r%, %lpProcessBuf1%, TListView1, %WinTitle% ; 0x102d = LVM_GETITEMTEXT
DllCall("ReadProcessMemory", UInt,hProcess, UInt,lpProcessBuf2, UInt,&t, UInt,512, UInt,NULL)
DllCall("VirtualFreeEx", UInt,hProcess, UInt,lpProcessBuf1, UInt,0, UInt,0x8000) ; 0x8000 = MEM_RELEASE
DllCall("VirtualFreeEx", UInt,hProcess, UInt,lpProcessBuf2, UInt,0, UInt,0x8000)
DllCall("CloseHandle", UInt,hProcess)
MsgBox %t% |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|