Rami Posted February 24, 2008 Posted February 24, 2008 How can I let Internet Explorer log in www.google.com whenever the internet explorer is on www.yahoo.com I tried to make this code for it but it failed, not mentioning I tried hard to read all the pertinent posts to this topic #include <IE.au3> $sURL = _IEPropertyGet($oIE, "locationurl") If $sURL = ("http://www.yahoo.com") Then _Send("#r") WinWaitActive("Run") Send("http://www.google.com{Enter}") EndIf
JustinReno Posted February 24, 2008 Posted February 24, 2008 #NoTrayIcon #Include <IE.au3> While 1 If $oIE.LocationURL() = "http://yahoo.com" Then $IE.Navigate("www.google.com") WEnd
DaleHohm Posted February 24, 2008 Posted February 24, 2008 Or to take advantage of the error handling in IE.au3: If _IEPropertyGet($oIE, "locationurl") = ("http://www.yahoo.com") Then _IENavigate($oIE, "http://www.google.com") EndIf 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
Rami Posted February 25, 2008 Author Posted February 25, 2008 #NoTrayIcon #Include <IE.au3> While 1 If $oIE.LocationURL() = "http://yahoo.com" Then $IE.Navigate("www.google.com") WEnd It didn't work,, i got this bug box Line 5 (File"C:\Documents and Settings\dentist\Desktop\_IE_VersionInfo.au3"): If $oIE.LocationURL()="http://yahoo.com" Then $IE.Navigate("www.google.com") If ^ERROR Error: Variable used without being declared.
JustinReno Posted February 25, 2008 Posted February 25, 2008 OOPS! Try this one: #NoTrayIcon #Include <IE.au3> While 1 If $oIE.LocationURL() = "http://yahoo.com" Then $oIE.Navigate("www.google.com") WEnd
FreeFry Posted February 25, 2008 Posted February 25, 2008 (edited) You would of course first have to attach to any current internet explorer window(_IECreate with attach set to 1), or create the window(with attach set to 0) first. ( just so you realise that Rami) btw. Welcome to the forum! Edited February 25, 2008 by FreeFry
Rami Posted February 25, 2008 Author Posted February 25, 2008 Or to take advantage of the error handling in IE.au3: If _IEPropertyGet($oIE, "locationurl") = ("http://www.yahoo.com") Then _IENavigate($oIE, "http://www.google.com") EndIf Dale it didn't work either,, Bug in line 1 variable used without being declared
JustinReno Posted February 25, 2008 Posted February 25, 2008 You have to create an Internet Explorer window first.
Rami Posted February 25, 2008 Author Posted February 25, 2008 You would of course first have to attach to any current internet explorer window(_IECreate with attach set to 1), or create the window(with attach set to 0) first. ( just so you realise that Rami) btw. Welcome to the forum! I tried this code, i am having the same bug "variable hasn't being declared" with all the suggested codes provided, i read the IEcreate help and attached it with 1 but it ends up with the same bug, here is the last code i tried #include <IE.au3> _IECreate ("http://www.yahoo.com", 1, 1, 1, 0) If _IEPropertyGet($oIE, "locationurl") = ("http://www.yahoo.com") Then _IENavigate($oIE, "http://www.google.com") EndIf
DaleHohm Posted February 25, 2008 Posted February 25, 2008 Look at the _IECreate help again and run the examples. Pay attention to the error message... it is telling you the answer. Then change to this: $oIE = _IECreate ("http://www.yahoo.com", 1, 1, 1, 0) 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
Rami Posted February 25, 2008 Author Posted February 25, 2008 Thanks, Problem solved I appreciated it.
Rami Posted February 25, 2008 Author Posted February 25, 2008 Any idea what is wrong in this code #include <IE.au3> $oIE = _IECreate ("http://www.google.com", 1, 1, 1, 0) Send("a") Send("{ENTER}") If _IEPropertyGet($oIE, "Title") = ("a - Google Search") Then _IENavigate($oIE, "http://www.google.com") EndIf
Rami Posted February 27, 2008 Author Posted February 27, 2008 I don't know why the code is not navigating to www.google.com when the title is "a - Google Search" #include <IE.au3> $oIE = _IECreate ("http://www.google.com", 1, 1, 1, 0) Send("a") Send("{ENTER}") If _IEPropertyGet($oIE, "title") = ("a - Google Search") Then _IENavigate($oIE, "http://www.google.com") EndIf
DaleHohm Posted February 27, 2008 Posted February 27, 2008 Your conditional is executing BEFORE the title gets set to what you expect it to be (since you are not using _IE commands taht wait for the page load). Stick _IELoadWait($oIE) in after the ENTER 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
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