Jump to content

Adding an image from script file to html code on embedded webbrowser


 Share

Recommended Posts

I have created a GUI with an embedded Webbrowser to automate some tasks, and it does a Daily Maintenance everyday, this Maintenance takes 3-5 minutes to complete, so I decided to throw up my html code to inform it was running maintenance rather than looking broken on the same page. I want to add an image to the page/html code, however I want it to use an image from the script file rather than from a website. Hopefully some1 can help me find an applicable solution to this minor dilemma. an example would be from @ScriptDir & "\Images\some_image.jpg" Some How replacing in the tag below

$s_html &= "<a href='http://MyWebsite.com/some_image.jpg' name='Some_image' alt='Some Logo'></a>" & @CR

Any Ideas?

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

So what happens when you do what you just said you wanted to do?

$s_html &= "<a href='" & @ScriptDir & "\Images\some_image.jpg" & " ' name='Some_image' alt='Some Logo'></a>" & @CR
Link to comment
Share on other sites

Wait, isn't href for links, why are you using that?

This works for me:

Local $test = '<BODY>' & @CRLF & _
'<IMG src="file://' & @ScriptDir & '\73.png"' & @CRLF & _
'     alt="Something something cookie.">' & @CRLF & _
'</BODY>'

FileDelete(@ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".html")
FileWrite(@ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".html", $test)

ShellExecute(@ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".html")
Link to comment
Share on other sites

Wait, isn't href for links, why are you using that?

Because this is the first time I have ever attempt to write html within AutoIt, and the first time I have ever tried combing both forms of code. It was a starting point to show what I am trying to accomplish.

This is what I have now

$s_html &= '<IMG src="file://' & @ScriptDir & '\some_image.jpg"' & @CRLF & '    alt="Something something cookie.">' & @CR

And it is working beautifully! Thanks for pointing me to the solution :blink:

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

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