sandman Posted October 10, 2007 Share Posted October 10, 2007 (edited) I whipped this up for to assist in my sudden obsession with productivity. Maybe it'll help with the obsession of other people also. This script, when activated by pressing F9, will create a mask window and bring only your current window on top of it, so the only window you can see is the one that you have chosen.Without further ado, the notoriously short, 39 lines (after pretty spacing techniques were applied):#include <GUIConstants.au3> #include <GUIList.au3> #include <Misc.au3> HotKeySet("{F9}", "Start") Global $mask, $init Global $STATE_ask = 0 Global $STATE_trap = 0 While 1 Sleep(1) WEnd Func Start() If $STATE_trap = 1 Then GUIDelete($mask) WinSetOnTop($init, "", 0) $STATE_trap = 0 ElseIf $STATE_trap = 0 Then $init = Init(WinGetTitle(""), WinGetHandle(WinGetTitle(""))) EndIf EndFunc Func Init($sWinTitle, $hWindow) Global $mask = GUICreate("OnTask Mask Window", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW) GUISetBkColor(0x000000, $mask) WinSetTrans("OnTask Mask Window", "", 254) GUISetState(@SW_SHOW, $mask) WinSetState($sWinTitle, "", @SW_RESTORE) WinSetOnTop($sWinTitle, "", 1) $pos = WinGetPos($sWinTitle) $STATE_trap = 1 Return $sWinTitle EndFuncEnjoy. Press F9 to activate.:^) / ( 8^I) Which one?And yes, I am joining the manual-signature club (see above). And yes, I am in a very good mood. Edited October 10, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] Link to comment Share on other sites More sharing options...
gseller Posted October 10, 2007 Share Posted October 10, 2007 OK, cool. It clears the clutter all except the window you are focused on when you hit F9... Nice.. Link to comment Share on other sites More sharing options...
sandman Posted October 10, 2007 Author Share Posted October 10, 2007 Oh, forgot to tell the hotkey.. [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] Link to comment Share on other sites More sharing options...
MadBoy Posted October 10, 2007 Share Posted October 10, 2007 Oh, forgot to tell the hotkey.. C:\Projects\Project.AU3\ssss.au3(21,24) : WARNING: $mask: possibly used before declaration. GUIDelete($mask)~~~~~~~~~~~~~~~~~~~~~~~^C:\Projects\Project.AU3\ssss.au3 - 0 error(s), 1 warning(s)->18:17:27 AU3Check ended.rc:1It works but would be nicer without errors My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
sandman Posted October 10, 2007 Author Share Posted October 10, 2007 C:\Projects\Project.AU3\ssss.au3(21,24) : WARNING: $mask: possibly used before declaration. GUIDelete($mask)~~~~~~~~~~~~~~~~~~~~~~~^C:\Projects\Project.AU3\ssss.au3 - 0 error(s), 1 warning(s)->18:17:27 AU3Check ended.rc:1It works but would be nicer without errors That's just because $mask is initially defined in a function which comes after that loop... sorry! I'll fix that warning right now. [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] 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