Sign in to follow this  
Followers 0
DeckardCain

ie/mozilla question

11 posts in this topic

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!

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Uninstall her browser. That'll show her.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

You need the DllCallBack.au3, search it, and I bet you could use _IEAttach and _IEPropertyget. _IEAttach with track the IE window, and you can use _IEPropertyget to get the url bar, and if it has anything myspace then close IE. <_<

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Hahaha... I really think adding a simple loop on that would do the trick...

Simple innovation ftw. Thanks for letting me be a newb

Share this post


Link to post
Share on other sites

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.

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  
Followers 0