AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

detect a window by its task-id

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
volker



Joined: 07 Mar 2005
Posts: 2

PostPosted: Mon Mar 07, 2005 11:00 am    Post subject: detect a window by its task-id Reply with quote

can anybody help?

i want to send a command to a window. the only infomation that i have is its task id. how can i attach this window?

thanks volker
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Mon Mar 07, 2005 11:11 am    Post subject: Reply with quote

Guess if you call/activate it using this process ID

WinGet [v1.0.12+]
--------------------------------------------------------------------------------
Retrieves a window's unique ID, process ID, process name, or a list of its controls. It can also retrieve a list of all windows matching the specified criteria.

Hast du dich schon im [Deutschen AHK Forum] angemeldet ? Wink
Back to top
Guest






PostPosted: Mon Mar 07, 2005 12:39 pm    Post subject: Reply with quote

sorry bobo,
what i do is the following:

first i start a program like:

Run, notepad.exe , , , PID

the program is running twice and i do not know the window-title

how can i send a command to the program using the PID?

volker

habe mich im deutschen forum angemeldet...
schön, dass ihr daran arbeitet. Very Happy
Back to top
BoBo
Guest





PostPosted: Mon Mar 07, 2005 1:07 pm    Post subject: Reply with quote

WinGet [v1.0.12+]
--------------------------------------------------------------------------------
Retrieves a window's unique ID, process ID, process name, or a list of its controls. It can also retrieve a list of all windows matching the specified criteria.

WinGet, OutputVar [, Cmd, WinTitle, WinText, ExcludeTitle, ExcludeText]

List: Retrieves the unique ID numbers of all existing windows that match the specified WinTitle, WinText, ExcludeTitle, and ExcludeText (to retrieve all windows on the entire system, leave WinTitle and WinText blank but specify Program Manager or a non-existent title for ExcludeTitle). Each ID number is stored in an array element whose name begins with OutputVar's own name, while OutputVar itself is set to the number of retrieved items (0 if none). For example, if OutputVar is MyArray and two matching windows are discovered, MyArray1 will be set to the ID of the first window, MyArray2 will be set to the ID of the second window, and MyArray itself will be set to the number 2.

Code:
SetTitleMatchMode, 2
WinGet, OutputVar, List, - Notepad
Loop, %OutputVar0% ; Anzahl Loops = Anzahl gefundene Notepad Fenster
{
ID := OutputVar%A_Index%
MsgBox, %A_Index%. NotepadID: %ID%
}


Braindump. Untested. Rolling Eyes
Willkommen in der Deutschen AHK-Community Very Happy
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Mon Mar 07, 2005 1:15 pm    Post subject: Reply with quote

Anonymous wrote:
how can i send a command to the program using the PID?

A simpler method was added in v1.0.28. Here is an example:

WinActivate ahk_pid %PID%
Back to top
View user's profile Send private message Send e-mail
volker



Joined: 07 Mar 2005
Posts: 2

PostPosted: Thu Mar 10, 2005 9:00 pm    Post subject: Reply with quote

thanks.. it works...Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group