netmastro Posted April 22, 2009 Share Posted April 22, 2009 Hi, I' ve to activate one window that has the same title of another window, so i decided to use the winhandle. After I found the handle of the window with winlist I made my script : AutoItSetOption("WinTitleMatchMode", 4) $handle = "0x0020100" WinActivate ($handle) but doesn't works. Can someone help me ? Many thanks. Netmastro Link to comment Share on other sites More sharing options...
Developers Jos Posted April 22, 2009 Developers Share Posted April 22, 2009 Hi, I' ve to activate one window that has the same title of another window, so i decided to use the winhandle. After I found the handle of the window with winlist I made my script : AutoItSetOption("WinTitleMatchMode", 4) $handle = "0x0020100" WinActivate ($handle)You are specifying a string as handle. How did you get the value for the handle? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted April 22, 2009 Share Posted April 22, 2009 The window handle changes everytime you run the program... Run("notepad.exe") ;#1 WinWaitActive("") $hWnd = WinGetHandle("") Run("notepad.exe") ;#2 WinWaitActive("") WinMove("", "", 100, 100) Sleep(3000) WinActivate($hWnd) ; activates #1 8) Link to comment Share on other sites More sharing options...
netmastro Posted April 23, 2009 Author Share Posted April 23, 2009 You are specifying a string as handle. How did you get the value for the handle? I got the value before through this script : $var = WinList() For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc I know this value change every time the window is opened but this is not important for me because I never close it. Why my script is not working ? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 23, 2009 Developers Share Posted April 23, 2009 Did you try to change the handle to numeric? $handle = 0x0020100 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
netmastro Posted April 23, 2009 Author Share Posted April 23, 2009 Did you try to change the handle to numeric? $handle = 0x0020100 Yeah doesn't works because the exadecimal 0x0020100 is transformed in the decimal number 131328. Any idea ? Netmastro Link to comment Share on other sites More sharing options...
Developers Jos Posted April 23, 2009 Developers Share Posted April 23, 2009 Yeah doesn't works because the exadecimal 0x0020100 is transformed in the decimal number 131328. Any idea ? Netmastroand this?: $handle = "0x0020100" WinActivate (HWnd($handle)) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted April 23, 2009 Share Posted April 23, 2009 and this?: $handle = "0x0020100" WinActivate (HWnd($handle)) Jos, If you run the script from above, it will give two windows with the same title, I think he is trying to "activate" the second window that is a hidden MS-OS window. ... after reading his request again, and running that program, I am sure of it! 8) Link to comment Share on other sites More sharing options...
netmastro Posted April 24, 2009 Author Share Posted April 24, 2009 and this?: $handle = "0x0020100" WinActivate (HWnd($handle)) IS WORKING !!!!! THANK YOU !!!! Thanks all for your patience. Netmastro NassauSky and Bishop12 2 Link to comment Share on other sites More sharing options...
Bishop12 Posted November 21, 2019 Share Posted November 21, 2019 WTF im trying Tofigure out how does autoit can activate a window using Handle and im about 2-3hours figuring out i decided to stop and sleep but i got an i dea lets try to search of winac using handle and boom i found this topic and read carefully what is said and this really help me a lot dammmm thanks guys and also to Autoit for keeping this kind of topic Open ❤️ KUDOS guys 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