Sign in to follow this  
Followers 0
mikehunt114

IE Extension

11 posts in this topic

I'm looking into creating an add-on for IE that would manipulate certain things on a given webpage. These would be things like adding links, javascript timers, small things like that. I don't think I'll have a problem doing any of those additions. What I don't know is how to incorporate this into an "add-on" or "extension". I'd like the script to automatically load with IE, and only apply itself to the one domain. I've done plenty of scripts that manipulate pages from an external standpoint, but nothing like this. I'd like to investigate whether or not this is possible with AutoIt, since I'm a big fan.

A quick search revealed that this type of thing has been done, I saw several programs that can add options to the menu bar or tool bar, or add controls to the context menu and this kind of thing. That's kind of the direction I want to head with this project, but I'm not sure where to dig in. I had a look at what I think is all of IE's COM attributes using MS's OLE Viewer, but I didn't see anything new. I only saw things like the web browser events, and typical stop, refresh kinds of stuff.

I haven't been on these forums for quite a while now, but I recall reading about scripts adding their own controls to an already existing GUI (say IE). If someone can point me in the direction of those posts, I'd be much obliged.

I'd also be appreciative of any insight anyone could offer into the world of IE add-ons.

P.S. Before you suggest it, I am well aware of FF's extension capabilities and let's just stick to IE in this thread, thanks!


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites



You could use Greasemonkey for IE, which works like the extension for Firefox :)


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

This is true, but I want to explore the AutoIt options for now.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

I'm looking into creating an add-on for IE that would manipulate certain things on a given webpage. These would be things like adding links, javascript timers, small things like that. I don't think I'll have a problem doing any of those additions.

I have seen some of your script assistance with IE questions here in the forums. You are more knowledgeable than most with IE. I would try to hook-up with Dale or Bob (Big_Daddy) and see if there are some direction and or help they might offer.

What I don't know is how to incorporate this into an "add-on" or "extension". I'd like the script to automatically load with IE

With XSkin I had more creative ideas after concept, and rather than continuously re-writing the original XSkin, I chose to call these "Plug-ins" and they are additional required includes to the XSkin include. This might be a direction for your idea's, this way you control the design, changes/updates/upgrades and the complete interaction with IE.au3.

Overall, with your abilities and the power of IE.au3, I think this is a great idea with a good future!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

He already came to me and I sent him here :)

Another starting point is looking for information on BHO's (Browser Helper Objects) http://en.wikipedia.org/wiki/Browser_Helper_Object You'll also find information in the IE SDK.

These are typically implemented with custom DLLs loaded along with IE for each instance and have access to browser events and the DOM. Just not an area I've needed to invest in.

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

Share this post


Link to post
Share on other sites

Something like this could perhaps be adapted?

#include <IE.au3> 

Opt("WinTitleMatchMode", 4)

Dim $Hooked[1][2] = [[0]]

_IEErrorHandlerRegister()

While 1
    If WinExists("[CLASS:IEFrame]") Then
        _HookWindow(WinGetHandle("[LAST]"))
    EndIf
    Sleep(250)
WEnd

Func _HookWindow($ivwHandle)
    
    Local $ivhWindow = WinGetHandle("[LAST]")
    Local $ivHooked = False
;~  Sleep(1500)
    
    If Not $Hooked[0][0] Then
        ConsoleWrite("Hooking into window: " & WinGetTitle($ivwHandle) & " [" & $ivwHandle & "]" & @LF)
        $Hooked[0][0] += 1
        ReDim $Hooked[$Hooked[0][0]+1][2]
        $Hooked[$Hooked[0][0]][0] = $ivwHandle
        Do
            $Hooked[$Hooked[0][0]][1] = _IEAttach($ivwHandle, "HWND")
        Until IsObj($Hooked[$Hooked[0][0]][1])
        Return
    EndIf
    
    For $i = 1 To $Hooked[0][0]
        If $ivwHandle = $Hooked[$i][0] Then
            $ivHooked = True
            _HandleBrowser($Hooked[$i][1])
            Return
        EndIf
        If Not $ivHooked Then
            ConsoleWrite("Hooking into window: " & WinGetTitle($ivwHandle) & "[" & $ivwHandle & "]" & @LF)
            $Hooked[0][0] += 1
            ReDim $Hooked[$Hooked[0][0]+1][2]
            $Hooked[$Hooked[0][0]][0] = $ivwHandle
            Do
                $Hooked[$Hooked[0][0]][1] = _IEAttach($ivwHandle, "HWND")
            Until IsObj($Hooked[$Hooked[0][0]][1])
            Return
        EndIf
        Sleep(25)
    Next
    
EndFunc

Func _HandleBrowser($ovIExplorer)
    _IEHeadInsertEventScript($ovIExplorer, "document", "oncontextmenu", "alert('No Context Menu');return false")
EndFunc

Share this post


Link to post
Share on other sites

Thanks guys, this gives me a couple things to look at for now. Unfortunately I have no experience using DLLs, so that's either a dead end for me, or a good learning project. I'm going to go back to digging in MSDN and see what else I can find. Expect to hear more from me. :)


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

From what I saw tonight it looks like you're bang on Dale. This is disappointing since I was hoping to use AutoIt, but I think about the only thing I could do with AU3 is an installer to register the DLL. Unfortunately the DLL creation may be over my head. For starters I'd have to dig out my old C++ text (dear God!), being the only other language I'm familiar with, or learn a new language from scratch for this project.

I know there are some users that are quite familiar with DLLs and may be able to help me, can someone point me in their direction?

Edit: While I have this topic open, I might as well mention this though. It seems like I need to interact with the IObjectWithSite interface, so I looked it up on MSDN and it refers to an ActiveX control, not the IE browser control like I had hoped it would. Is there a way to use ObjEvent() and an IE object together for my purposes?

Edited by mikehunt114

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

So long as the IObjectWithSite interface meets the requirements for the AutoIt COM interaction (it uses the IDispatch interface), then you should be able to use ObjCreate and ObjEvent with it. Please note that AutoIt event processing is is not handled synchronously, so it may really tie your hands.

Using Trixie (an IE implementation of GreaseMonkey) or GreaseMonkey For IE (suggested above) may be your best bet...

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

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