horohoro Posted April 20, 2011 Share Posted April 20, 2011 Hi all, i have a problem i dont know how to access 2 controls with the same classes. I have for example a program opened 2 times. If i try to access a control from it doesent click on the class i want because there is the second instance with the same class. Please anyone if know how to solve this problem i will thank very much. Have a nice night all and sorry for my very bad english Link to comment Share on other sites More sharing options...
wakillon Posted April 20, 2011 Share Posted April 20, 2011 Hi all, i have a problem i dont know how to access 2 controls with the same classes. I have for example a program opened 2 times. If i try to access a control from it doesent click on the class i want because there is the second instance with the same class. Please anyone if know how to solve this problem i will thank very much. Have a nice night all and sorry for my very bad englishTake a look to from PsaltyDS by this way you will differenciate the 2 windows with same class AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
horohoro Posted April 20, 2011 Author Share Posted April 20, 2011 (edited) I tried : $pid = processexists("notepad.exe") $vis = WinHandFromPID($pid, "", 8) msgbox(0,0, $vis[1]) and nothing returns only an error of function. I dont know how to use the function can you please post an example ? Edited April 20, 2011 by horohoro Link to comment Share on other sites More sharing options...
wakillon Posted April 21, 2011 Share Posted April 21, 2011 There is also this way ! #Include <Array.au3> #Include <WinAPIEx.au3> $_Pid = ProcessExists ( 'notepad.exe' ) $Data = _WinAPI_EnumProcessWindows ( $_Pid ) If IsArray ( $Data ) Then _ArrayDisplay ( $Data, '_WinAPI_EnumProcessWindows' ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
horohoro Posted April 21, 2011 Author Share Posted April 21, 2011 #Include <WinAPIEx.au3>The header file winapiex.au3 is not present in my autoit dir and the code returns error"C:\Documents and Settings\HOROHORO-Killer\Desktop\new.au3 (5) : ==> Unknown function name.:$Data = _WinAPI_EnumProcessWindows ( $_Pid )"Can you please tell me where i can find WinAPIEx.au3 download link because is not included in autoit install kit Link to comment Share on other sites More sharing options...
wakillon Posted April 21, 2011 Share Posted April 21, 2011 Do you know Google search ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
horohoro Posted April 21, 2011 Author Share Posted April 21, 2011 (edited) Do you know Google search ? msgbox(0,0, $Data[1][0]) Thanks for the link but the only thing returns is : Row | Col 0 | Col 1 [0] | 1 [1] | 0x000B038C | Notepad What can i do with this info ? 0x000B is the handle of wich class? I have two notepad open and thats the only info it gives me Edited April 21, 2011 by horohoro Link to comment Share on other sites More sharing options...
wakillon Posted April 21, 2011 Share Posted April 21, 2011 yes it return the handle of the window and his title !like this you can send command to a precise windowand not to the both ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
horohoro Posted April 21, 2011 Author Share Posted April 21, 2011 (edited) I think it should return 2 handles of window because i have two notepads opened. Each window has a different hwnd and it returns only one and the same. I am still confused Edited April 21, 2011 by horohoro Link to comment Share on other sites More sharing options...
horohoro Posted April 21, 2011 Author Share Posted April 21, 2011 (edited) Do you have an idea how can i discover all the class names beginning with a certain string? I ask you this coz my program changes his window class with a string like this "adt:css:$randomnumbers" everytime i open it. Edited April 21, 2011 by horohoro Link to comment Share on other sites More sharing options...
wakillon Posted April 21, 2011 Share Posted April 21, 2011 I think it should return 2 handles of window because i have two notepads opened. Each window has a different hwnd and it returns only one and the same. I am still confused 1 you must run 1 instance of notepad and get his handle2 you run second instance of notepad and get the second hanle... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
horohoro Posted April 21, 2011 Author Share Posted April 21, 2011 (edited) I only need to discover hwnd-s when are both opened at the same time. Thanks anyway coz u offered to help me up here. Edited April 21, 2011 by horohoro Link to comment Share on other sites More sharing options...
Tsukihime Posted April 21, 2011 Share Posted April 21, 2011 1 you must run 1 instance of notepad and get his handle2 you run second instance of notepad and get the second hanle...So I gather that it is not possible to get the handle of a specific window given that there are multiple instances of it? Link to comment Share on other sites More sharing options...
wakillon Posted April 21, 2011 Share Posted April 21, 2011 (edited) I only need to discover hwnd-s when are both opened at the same time. Thanks anyway coz u offered to help me up here.I don't see how differenciate both windows if they have same class, same title and if you don't know which pid correspond to any window ! What's type of soft window ?who start this processes ? Edited April 21, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
horohoro Posted April 21, 2011 Author Share Posted April 21, 2011 (edited) I don't see how differenciate both windows if they have same class, same title and if you don't know which pid correspond to any window ! What's type of soft window ?who start this processes ?I open the software manually and his window class name is changing everytime i open it to a fixed string combined with some random numbers. The program have the same title everytime i open a new instance. Edited April 21, 2011 by horohoro Link to comment Share on other sites More sharing options...
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