muhmuuh Posted August 30, 2007 Share Posted August 30, 2007 Hi! I want to make a program that closes IE according to its url. For example I've opened 10 IE windows and 5 of them are youtube clips. When this program starts and I type 'youtube.com' I should close those 5 windows. Is it clear? OK, I'm new here and I'm a self-learner. I learn from the help but this time it didn't help me. Here is what I've got #include <IE.au3> AutoItSetOption("WinTitleMatchMode", 2) $url = InputBox("type url", "type url to close") $var = WinList("Internet Explorer") For $i = 1 to $var[0][0] $ie = $var[$i][1] $aa = _IEPropertyGet ( $ie, "locationurl" ) if StringInStr($aa, $url)<>0 Then _IEQuit ($ie) EndIf Next but after I start it here is what I get at the bottom of the editor --> IE.au3 V2.3-1 Error from function _IEPropertyGet, $_IEStatus_InvalidDataTypeCan you please tell me what I am doing wrong? Thanks I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 30, 2007 Share Posted August 30, 2007 Hi! I want to make a program that closes IE according to its url. For example I've opened 10 IE windows and 5 of them are youtube clips. When this program starts and I type 'youtube.com' I should close those 5 windows. Is it clear? OK, I'm new here and I'm a self-learner. I learn from the help but this time it didn't help me. Here is what I've got #include <IE.au3> AutoItSetOption("WinTitleMatchMode", 2) $url = InputBox("type url", "type url to close") $var = WinList("Internet Explorer") For $i = 1 to $var[0][0] $ie = $var[$i][1] $aa = _IEPropertyGet ( $ie, "locationurl" ) if StringInStr($aa, $url)<>0 Then _IEQuit ($ie) EndIf Next but after I start it here is what I get at the bottom of the editor Can you please tell me what I am doing wrong? Thanks Use this instead to get the IE object: $ie = _IEAttach($var[$i][1], "HWND") You were using the window handle in place of the IE object reference. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
muhmuuh Posted August 30, 2007 Author Share Posted August 30, 2007 Cool! It works! It was very funny how my IE windows dissapear from the taskbar Thank you PsaltyDS I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
tAKTelapis Posted August 30, 2007 Share Posted August 30, 2007 Awesome, muhmuuh, you just saved me some work. I have a use for this. Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 30, 2007 Share Posted August 30, 2007 Awesome, muhmuuh, you just saved me some work.I have a use for this. Looked like a "Boss Alert" button to me! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
muhmuuh Posted August 31, 2007 Author Share Posted August 31, 2007 OK, this works great with IE other the IE 7 With IE 7 works only when the site is the only tab Also I do this in loop #include <IE.au3> AutoItSetOption("WinTitleMatchMode", 2) $url = InputBox("type url", "type url to close") $var = WinList("Internet Explorer") While 1 $var = WinList("Internet Explorer") For $i = 1 to $var[0][0] $ie = _IEAttach($var[$i][1], "HWND") $aa = _IEPropertyGet ( $ie, "locationurl" ) if StringInStr($aa, $url)<>0 Then _IEQuit ($ie) EndIf Next sleep(1000) HotKeySet("^s", "Stop") WEnd I don't have IE7 on my computer and it wants sp2 so can someone help me fix this? I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
muhmuuh Posted August 31, 2007 Author Share Posted August 31, 2007 Can someone help me? I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
DaleHohm Posted August 31, 2007 Share Posted August 31, 2007 Didn't test, but this should work. Look at the internals of _IEAttach if you want to enhance further. #include <IE.au3> $url = InputBox("type url", "type url to close") $o_Shell = ObjCreate("Shell.Application") $ies = $o_Shell.Windows (); collection of all ShellWindows (IE and File Explorer) _IEErrorHandlerRegister(); error will occur for File Explorer windows... allow ignore _IEErrorNotify(FALSE); suppress console error display For $ie In $ies $aa = _IEPropertyGet ( $ie, "locationurl" ) If @error then ContinueLoop if StringInStr($aa, $url)<>0 Then _IEQuit ($ie) EndIf Next Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble 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