talss Posted November 27, 2008 Share Posted November 27, 2008 My script switches between windows,and i want him to switch - and go back(give focus) to the original window. so i tried this algorithem: $windows = WinList() for $i = 0 to Ubound($windows)-1 Step +1 $check = WinActive($windows[$i][0]) if $check == 1 Then ExitLoop EndIf Next Etc...Code... WinActivate($windows[$check][0]) and it's not working,what should I do? Sometimes when I check with MsgBox which window was active it writes :"Task Switching". or somtimes even " " - empty string. Link to comment Share on other sites More sharing options...
talss Posted November 27, 2008 Author Share Posted November 27, 2008 You didn't understand what I meant to do. 1)I want to check which window has focus now. 2)Remember its title. 3)Perform a code. 4)Give focus to that window again using WinActivate(); Link to comment Share on other sites More sharing options...
talss Posted November 27, 2008 Author Share Posted November 27, 2008 Man,It doesn't help me, I want to see which window has focus now. how do I do it? Link to comment Share on other sites More sharing options...
oMBRa Posted November 27, 2008 Share Posted November 27, 2008 Global $tName = '' MsgBox(0, '', WhoIsActive()) Func WhoIsActive() Local $List = WinList() For $x = 1 To $List[0][0] If $List[$x][0] <> "" And IsActive($List[$x][1]) Then $tName = $List[$x][0] Return $tName ExitLoop EndIf Next EndFunc ;==>WhoIsActive Func IsActive($Handle) If BitAND(WinGetState($Handle), 8) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsActive Link to comment Share on other sites More sharing options...
BrettF Posted November 27, 2008 Share Posted November 27, 2008 (edited) Man,It doesn't help me, I want to see which window has focus now. how do I do it?WinGetHandle("[ACTIVE]", "") Cheers, Brett Edited November 27, 2008 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
oMBRa Posted November 27, 2008 Share Posted November 27, 2008 WinGetHandle("[ACTIVE]", "") Cheers, Brett xD I have forgotten it Link to comment Share on other sites More sharing options...
talss Posted November 27, 2008 Author Share Posted November 27, 2008 Global $tName = '' MsgBox(0, '', WhoIsActive()) Func WhoIsActive() Local $List = WinList() For $x = 1 To $List[0][0] If $List[$x][0] <> "" And IsActive($List[$x][1]) Then $tName = $List[$x][0] Return $tName ExitLoop EndIf Next EndFunc ;==>WhoIsActive Func IsActive($Handle) If BitAND(WinGetState($Handle), 8) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsActiveThank u very much! 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