DeckardCain Posted November 1, 2007 Share Posted November 1, 2007 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 More sharing options...
Nahuel Posted November 1, 2007 Share Posted November 1, 2007 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 EndFuncThis 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 More sharing options...
Thatsgreat2345 Posted November 1, 2007 Share Posted November 1, 2007 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 More sharing options...
DeckardCain Posted November 1, 2007 Author Share Posted November 1, 2007 (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 November 1, 2007 by DeckardCain Link to comment Share on other sites More sharing options...
Richard Robertson Posted November 1, 2007 Share Posted November 1, 2007 Uninstall her browser. That'll show her. Link to comment Share on other sites More sharing options...
DeckardCain Posted November 1, 2007 Author Share Posted November 1, 2007 (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 November 1, 2007 by DeckardCain Link to comment Share on other sites More sharing options...
JustinReno Posted November 1, 2007 Share Posted November 1, 2007 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. Link to comment Share on other sites More sharing options...
DeckardCain Posted November 1, 2007 Author Share Posted November 1, 2007 (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 November 1, 2007 by DeckardCain Link to comment Share on other sites More sharing options...
JustinReno Posted November 1, 2007 Share Posted November 1, 2007 You could do: While 1 If ProcessExists("iexplore.exe") AND WinActive("MySpace ") Then ProcessClose("iexplore.exe") EndIf WEnd But this is a big CPU hog, you could add reducememory from Wouter to cut the usage down 50% or more. Link to comment Share on other sites More sharing options...
DeckardCain Posted November 1, 2007 Author Share Posted November 1, 2007 Hahaha... I really think adding a simple loop on that would do the trick... Simple innovation ftw. Thanks for letting me be a newb Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 1, 2007 Moderators Share Posted November 1, 2007 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now