Jump to content

ie/mozilla question


Recommended Posts

OK, this sounds strange but I need mozilla or internet explorer to close whenever someone goes onto a certain website... namely myspace.

The reason being, one of my coworkers has a myspace addiction, and we've tried talking to her about it... and she won't stay off. We've tried talking to my boss, but my boss won't do anything about it... So I really am trying to figure out a way this script could work- but I've failed at it. It's been a few months since I played with auto it last... if someone could give me some advice as to where to start? Thanks in advance!

Link to comment
Share on other sites

Aren't there programs that can block certain sites? Like Norton Security?

Anyway, I can't figure out a way of using the IE functions so that it works if she has more than one IE opened. And what if she uses Firefox? So I used Larry's really cool script with a small modification:

#include <DllCallBack.au3>

Global Const $WH_KEYBOARD_LL = 13
Global $hHook, $pStub_KeyProc
Global $pStub_KeyProc = _DllCallBack ("_KeyProc","int;ptr;ptr")
Global $hmod = DllCall("kernel32.dll","hwnd","GetModuleHandle","ptr",0)
Global $hHook = DllCall("user32.dll","hwnd","SetWindowsHookEx","int", _
            $WH_KEYBOARD_LL,"ptr",$pStub_KeyProc,"hwnd",$hmod[0],"dword",0)
Global $buffer = ""


While 1
    Sleep(10)
WEnd

Func EvaluateKey($keycode)
    If (($keycode > 64) And ($keycode < 91)) _
        Or (($keycode > 47) And ($keycode < 58)) Then
        $buffer &= Chr($keycode)
        Switch $buffer
            Case "myspace"
                WinKill("")
        EndSwitch
    ElseIf ($keycode > 159) And ($keycode < 164) Then
        Return
    Else
        $buffer = ""
    EndIf
EndFunc

This will close the current active window if you TYPE myspace. But she could also go following a link, or from favourites.

Link to comment
Share on other sites

Trying using a script to continually check for myspace in the title. If they use a proxy most proxies still show the website so if you limit it to IE only then you can use the IE.udf and it would be better because you could check source as well for myspace and so on and so forth. Also check the host file and type myspace.com and then 127.0.0.1 so it tries to connect to local host instead of myspace. But so check out

wingetlist

wingettitle

and IE.au3 UDF in the beta help file

Link to comment
Share on other sites

hmmm.. thanks. It's at least a pretty good start- not to mention this coworker doesn't know her foot from her ass. Example: the printer was unplugged and she literally could not figure out what was wrong with it... 20 minutes later I plugged it in for her.

Oh yeah, my boss won't let us play with the security on windows nor internet explorer, that's why I'm trying to go through a third party program to do it. Thanks again!

Edited by DeckardCain
Link to comment
Share on other sites

hahaha I'm an idiot.. I ran the wrong script. Maaa bad. give me a few

:-D K. I think I'm making a big mistake - I'm willing to take the newbie heat ^^.

Error: Line 13 (File C:\location...)

#include <DllCallBack.au3>

Error: Error opening the file.

I think I'm making a really dumb mistake, but I've got the newest beta.. Help please <_<

Edited by DeckardCain
Link to comment
Share on other sites

Found it.. I'm sweet.

I must be putting it in the wrong spot... i unzip it into the include file right?

I'm flustered. I apologize for my incompetency-- I think I fell behind on autoit pretty hardcore haha.

Thanks for the patience!

Edited by DeckardCain
Link to comment
Share on other sites

  • Moderators

Geeze... Just write something simple.

AdlibEnable("_KillMySpace", 100)

While 1
    Sleep(1000000)
WEnd

Func _KillMySpace()
    If WinExists("[REGEXPTITLE:MySpace.com -|View More Pictures -]") Then
        While WinExists("[REGEXPTITLE:MySpace.com -|View More Pictures -]")
            WinClose("[REGEXPTITLE:MySpace.com -|View More Pictures -]")
            Sleep(10)
        WEnd
    EndIf
    Return
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...