Sign in to follow this  
Followers 0
shx

IE Management

9 posts in this topic

I see that the IE management can allow an auto it application to navigate fill in information and submit forms and web pages.

My question is that I want to present a web page but not allow the user to click on certain links and buttons on that page.

Does the udf have this functionality?

I thought that the InternetExplorer.Application object it is using has a before navigate event.

That would be something that might work. where, if i could fire off some code to check on the destination url before the navigations takes place I could prevent its navigation.

any ideas would be appreciated.

Thanks,

Steven

Share this post


Link to post
Share on other sites



If you already know what you are looking for.... example from "Welcome to Autoit 1-2-3"

; Read the contents of the body of a webpage and search for a string. If the string is found, replace it 
; with a new string and write it back to the webpage.

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.autoitscript.com/")

$body = _IEBodyReadHTML($oIE)

If StringInStr($body, "automation") Then
    MsgBox(0, "Success", "The string was found")
    $newbody = StringReplace($body, "automation", "AUTOMATION - Yeah!")
    _IEBodyWriteHTML($oIE, $newbody)
Else
    MsgBox(0, "Fail", "The string was NOT found")
EndIf

Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

If you already know what you are looking for.... example from "Welcome to Autoit 1-2-3"

; Read the contents of the body of a webpage and search for a string. If the string is found, replace it 
; with a new string and write it back to the webpage.

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.autoitscript.com/")

$body = _IEBodyReadHTML($oIE)

If StringInStr($body, "automation") Then
    MsgBox(0, "Success", "The string was found")
    $newbody = StringReplace($body, "automation", "AUTOMATION - Yeah!")
    _IEBodyWriteHTML($oIE, $newbody)
Else
    MsgBox(0, "Fail", "The string was NOT found")
EndIf

Exit

8)

I see that it changes text that the user sees but I'm not sure how this would help.

Are you saying to search for the link url and blank it out ?

Steven

Share this post


Link to post
Share on other sites

Yes, that was one direction

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yes, that was one direction

8)

I was looking for a way to capture the before navigate event. I really would appreciate some help or direction with it.

I found objevent function that might help me do what I need.

Can someone tell me will it let me stop a navigation by checking the url the web browser is navigating to.

Thanks

Steven

Edited by shx

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

you can continually read the input ( where the URL is normally typed in ) and test it for a name or ???

#include <IE.au3>
$oIE = _IECreate("www.autoit3.com")

While 1
    $URL = _IEPropertyGet($oIE, "locationurl")
    ToolTip($URL, 10, 10, "Thanks    Valuater... 8)  ", 1)
    Sleep(1000)
WEnd

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Edited 3 times... works now

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Unfortunately, the way that AutoIt handles events does not allow you to cancel an event that has been triggered. AutoIt actually handles events asynchronously rather than synchronously and by the time you have a chance to work on it, it has already been fired.

Therefore, you must either rewrite the links in the HTML code (As Valuater is suggesting) or you must add your own event functions to the links them in the HTML so that you can cancel the event processing synchronously. Take a look at _IEHeadInsertEventScript and _IELinkGetCollection. There is an example of doing this somewhere in the forum.

Dale

Edited by DaleHohm

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

Share this post


Link to post
Share on other sites

Unfortunately, the way that AutoIt handles events does not allow you to cancel an event that has been triggered. AutoIt actually handles events asynchronously rather than synchronously and by the time you have a chance to work on it, it has already been fired.

Therefore, you must either rewrite the links in the HTML code (As Valuater is suggesting) or you must add your own event functions to the links them in the HTML so that you can cancel the event processing synchronously. Take a look at _IEHeadInsertEventScript and _IELinkGetCollection. There is an example of doing this somewhere in the forum.

Dale

Valuater,

Thanks for your help. I think the _IEHeadInsertEventScript is the direction which I want to go.

Dale,

Thanks for the answer. I looked at the _IEHeadInsertEventScript function, and it looks like I could use it to do what I need.

Just one more question. Is there a good location where I can see a listing of the different objects and their associated events that the javascript could interface with. I see there is document, window, and link? being used in the examples.

Thanks again for all your help

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