Jump to content
Sign in to follow this  
Brickoneer

Get your work done!

Recommended Posts

Brickoneer

I recently created this little piece of code that helped me stay on task. Very simple, but effective.

;#NoTrayIcon
HotKeySet("{pause}", "Pause")
HotKeySet("^+!z", "Terminate") ; Exit on a Ctrl + Shift + Alt + Z... you can't "accidentally" hit it.
$Paused=0
Opt("WinTitleMatchMode", -2) ; Set the Title match mode to 'substring' non-case sensative.

while 1
$FF = WinGetTitle("Mozilla Firefox") ; See if a FF browser exists...
$IE = WinGetTitle("Microsoft Internet Explorer") ; See if a IE browser exists...

Select ; If there is a browser, kill it!
    case $FF <> ""
        WinClose($FF)
    Case $IE <> ""
        WinClose($IE)
EndSelect
sleep(100)
WEnd

Func Pause()
    $Paused = NOT $Paused
    While $Paused
        sleep(1000)
    WEnd
EndFunc

Func Terminate()
    MsgBox(0,"","Terminated.")
    Exit
EndFunc

As I said, very simple. (of course it is... I made it!)

Just thought I'd share with those who also struggle with staying on task. :)

Brick

Edited by Brickoneer

Share this post


Link to post
Share on other sites
Skizmata

Would have replied sooner but had to test the script *doh*. Nice work.


AutoIt changed my life.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×