raca Posted May 23, 2006 Share Posted May 23, 2006 I'm codding a program to close a dialog opened by a program. I can easily close the dialog.. but i wanna give the focus to the window active before the dialog opened how can i do it? Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 23, 2006 Share Posted May 23, 2006 I'm codding a program to close a dialog opened by a program.I can easily close the dialog.. but i wanna give the focus to the window active before the dialog openedhow can i do it?HI,if you have got the title, use WinActivate().So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Bundy Posted May 23, 2006 Share Posted May 23, 2006 Hi! I wrote something like this Func getActiveApp() $var = WinList() For $i = 1 To $var[0][0] $active = WinActive($var[$i][0]) If $active == 1 And $var [$i][0] <> "" Then $title = $var[$i][0] ExitLoop EndIf Next $aktywne = $title Return $aktywne EndFunc ;==>getActiveApp Link to comment Share on other sites More sharing options...
raca Posted May 23, 2006 Author Share Posted May 23, 2006 but that way the active window is the dialog opened. i want to give the focus to the previous active window. is there a simple way to get the list of the windows of the ALT+TAB it has the last active window Link to comment Share on other sites More sharing options...
Bundy Posted May 24, 2006 Share Posted May 24, 2006 But You can get active window earlier and then WinWaitActive(Your_Dialog_Box). (I think You can ) Link to comment Share on other sites More sharing options...
dabus Posted May 24, 2006 Share Posted May 24, 2006 Bundy is right. Run this in Scite. $OldWin=WinGetTitle('') While 1 $NewWin = WinGetTitle('') If $NewWin='' OR $NewWin = 'program manager' Then ContinueLoop If $NewWin = $OldWin Then Sleep (100) Else ConsoleWrite('Old Window was ' & $OldWin&@CR) $OldWin=$NewWin EndIf WEnd Exit Link to comment Share on other sites More sharing options...
raca Posted May 24, 2006 Author Share Posted May 24, 2006 (edited) thanks here is the script... it closes the annoying dialog that bores me $OldWin=WinGetTitle("") While 1 If WinExists("Profile storage space") Then ;closes the window WinClose("Profile storage space") ;restores the focus WinActivate($OldWin) Else $OldWin=WinGetTitle("") EndIf Sleep(100) WEnd cheers Edited May 24, 2006 by raca Link to comment Share on other sites More sharing options...
Bundy Posted May 24, 2006 Share Posted May 24, 2006 You should use some Ad-Aware scanner not write script ;p Link to comment Share on other sites More sharing options...
raca Posted May 24, 2006 Author Share Posted May 24, 2006 You should use some Ad-Aware scanner not write script ;pdidn't get it Link to comment Share on other sites More sharing options...
raca Posted May 24, 2006 Author Share Posted May 24, 2006 better version $OldWin=WinGetTitle("") $oldControl=ControlGetFocus($OldWin) While 1 If WinExists("Profile storage space") Then ;fecha a janela WinClose("Profile storage space") ;restora o focus ControlFocus ($OldWin,"",$oldControl) Else $OldWin=WinGetTitle("") $oldControl=ControlGetFocus ($OldWin) EndIf Sleep(100) WEnd 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