Jump to content

Image Problem


Recommended Posts

Hi,

I was trying to create a web page so I modified one of the IE Examples and I replaced the URL to the image on the page to a local image but I can't get the image to display.

Original code:

$s_html &= "<a href='http://www.autoitscript.com'><img src='http://www.autoitscript.com/images/autoit_6_240x100.jpg' name='AutoItImage' alt='AutoIt Homepage Image'></a>" & @CR

My code:

$s_html &= "<a href='http://www.autoitscript.com'><img src='../../../images/test images/a_center.jpg' ></a>" & @CR

Entire code:

#include <IE.au3>
Local $s_html = "", $o_object
$s_html &= "<HEAD>" & @CR
$s_html &= "<TITLE>_IE_Example('basic')</TITLE>" & @CR
$s_html &= "<STYLE>body {font-family: Arial}</STYLE>" & @CR
$s_html &= "</HEAD>" & @CR
$s_html &= "<BODY>" & @CR
$s_html &= "<a href='http://www.autoitscript.com'><img src='../../../images/test images/a_center.jpg' ></a>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line1>This is a simple HTML page with text, links and images.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line2><a href='http://www.autoitscript.com'>AutoIt</a> is a wonderful automation scripting language.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line3>It is supported by a very active and supporting <a href='http://www.autoitscript.com/forum/'>user forum</a>.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=IEAu3Data></div>" & @CR
$s_html &= "</BODY>" & @CR
$s_html &= "</HTML>"
$o_object = _IECreate()
_IEDocWriteHTML($o_object, $s_html)

I tried a test in Dream Weaver and I can get a local image to display. So I'm guessing it's my syntax or something simple. I just can't figure it out.

Thanks for the help.

Cygnus

Cygnus

Link to comment
Share on other sites

you're problem lies:

img src='../../../images/test images/a_center.jpg'

Try something like:

img src='" & @ScriptDir & "images/test images/a_center.jpg'

I can almost gurantee ur problem exists with using the massive relative path in the first example. If the solution doesn't work, still troubleshoot the path -- it's the cause of your issues.

Edited by thepip3r

My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume

Link to comment
Share on other sites

damnit... if Psalty answers, go with his suggestion then. =P

Yeah, 'cause PsaltyDS is never wrong... <casts furtive glance at the ceiling, watching for lightning strikes>

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hey,

Thanks for the responses.

I tried both of your suggestions; separately and together. The image still won't display.

I did a FileExists and it returns 1, good. So, AutoIt knows the file is there. I even moved the .au3 file into the directory with the image, modified the scr path to just the image name. It still won't display.

Very frustrated.

Cygnus

Cygnus

Link to comment
Share on other sites

KK I'm not sure what's going on but for this code (pretty much the exact same thing):

#include <IE.au3>
MsgBox(0, "", @ScriptDir)
Local $s_html = "", $o_object
$s_html &= "<HEAD>" & @CR
$s_html &= "<TITLE>_IE_Example('basic')</TITLE>" & @CR
$s_html &= "<STYLE>body {font-family: Arial}</STYLE>" & @CR
$s_html &= "</HEAD>" & @CR
$s_html &= "<BODY>" & @CR
$s_html &= "<a href='http://www.autoitscript.com'><img src='" & @ScriptDir & "\hoff.jpg' ></a>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line1>This is a simple HTML page with text, links and images.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line2><a href='http://www.autoitscript.com'>AutoIt</a> is a wonderful automation scripting language.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line3>It is supported by a very active and supporting <a href='http://www.autoitscript.com/forum/'>user forum</a>.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=IEAu3Data></div>" & @CR
$s_html &= "</BODY>" & @CR
$s_html &= "</HTML>"
$o_object = _IECreate()
_IEDocWriteHTML($o_object, $s_html)

I get the same result as you Cygnus BUT, if you save that page as a local .htm or .html file and then reopen the file, it works like a champ so I'm not sure what's going on man, hopefully someone else can sheda little light on the subject.

My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume

Link to comment
Share on other sites

KK I'm not sure what's going on but for this code (pretty much the exact same thing):

I get the same result as you Cygnus BUT, if you save that page as a local .htm or .html file and then reopen the file, it works like a champ so I'm not sure what's going on man, hopefully someone else can sheda little light on the subject.

I am NOT seeing the problem with that code. It seems to work fine (when I replaced the file name with one I had):
#include <IE.au3>
MsgBox(0, "", @ScriptDir)
Local $s_html = "", $o_object
$s_html &= "<HEAD>" & @CR
$s_html &= "<TITLE>_IE_Example('basic')</TITLE>" & @CR
$s_html &= "<STYLE>body {font-family: Arial}</STYLE>" & @CR
$s_html &= "</HEAD>" & @CR
$s_html &= "<BODY>" & @CR
$s_html &= "<a href='http://www.autoitscript.com'><img src='" & @ScriptDir & "\logo4.jpg' ></a>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line1>This is a simple HTML page with text, links and images.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line2><a href='http://www.autoitscript.com'>AutoIt</a> is a wonderful automation scripting language.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=line3>It is supported by a very active and supporting <a href='http://www.autoitscript.com/forum/'>user forum</a>.</div>" & @CR
$s_html &= "<p>" & @CR
$s_html &= "<div id=IEAu3Data></div>" & @CR
$s_html &= "</BODY>" & @CR
$s_html &= "</HTML>"
$o_object = _IECreate()
_IEDocWriteHTML($o_object, $s_html)

That worked with 3.2.10.0 and V2.3-1 of IE.au3. Also with Beta 3.2.11.7 and IE.au3 V2.4-0. Both on XP Pro SP2 and IE6. What versions are you running this with?

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Ok here's what I got.

I went c:\program files\autoit3 and right clicked on the autoit3.exe > properties > version. I'm running 3.2.10.0 on Win XP Pro SP2.

I also tried 3.2.11.5 and 3.2.11.7

I then copied your code and changed just the file name and still no worky worky.

Even if I save the page as htm or html local, it still doesn't work.

Cygnus

Edited by CygnusX1

Cygnus

Link to comment
Share on other sites

Anyone else care to jump in on the fun with this problem?

You haven't shown the code that doesn't work, so did you notice the backslash that PsaltyDS added?

@ScriptDit & "\....

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...