lfrankli Posted January 22, 2015 Posted January 22, 2015 I'm running Win7 and AutoIT v3.3.12.0 I've looked at many forum posts about similar issues but i cannot get the html tag '<img src="image.gif">' to show an image in the embedded IE frame of my gui. I've looked at the following:'?do=embed' frameborder='0' data-embedContent>>'?do=embed' frameborder='0' data-embedContent>> I've tried changing the _IEDocWriteHTML to _IEBodyWriteHTML with no luck. All I get is a red box with an "x." Same HTML code works fine as an htm file. Does anyone have any suggestions on how to get this to work? Here is my code: expandcollapse popup#include <GUIConstantsEx.au3> #include <IE.au3> #include <WindowsConstants.au3> _MainGUI() _CloseApp() Func _MainGUI() $sHtmlCode = "<html><body>" $sHtmlCode = $sHtmlCode & "<img src=""logo.gif"" >" $sHtmlCode = $sHtmlCode & "<br><button id=""ExitBtn"">Exit</button>" $sHtmlCode = $sHtmlCode & "</body></html>" Opt("GUIOnEventMode", 1) Opt("GUICloseOnESC",1) $_hMainGui_1 = GUICreate("My GUI", 320, 320,-1,-1,-1,$WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseApp", $_hMainGui_1) $_h_IE_Frame = _IECreateEmbedded() GUICtrlCreateObj($_h_IE_Frame, 10, 10, 300, 300) _IENavigate($_h_IE_Frame, "about:blank") _IEDocWriteHTML($_h_IE_Frame,$sHtmlCode) _IELoadWait($_h_IE_Frame) $_idExitBtn = _IEGetObjById($_h_IE_Frame, "ExitBtn") ObjEvent($_idExitBtn, "_Event_IE_ExitBtn_") GUISetState(@SW_SHOW, $_hMainGui_1) ; will display an empty dialog box While 1 Sleep(1000) ; Idle around WEnd EndFunc Func _Event_IE_ExitBtn_onclick() MsgBox(0,"Exit", "You clicked the 'Exit' button.") _CloseApp() EndFunc Func _CloseApp() Exit EndFunc
Moderators SmOke_N Posted January 22, 2015 Moderators Posted January 22, 2015 You have to provide the exact path to the gif... eg. $sHtmlCode &= '<img src="file://' & StringReplace(@ScriptDir & "/logo.gif", "\", "/") & '">' I wrote that in here... didn't check for syntax, but hopefully you get the concept... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Solution lfrankli Posted January 23, 2015 Author Solution Posted January 23, 2015 You have to provide the exact path to the gif... eg. $sHtmlCode &= '<img src="file://' & StringReplace(@ScriptDir & "/logo.gif", "\", "/") & '">' I wrote that in here... didn't check for syntax, but hopefully you get the concept... SmOke_N - That was enough to get me there! This worked - $sHtmlCode = $sHtmlCode & "<img src=file://" & StringReplace(@ScriptDir & "/logo.gif", "\", "/") & " >" Relitive path vs absolute path mixed into html tags with and/or without quotes...I love the alchemy of syntax! Thank you sir!
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