NassauSky Posted February 24, 2014 Posted February 24, 2014 (edited) I was looking to put a button on top of Internet Explorer. The position isn't critical at the moment as long as it is displayed anywhere in the window.I was playing with some code I found on a thread about ANYGUI.au3 but I just can't piece it together. I got 2 sample code pieces to function using calculator & notepad which were listed in the posts of the ANYGUI thread by quaizywabbit and zcoacoaz at ('?do=embed' frameborder='0' data-embedContent>>) and modified 'em as follows but no button displays inside my newly opened IE window: Here is what I have #include <ie.au3> #include <ANYGUIv2.8.au3> #include <guiconstants.au3> Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Local $iPID = Run("C:\Program Files\Internet Explorer\iexplore.exe", "" ) WinWait ("[CLASS:IEFrame]", "") $Pos = WinGetPos ( "Internet" ) $Ctrltarget = _GuiTarget ( "Internet", 1 ) $Quit = _TargetAddButton ( "TEST BUTTON", 20, 20, 50, 29 ) $Quit = $Quit[0] GUISetState ( ) While 1 $msg = GUIGetMsg ( ) If $msg = $Quit Then Exit If Not WinExists ( "Internet" ) Then Exit WEnd Func OnAutoItExit() ProcessClose ( "iexplore.exe" ) EndFunc Any real basic code or tips to place a button or text so that it is visible on IE? Thanks Edited February 24, 2014 by nassausky
Danp2 Posted February 24, 2014 Posted February 24, 2014 Have you considered using some of the _IE functions, such as _IEBodyWriteHTML, _IEDocInsertHTML, and _IEDocWriteHTML? Latest Webdriver UDF Release Webdriver Wiki FAQs
NassauSky Posted February 24, 2014 Author Posted February 24, 2014 Thanks but so far that didn't work: I think that is causing a crossdomain issue. I modified the code as follows: #include <IE.au3> Local $oIE = _IECreate() Local $sHTML = "" $sHTML &= "<HTML>" & @CRLF $sHTML &= "<HEAD>" & @CRLF $sHTML &= "<TITLE>_IE_Example('frameset')</TITLE>" & @CRLF $sHTML &= "</HEAD>" & @CRLF $sHTML &= "<FRAMESET rows='25,200'>" & @CRLF $sHTML &= " <FRAME NAME=Top SRC=about:blank>" & @CRLF $sHTML &= " <FRAME NAME=Bottom SRC='http://www.google.com'>" & @CRLF $sHTML &= "</FRAMESET>" & @CRLF $sHTML &= "</HTML>" _IEDocWriteHTML($oIE, $sHTML) _IEAction($oIE, "refresh") Local $oFrameTop = _IEFrameGetObjByName($oIE, "Top") Local $oFrameBottom = _IEFrameGetObjByName($oIE, "Bottom") _IEBodyWriteHTML($oFrameTop, '$oFrameTop = _IEFrameGetObjByName($oIE, "Top")') _IEBodyWriteHTML($oFrameBottom, '$oFrameMain = _IEFrameGetObjByName($oIE, "Bottom")')
NassauSky Posted February 24, 2014 Author Posted February 24, 2014 Ok thanks great. Just checked into your other option. This will work for now. ; Insert HTML at the top and bottom of a document #include <IE.au3> Local $oIE = _IECreate("http://www.autoitscript.com") Local $oBody = _IETagNameGetCollection($oIE, "body", 0) _IEDocInsertHTML($oBody, "<h2><font color=red>This HTML is inserted After Begin</font></h2>", "afterbegin") _IEDocInsertHTML($oBody, "<h2><font color=red>This HTML is inserted Before End</font></h2>", "beforeend") To move this on forward, may I ask how to possibly add text or a button to the title bar of IE in Windows 7?
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