AutoIt Forums: OnTask - AutoIt Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

OnTask So simple it's not even funny... Rate Topic: -----

#1 User is offline   sandman 

  • I ❤ WordPress
  • PipPipPipPipPipPip
  • Group: Full Members
  • Posts: 1,303
  • Joined: 21-January 07
  • Location:Arizona, USA

Posted 10 October 2007 - 05:36 AM

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):
[ autoIt ]    ( ExpandCollapse - Popup )
#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 EndFunc


Enjoy. 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.

This post has been edited by sandman: 10 October 2007 - 09:43 PM


#2 User is offline   gseller 

  • Mass Spammer!
  • PipPipPipPipPipPip
  • Group: Full Members
  • Posts: 1,053
  • Joined: 16-March 07

Posted 10 October 2007 - 06:37 AM

OK, cool. It clears the clutter all except the window you are focused on when you hit F9... Nice..

#3 User is offline   sandman 

  • I ❤ WordPress
  • PipPipPipPipPipPip
  • Group: Full Members
  • Posts: 1,303
  • Joined: 21-January 07
  • Location:Arizona, USA

Posted 10 October 2007 - 05:13 PM

Oh, forgot to tell the hotkey.. http://elouai.com/images/yahoo/34.gif

#4 User is offline   MadBoy 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 822
  • Joined: 01-January 06
  • Location:Poland

Posted 10 October 2007 - 05:19 PM

http://www.autoitscript.com/forum/public/style_images/autoit/snapback.png' alt='View Post' />sandman, on Oct 10 2007, 06:13 PM, said:

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:1

It works but would be nicer without errors :)

#5 User is offline   sandman 

  • I ❤ WordPress
  • PipPipPipPipPipPip
  • Group: Full Members
  • Posts: 1,303
  • Joined: 21-January 07
  • Location:Arizona, USA

Posted 10 October 2007 - 09:43 PM

View PostMadBoy, on Oct 10 2007, 09:19 AM, said:

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:1

It 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.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users