Aslak Posted July 25, 2008 Posted July 25, 2008 Hello, I could hardly find what I want in the doc or by searching the forums, so I post my question: Is there a way to get the WinHandle from a window by using it's PID ? I'm in a situation where I have several windows with same titles (and no text) and I must interact with only a certain one. I've got the PID from this window. Any help will be welcomed! aslak
Moderators SmOke_N Posted July 25, 2008 Moderators Posted July 25, 2008 Hello,I could hardly find what I want in the doc or by searching the forums, so I post my question:Is there a way to get the WinHandle from a window by using it's PID ?I'm in a situation where I have several windows with same titles (and no text) and I must interact with only a certain one.I've got the PID from this window.Any help will be welcomed!aslakTopic is clear enough, is the search button? Advanced search ... Keywords you used in your topicResults = http://www.autoitscript.com/forum/index.ph...%2BPID%2BHandle Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Aslak Posted July 25, 2008 Author Posted July 25, 2008 Topic is clear enough, is the search button? Advanced search ... Keywords you used in your topicResults = http://www.autoitscript.com/forum/index.ph...%2BPID%2BHandleOK. I did a "normal" search and got so many results far away from the subject.Will use the Advanced search next time !thanks, and sorry...
Moderators SmOke_N Posted July 25, 2008 Moderators Posted July 25, 2008 OK. I did a "normal" search and got so many results far away from the subject.Will use the Advanced search next time !thanks, and sorry...No problem, I was being a bit of a smart ass...I generally start with this approach:Advanced searchKeywords (usually if I don't know the author I'm looking for, example: +PID+Handle )Author (Only if I know who wrote it)Click Titles onlyChoose a forum if you want (I usually start in the example script forum)Click perform search Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
PsaltyDS Posted July 25, 2008 Posted July 25, 2008 Reformatted SmOke_N's replay for clarity: No problem, I was being a bit of a smart ass... I generally start with this approach. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Moderators SmOke_N Posted July 25, 2008 Moderators Posted July 25, 2008 Reformatted SmOke_N's replay for clarity: Ha... I agree! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Gar Posted October 10, 2008 Posted October 10, 2008 Ironically, now searches for 'WinHandle from PID' turn up this thread about searching for WinHandle from PID... and not the actual answer. That link doesn't work.
dryper Posted October 10, 2008 Posted October 10, 2008 I need help about this to can anyone show how i can do this? Thnx
ProgAndy Posted October 10, 2008 Posted October 10, 2008 Well, you have to search for window handle by PID Then, you get e.g this: http://www.autoitscript.com/forum/index.ph...st&p=523874 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Monamo Posted October 10, 2008 Posted October 10, 2008 Ironically, now searches for 'WinHandle from PID' turn up this thread about searching for WinHandle from PID... and not the actual answer. That link doesn't work.Example using Calculator: #include <Constants.au3> $hWnd = "" $iPID = ProcessExists("calc.exe") If $iPID <> 0 Then $aWinList = WinList() For $i = 1 To $aWinList[0][0] If WinGetProcess($aWinList[$i][0]) = $iPID Then $hWnd = $aWinList[$i][1] ExitLoop EndIf Next EndIf If $hWnd <> "" Then MsgBox(0, 0, WinGetTitle($hWnd) & @CRLF & $hWnd) Else MsgBox(64, "Not Found", "No matching process found.") EndIf - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]
dryper Posted October 10, 2008 Posted October 10, 2008 When i read thats not what i want What i want is to use control send on two application that have the SAME name.. ive figured out the PID thingy but controlSend doesnt work with PIDS, so is there any alternative way to send keystrokes to the specefied PID ?.. Thanks Dryper
Bert Posted October 10, 2008 Posted October 10, 2008 Does the two applications have anything that makes them unique from each other? any text in them that is different? The Vollatran project  My blog: http://www.vollysinterestingshit.com/
ProgAndy Posted October 10, 2008 Posted October 10, 2008 Well.1) Get list of processes and PIDs -> ProcessList ( 2d Array with Names + PIDs)2) For each PID you can get it's UNIQUE window HANDLES -> ProcessGetWindows ( 2d-Array with Titles + Handles)3) Now you can send to the Window identified by HWND, even if they have same title *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
dryper Posted October 10, 2008 Posted October 10, 2008 (edited) ProgAndy srry im nooby i can give the code i got atm $list = ProcessList("wow.exe") Func ToggleHealer() $Paused = NOT $Paused While $Paused ToolTip('Healer is Paused"',0,0) WEnd ToolTip("Healer is Started",0,0) Sleep(1550) ControlSend("World of Warcraft","", $list[1][1] ,"8") EndFunc ControlSend("World of Warcraft","", $list[1][1] ,"8") I want my this function to send Some keystrokes to the specified PID, and i also have another function that sends keystrokes to another session of the application.. How can i do this? Edited October 10, 2008 by dryper
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now