AutoHotkey Community

It is currently May 27th, 2012, 10:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: The Boss Key script
PostPosted: June 19th, 2004, 12:56 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
This script might save your @$$ someday... It hides all open windows. It maintains a list of windows that should not be hidden (work apps).

Also a list of apps is kept that should be launched when Boss comes, in case you were not working at all, not even having a work window in the background!

All this at the press of a single hotkey. Press the hotkey again to show those hidden apps.

Customize the work apps in the script and the hotkeys. As the script doesn't show an icon in tray so to exit it press the hotkey for it.

Default hotkeys:
BossKey: Win+z
Exit Script: Ctrl+Win+z

Code:
#NoTrayIcon
SetTitleMatchMode, 2
SetBatchLines, 10ms
SetWinDelay, 10
B = 1


;______Windows not to hide__________________

;These window titles will be immune to the Boss key.
;don't remove 'hid1 = Shell_TrayWnd'

hid1 = Shell_TrayWnd
hid2 = Microsoft Word



;______Apps to launch_______________________

;These apps will be launched when Boss key is pressed.
;Takes care of situation when you were not working at all!

;Syntax: FilePath|WinTitle

;Giving WinTitle will make the script NOT launch an app
;if its window already exists, not giving wintitle will
;make the app be launched unconditionally

Run1 = %windir%\system32\calc.exe|Calculator
Run2 = E:\dos\batch\messages.txt|messages.txt - Notepad



;______Set Hotkeys here_____________________

Hotkey, #z, Boss   ;This is the Boss key

^#z::ExitApp      ;As the icon is hidden, use this hotkey to exit the script




Exit




Boss:
   
   ;hides all windows with exceptions
   IfGreater, B, 0
   {
      ;get all ids
      WinGet, id, list,,, Program Manager
      
      ;loop for all windows
      Loop, %id%
      {
         StringTrimRight, this_id, id%a_index%, 0
         
         ;get current win title
         WinGetTitle, title, ahk_id %this_id%
         
         ;get current win class
         WinGetClass, class, ahk_id %this_id%
         ToHide = y
         
         ;see if this is NOT to be hidden
         Loop
         {
            StringTrimRight, CWin, hid%A_Index%, 0
            IfEqual, CWin,, Break
            IfInString, title, %CWin%, SetEnv, ToHide, n
            IfInString, class, %CWin%, SetEnv, ToHide, n
            IfEqual, ToHide, n, Break
         }
         

         
         ;hide windows and keep a record of windows hidden
         IfEqual, ToHide, y
         {
            WinHide, ahk_id %this_id%
            HWins = %HWins%||%this_id%
         }

      }
   }
   

   
   ;shows hidden windows
   IfLess, B, 0
   {
      ;show windows
      Loop, Parse, HWins, ||
         WinShow, ahk_id %A_LoopField%
   }
   
   
   
   ;opens work windows
   IfGreater, B, 0
   {

      Loop
      {
         StringTrimLeft, CRun, Run%A_Index%, 0
         IfEqual, CRun,, Break
         StringGetPos, ppos, CRun, |

         StringLeft, fpath, CRun, %ppos%
         IfEqual, fpath,, SetEnv, fpath, %CRun%

         StringTrimLeft, wname, CRun, %ppos%
         StringTrimLeft, wname, wname, 1

         WinShow, %wname%
         IfWinNotExist, %wname%,, IfExist, %fpath%, Run, %fpath%
      }
   }
   

   B *= -1
Return

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2006, 2:56 am 
Offline

Joined: December 16th, 2005, 3:29 am
Posts: 148
Location: Australia
HAHAHAHAA!!!!

heres a word of advice... prevention is better than cure..LOL!!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2006, 10:44 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Woo, Rajat, bad boy! :-D
I see you took fast loading applications in the Run section... Better than an Office one, sure.
If I didn't read too fast, perhaps you should also restore the hid* windows in case they were minimized (or even hidden...).

That remind me...
One day, I received a large file (can't remember the format, somethink like video, PowerPoint or Flash, whatever) showing a Word window were somebody typed slowly a text. The purpose (for fun, not for real!) was to make believe you actually worked while you slept with open eyes and hands lightly lying on the keyboard...
I found that clumsy, because of the size of the file, and because the chosen document was in a language you may not use for work (English), and was probably unrelated to your work.
So, for fun, I wrote a MS Word macro to take a real work document, and slowly copy it in an empty one... Much smaller and more realistic.
I should dig it out someday.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 12th, 2007, 5:20 am 
it can hide all using windows by #z but cann't restore them by ^#z which made me feel very anxious.
BUT WHY?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 12th, 2007, 5:24 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
#^z exits the application without restoring the windows.
#z is a toggle key: hide then show.
Note: using a multiple desktop applet like VirtuaWin is probably a better (and more useful!) solution.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2007, 3:01 am 
Here is a ahk alternative i really like.
Ive used it just for that reason many times.
lol

http://www.autohotkey.com/forum/topic6182.html


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2007, 8:37 pm 
I just found this script and I love it!

One bug that I've found and I'm not real sure how to fix it:

If my mouse is hovering over something when I hit #z to toggle it on/off, a 'burn in' effect happens with the tooltip text. It is permanently shaded on the screen until I exit the script (and even then sometimes it wouldn't go away)

Don't have the first idea how to fix this, so I was wondering if anyone could recreate the error and possibly track down why this is happening.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 24th, 2007, 8:11 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
Guest,
i know exactly what you're saying. i've seen that at places where AHK had nothing to do, so its most probably a windows bug. and as this script doesn't use tooltip at all, its a system displayed one and not ahk generated.

i know its annoying! :roll:

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2007, 10:43 am 
Offline

Joined: November 17th, 2006, 6:42 pm
Posts: 6
LOL
I made something like this before to use on school.
Lots of my buddies made use of it, but it was kinda hard to do.
I also used an "ignore list".
I called the script WinSneak. :D
Thanks for the script.
I'm really going to make use of it.

Keep up the good work.

Yellowsix

(EDIT)

I just saw it doesn't have the start menu (BaseBar) and the program manager in the ignore list.
Of course everyone could add it by himself, but it might be handy to put it in the standard code.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2007, 12:53 am 
hahahaha oh sh*t it is nice script rajat!!!!!!! i attend a buisiness and admin course and my admin normally takes a stroll around the room so i use script to mask the internet explorer window but there was 1 problem one time i clicked a link and activated the hotkey and all these popups come up and it would not hide them :cry: so i was exposed for that... lol it was very funny because the admin had Radmin and was watching me type the hotkey in and there on he knew what the hotkey was so he told all the staff and the next day i was hiding windows and all of a sudden my tutor activated the hotkey on my keyboard and caught me playing Unreal Tournament 4 and downloading stuff :cry: so i was in abit of trouble...

anyway my question is, is there anyway of getting me out of this trouble? :? :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2007, 9:36 am 
seclinix - offline wrote:
anyway my question is, is there anyway of getting me out of this trouble? :? :(
Sure... Just pay attention to your course! :-P


Report this post
Top
  
Reply with quote  
 Post subject: volume
PostPosted: June 9th, 2011, 6:55 pm 
can you add volume mute (with minimize) and volume back?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2011, 9:27 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
Without even looking at the code, it shouldn't be too hard to throw the volume toggle in where the routines are executed.
Code:
Send {Volume_Mute}

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 10th, 2011, 4:07 pm 
Not sure if this is a limitation of Windows design, AutoHotKey or the script itself, but the script works beautifully for me in all but one instance.

I've noticed that if my mouse has focus inside a VNC or Remote Desktop session, WIN+Z does nothing. If there's any way to fix this, that would be awesome.


Report this post
Top
  
Reply with quote  
PostPosted: August 11th, 2011, 1:19 am 
dvation wrote:
I've noticed that if my mouse has focus inside a VNC or Remote Desktop session, WIN+Z does nothing.

...probably cuz the VNC is taking over Win+Z. You could change the script to use a different key...or attempt to get AutoHotkey to override the VNC hotkey.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: sks, specter333 and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group