Jump to content

LOCATIONURL replacement


Rami
 Share

Recommended Posts

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

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

Link to comment
Share on other sites

#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.
Link to comment
Share on other sites

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 by FreeFry
Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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

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

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

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...