AutoHotkey Community

It is currently May 24th, 2012, 9:55 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: April 7th, 2007, 2:00 am 
Offline

Joined: September 7th, 2006, 10:42 am
Posts: 65
Code:
Process, Exist, WolfRat.exe
if !errorlevel
  exitapp
else
{
  WRPID := errorlevel
  errorlevel = 0
}

ControlGet, ChatBox, Hwnd,,SysListView321, ahk_pid%WRPID%, ahk_pid%WRPID%
ControlGet, ChatBoxText, List,,, ahk_id %ChatBox%
msgbox %ChatBoxText%
Return
ChatBoxText has nothing

I also tried
ControlGetPos, X, Y,,,, ahk_id %ChatBox%
and it works just fine


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2007, 9:33 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
I was tempted to react because some parts of the code were fishy: the double ahk_pid without space, the test on a specific program.
But after clean up I tested it on a well known application: the HTML help of AutoHotkey, after the search of a keyword:
Code:
Process Exist, HH.exe
If (errorlevel = 0)
  ExitApp
Else
{
  WRPID := errorlevel
  errorlevel = 0
}
; Get the ID
ControlGet searchResultID, Hwnd, , SysListView321, ahk_pid %WRPID%
; The problematic command
ControlGet count, List, Count, , ahk_id %searchResultID%
ControlGet results, List, Count, , ahk_id %searchResultID%
; Verify the ID is correct
ControlGetPos x, y, w, h, , ahk_id %searchResultID%
MsgBox PID: %WRPID%`nID: %searchResultID%`n# %count%`n%x% %y% %w% %h%`n%results%
; Compare with classical Get
ControlGet count, List, Count, SysListView321, AutoHotkey Help
ControlGet results, List, , SysListView321, AutoHotkey Help
MsgBox # %count%`n%results%
Return
Indeed, I have no results with the ID, so either I miss something myself, or something is broken.
It is documented that "The syntax for ListView retrieval is:
ControlGet, OutputVar, List, Options, SysListView321, WinTitle, WinText
",
so if it is a limitation, I suggest to explicitly state that the ID way doesn't work.

[EDIT] Corrected typos.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Last edited by PhiLho on April 9th, 2007, 10:10 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2007, 10:30 am 
PhiLho wrote:
I was tempted to react because some parts of the code was fishy: the double ahk_pid without space, the test on a specific program.
But after clean up I tested it on a well known application: the HTML help of AutoHotkey, after the search of the keyword:


Guess what, I finally found something that works on win98 and win98se
that does not work on XP!

PhilLho's example code works flawlessly on win98's.

I had the seach results showing in autohotkey help, and PhilLho's example code captured and displayed all the results in the list. :lol:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2007, 10:46 am 
Offline

Joined: September 7th, 2006, 10:42 am
Posts: 65
:roll: thats a first

A similar problem was fixed in the post http://www.autohotkey.com/forum/viewtopic.php?t=12619
thats why I tried the ControlGetPos to see if it wasnt fixed yet, but it worked flawlessly.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2007, 6:39 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
This will be fixed in the next update. The problem affects other commands too, namely ControlGet's FindString/Choice/List, and Control's Add/Delete/Choose.

Thanks for making it easy to reproduce this.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 6th, 2008, 12:20 am 
Hi,

I've been trying this code:

Code:
; This script retrieves the ahk_id (HWND) of the active window's focused control.
; This script requires Windows 98+ or NT 4.0 SP3+.
GuiThreadInfoSize = 48
VarSetCapacity(GuiThreadInfo, GuiThreadInfoSize)
NumPut(GuiThreadInfoSize, GuiThreadInfo, 0)
if not DllCall("GetGUIThreadInfo", uint, 0, str, GuiThreadInfo)
{
    MsgBox GetGUIThreadInfo() indicated a failure.
    return
}
FocusedHWND := NumGet(GuiThreadInfo, 12)  ; Retrieve the hwndFocus field from the struct.
; MsgBox % "The focused control's ahk_id (HWND) is " . FocusedHWND
; This ID can be used all control commands.  For example:
; ControlGetText, OutputVar,, ahk_id %FocusedHWND%

ControlGet string, Selected,,ahk_id %FocusedHWND%


Seems to be affected under Vista 32Bit.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2008, 12:55 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
You are missing a comma.
Quote:
To operate upon a control's HWND (window handle), leave the Control parameter blank and specify ahk_id %ControlHwnd% for the WinTitle parameter


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 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:
Powered by phpBB® Forum Software © phpBB Group