slightly_abnormal Posted March 12, 2006 Share Posted March 12, 2006 (edited) I'm looking to close a particular window.. by pressing a hotkey.. e.g. pressing alt+esc which will close the currently active/selected window.. and no others unless they active too.mixing shekanders script with autoitkings script would get it?shekander (minimizes "any window" to tray")http://www.autoitscript.com/forum/index.php?showtopic=20153 autoitkings ("closes" all open windows)http://www.autoitscript.com/forum/index.php?showtopic=22915dagamnit! cant cahnge the title it's supposed to be close active/selected window with hotkey. Edited March 12, 2006 by slightly_abnormal Link to comment Share on other sites More sharing options...
cdkid Posted March 12, 2006 Share Posted March 12, 2006 WinClose('') should work ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Author Share Posted March 12, 2006 (edited) WinClose('') should work ~cdkid okay.. that seems easier now how do i get this into a loop so it wont quit itself, and keep running until i close it. i dont know if it works.. ? Global $Paused HotKeySet("{f12}", "closewindow") Func closewindow() WinClose('') EndFunc Edited March 12, 2006 by slightly_abnormal Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Author Share Posted March 12, 2006 WinClose('') should work ~cdkid stuck it in one of my apps, and it didn't work.. i also tried Global $Paused HotKeySet("{f12}", "closewindow") Func closewindow() opt ("WinTitleMatchMode",2) WinActive("","") Send("!f4") EndFunc Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 12, 2006 Share Posted March 12, 2006 (edited) try something like do CODE GOES HERE until $GUI_EVENT_CLOSE something wtih an if statement or a while statement Edited March 12, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
cdkid Posted March 12, 2006 Share Posted March 12, 2006 HotKeySet("{f12}","closewindow") While 1 sleep(1000) WEnd func closewindow() WinKill('') endfunc umm, dont use it if u have the desktop active, it'll kill Program Manager, which is never a good thing... other than that, it should work. ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Author Share Posted March 12, 2006 HotKeySet("{f12}","closewindow") While 1 sleep(1000) WEnd func closewindow() WinKill('') endfunc umm, dont use it if u have the desktop active, it'll kill Program Manager, which is never a good thing... other than that, it should work. ~cdkid does it work for you? Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 12, 2006 Share Posted March 12, 2006 (edited) i take that back Edited March 12, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 12, 2006 Moderators Share Posted March 12, 2006 This isn't a really good idea IMHO! You freaked when my UDF closed alot of your windows.... At least at the time it was in a semi controled enviroment (More so now). 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. Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Author Share Posted March 12, 2006 (edited) This isn't a really good idea IMHO!You freaked when my UDF closed alot of your windows.... At least at the time it was in a semi controled enviroment (More so now).um.. this is a support forum. hello!!I didn't freak. i didn't expect it to try to kill everything, since that wasn't what it was intended for Edited March 12, 2006 by slightly_abnormal Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 12, 2006 Moderators Share Posted March 12, 2006 um.. this is a support forum. hello!!I didn't freak. i didn't expect it to try to kill everything, since that wasn't what it was intended for now please help another fellow "autoit" user out.Nah... after that comment, you can help yourself, or get it from someone else... Cheers!P.S.... IMHO = In My Humble Opinion ... meaning - If you could explain in a bit more detail of closing every singel active window (WinGetTitle('') << gets every active window ... Visible or Not) (You might/will find... that some of the 'windows' you can't see, are pertinent to every day activity of the programs you "might" not want to close). I wrote a UDF to do this already (Controled)... Not the one that shut down your windows in a former script. 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. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 12, 2006 Share Posted March 12, 2006 (edited) HotKeySet("{ESC}","terminate") HotKeySet("{f12}","close") Func close() $close = WinGetTitle('') winclose($close) EndFunc Func terminate() Exit EndFunc While 1 Sleep(100) WEnd Exit Edited March 12, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Author Share Posted March 12, 2006 HotKeySet("{ESC}","terminate") HotKeySet("{f12}","close") Func close() $close = WinGetTitle('') winclose($close) EndFunc Func terminate() Exit EndFunc While 1 Sleep(100) WEnd Exit by the way pussy its not his problem you ran the script, it didnt effect anything so shut the hell up and stop moaning and bitching like some PMSing whore jesus christ Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 12, 2006 Share Posted March 12, 2006 (edited) DELETED Edited March 12, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Author Share Posted March 12, 2006 <nonsence> Link to comment Share on other sites More sharing options...
cdkid Posted March 12, 2006 Share Posted March 12, 2006 (edited) This isn't a really good idea IMHO!You freaked when my UDF closed alot of your windows.... At least at the time it was in a semi controled enviroment (More so now).I know it's not a good idea, i'm just helpin out. If he kills a window he wasnt supposed to, it's not my fault, he asked for the script.-- ~cdkid Edited March 12, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Author Share Posted March 12, 2006 I know it's not a good idea, i'm just helpin out. If he kills a window he wasnt supposed to, it's not my fault, he asked for the script.-- ~cdkidWell Atleast this time I know what the script does.. btw the way smoke_n your script wasn't the first script that did something that was unexpected :lmoa: Link to comment Share on other sites More sharing options...
herewasplato Posted March 12, 2006 Share Posted March 12, 2006 ...close the currently active/selected window.. and no others unless they active too... Your definition of "active" might differ from AutoIt's. Run this code:$var = WinList() For $i = 1 To $var[0][0] If BitAND( WinGetState($var[$i][1]), 8) Then MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) Nextand change the "8" in WinGetState($var[$i][1]), 8) until you see what you want, then replace the msgbox with whatever you want - perhaps WinKill From the help file on WinGetState:Success: Returns a value indicating the state of the window. Multiple values are added together so use BitAND() to examine the part you are interested in: 1 = Window exists 2 = Window is visible 4 = Windows is enabled 8 = Window is active 16 = Window is minimized 32 = Windows is maximized [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 12, 2006 Author Share Posted March 12, 2006 thanks for the help.. i got it going! Link to comment Share on other sites More sharing options...
neogia Posted March 12, 2006 Share Posted March 12, 2006 (edited) stuck it in one of my apps, and it didn't work.. i also triedSorry, but WinClose('') (Note that it is not a double-quote, but rather two single-quotes) will close any currently active window save the scripts GUI window if it has one. If it doesn't then you're implementing it incorrectly. As for your second script, try changing: Send("!f4") to Send("!{F4}") Note that this will do the same thing as WinClose('') except for it will close the script's own GUI if present. Also, it will attempt to shut down the computer when no active windows are present. Edit: Sorry, didn't see the second page, and therefore that the topic had been fulfilled. Edited March 12, 2006 by neogia [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia 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