AutoHotkey Community

It is currently May 27th, 2012, 6:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 10th, 2009, 10:37 am 
Offline

Joined: July 15th, 2005, 3:19 pm
Posts: 140
Location: Denmark
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 5th, 2009, 2:17 am 
Offline

Joined: May 31st, 2008, 3:22 pm
Posts: 47
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)

Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 6th, 2009, 2:12 pm 
Offline

Joined: May 31st, 2008, 3:22 pm
Posts: 47
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 6th, 2009, 8:49 pm 
Offline

Joined: August 13th, 2006, 6:45 am
Posts: 355
Location: Germany
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2009, 6:48 pm 
Offline

Joined: May 31st, 2008, 3:22 pm
Posts: 47
^^ huge thanks hd0202 it's work, that very very fucn good!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2010, 1:25 am 
Offline

Joined: November 6th, 2010, 12:17 am
Posts: 2
Here's a short version of the code posted by Tigerite, without separate function definitions. It is following the article http://www.codeproject.com/KB/threads/int64_memsteal.aspx and uses the lvItem structure implementation posted by Solar (http://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%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 25th, 2012, 11:03 pm 
Offline

Joined: May 31st, 2008, 3:22 pm
Posts: 47
peanut wrote:
Here's a short version of the code posted by Tigerite,


thank you he find all lines but in msgbox only first 1, how make all find 15 to
FileAppend?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2012, 6:21 pm 
Offline

Joined: November 6th, 2010, 12:17 am
Posts: 2
To read 15 lines of the column and append them to a file, you could do sth. like this (untested):
You replace
Code:
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)

with:
Code:
Loop, 15 {
  r := a_index -1 ; 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)
  FileAppend, %t%`n, C:\My Documents\Test.txt
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, HotkeyStick, Wicked and 57 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Group