The Boss!

Recommended Posts

GregThompson 0

GregThompson 0

I thought I would release this little program I use for when my boss is lurking...

It works by reading your mouse coordinates and if the preset coordinates match up, it hides all your windows, and shows all your windows. Also if you hit CTRL + F8 it will unhide your windows, in case you can't find your unhide hotspot...

Share this post

Link to post

Share on other sites

Jos 1,303

Jos 1,303

I thought I would release this little program I use for when my boss is lurking...

It works by reading your mouse coordinates and if the preset coordinates match up, it minimizes all your windows.

It's pretty self explanatory, enjoy!

The .zip contains both the script and the compiled .exe.

MsgBox(48,"TheBoss!","Place your mouse where you want the activation point to be, and press the Enter key.")$set=MouseGetPos()MsgBox(48,"TheBoss!","From now on all Windows will be minimized when your mouse is at coordinates X = "&$set[0]&" Y = "&$set[1]&".")
Loop()Func Loop()Do$pos=MouseGetPos()Sleep(50)Until$pos[0]=$set[0]AND$pos[1]=$set[1]WinMinimizeAll()
Loop()EndFunc

You will get a recursion error at some point in time .... (when your boss passed by often enough)

You should not have a Func call itself unless its really needed like with a recursive directory search.

Share this post

Link to post

Share on other sites

strate 0

strate 0

$Input1=InputBox("TheBoss!","Input 'X' and 'Y' coordinates for top left corner.")$Input2=InputBox("TheBoss!","Input 'X' and 'Y' coordinates for Bottom left corner.")
oÝ÷ ØÈ ÖÞmëmz¹bëaÆ®¶­s`¢b33c´çWCÒçWD&÷gV÷CµFT&÷72b333²gV÷C²ÂgV÷C´çWBb33µb33²æBb33µb33²6ö÷&FæFW2f÷"F÷ÆVgB6÷&æW"âgV÷C²¢b33c´çWC"ÒçWD&÷gV÷CµFT&÷72b333²gV÷C²ÂgV÷C´çWBb33µb33²æBb33µb33²6ö÷&FæFW2f÷"&÷GFöÒ&vB6÷&æW"âgV÷C²

Edited August 30, 2006 by strate

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post

Link to post

Share on other sites

Paulie 26

Paulie 26

$Input1=InputBox("TheBoss!","Input 'X' and 'Y' coordinates for top left corner.")$Input2=InputBox("TheBoss!","Input 'X' and 'Y' coordinates for Bottom left corner.")
oÝ÷ ØÈ ÖÞmëmz¹bëaÆ®¶­s`¢b33c´çWCÒçWD&÷gV÷CµFT&÷72b333²gV÷C²ÂgV÷C´çWBb33µb33²æBb33µb33²6ö÷&FæFW2f÷"F÷ÆVgB6÷&æW"âgV÷C²¢b33c´çWC"ÒçWD&÷gV÷CµFT&÷72b333²gV÷C²ÂgV÷C´çWBb33µb33²æBb33µb33²6ö÷&FæFW2f÷"&÷GFöÒ&vB6÷&æW"âgV÷C²

Share this post

Link to post

Share on other sites

GregThompson 0

GregThompson 0

I didn't know that there would be problems with the loop/function. How would I go about correcting that without altering the program anymore like you guys have suggested. I think it's cool you're expanding on the idea, I just want to keep it to a single pixel activation.

So, how do I fix the recursion error potential?

@ Persen

Not sure what you're going for here, but what you're suggesting doesn't work... the code is missing the text string "" but even still... it does nothing. What are you looking to hide?

Share this post

Link to post

Share on other sites

jvanegmond 297

jvanegmond 297

I also wanted something for myself that was made to my preferences. I have also commented this alot so you might learn something from it.

; Set up a hotkey to return the hidden windows, as they are not accesable by the taskbarHotKeySet("^{F8}","ShowHiddenWindows"); Set up some variables to store the winhandles of the hidden windows in, as you don't want to show everythingGlobal$HiddenWindows[500],$w=0; main loop, checks wether or not the mouse is in the left top corner.While1;get the mouse position so it can be used for checking.$Pos=MouseGetPos()If($Pos[0]==0AND$Pos[1]==0)Then; if the mouse is in the top left corner call the function WinHideAll()
WinHideAll()EndIf; making a loop 'take it easy' saves you a lot of CPUSleep(25)WEnd; functionsFunc WinHideAll();Get a list of all the windows.$WinList=WinList(); make sure the operation has succeeded or you will get a error.IfNot@errorThen; go through a loop of all the windowsFor$n=1to$WinList[0][0]; if the window title isn't "Empty" go on (some windows have no titles, such as the desktop.)IfNot$WinList[$n][0]=""Then; Get the state of the window (e.g. is it visible)$State=WinGetState($WinList[$n][1]); uncomment the next line to get a msgbox with every window that lets you know what's going on.;MsgBox(0, "Title: " & $WinList[$n][0] & " Hwnd: " & $WinList[$n][1],"State: " & $State & @CRLF & "Check 1: " & (BitAND($State,2) OR BitAND($State,32)) & @CRLF & "Check 2: " & Not ($WinList[$n][0] = "Program Manager") & @CRLF & " Sum (Will be hidden): " & ( Not ($WinList[$n][0] = "Program Manager") AND (BitAND($State,2) OR BitAND($State,32)))); Check wether the window is actually visible or in the taskbarIf(BitAND($State,2)ORBitAND($State,32))Then; somehow there is always something called Program Manager, that's not actually a window.IfNot($WinList[$n][0]="Program Manager")Then; At this point, all the checks have passed and the window can be hiddenWinSetState($WinList[$n][0],"",@SW_HIDE); store this window at point $w in a array$HiddenWindows[$w]=$WinList[$n][1];increment $w so the next window doesn't overwrite the last one in the array$w+=1EndIfEndIfEndIfNextEndIfEndFuncFunc ShowHiddenWindows(); this shows all the windows that are stored in the array defined for storing windowsFor$n=$w-1to0Step-1;Windows are stored in reversed order. Therefore they are also returned that way.;Show the windowWinSetState($HiddenWindows[$n],"",@SW_SHOW)Next;reset the counter so that windows are inserted next time at point 0$w=0EndFunc

Share this post

Link to post

Share on other sites

GregThompson 0

GregThompson 0

I updated the .zip file and included the new code... Thanks for your ideas.. hope I did it "right" this time...

@ Manadar

Thanks for the post, I hadn't seen it until I already updated my code... you come across with a superior attitude as though I should be ever so thankful that you took the time to post here and "correct" me...

Turns out you and I did basically the same thing, but... yours is more in-depth... I guess I don't have moderate programming experience.

Edited August 31, 2006 by GregThompson

Share this post

Link to post

Share on other sites

GregThompson 0

GregThompson 0

@ Manadar... after comparing our 2 versions I combined them to what I wanted. I noticed with mine, because I over complicated things by using an array, I was having problems because it kept adding to the array. So, I combined the 2 into 1, which I have now upload and updated the code.