Jump to content
Sign in to follow this  

Help with web browsers and word

Recommended Posts

Hi! I started learning AutoIt 2 days ago so I'm a total beginner, but i'm experienced in programming. So what I want to do is:

open a browser and navigating to my weather page (Done)

Open a word document and write the weather from a few tables on the website in the document (Done)

Add a weather symbol after every days weather (Problem!)

The symbols are .PNG pictures on the website, I know the URLs and everything.

First I tried o use _WordDocAddPicture with the URLs as source, but that didn't work...

Then I tried to save the pics on my computer and match the correct pic for the right img source on the site, this works, but the problem is there is only ONE image at the end of my document. I want one for each days weather. Is there some easy way to get this done?

this is how my code looks, just using 1 of the pics (the first one):

#include <IE.au3>
#include <Word.au3> 

$oIE = _IECreate()
_IENavigate($oIE, "http://www.smhi.se/vadret/hav-och-kust/kust?pp=http://www.smhi.se/produktportal-1.0/forecastCoastDetailed.do?areaType=coast&geoAreaId=17")

$oWordApp = _WordCreate ()
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oRng = $oDoc.Range
For $i = 0 to 6 Step 1
    $oTable = _IETableGetCollection ($oIE, $i)
    $aTableData = _IETableWriteToArray ($oTable, True)
    $oImg = _IEImgGetCollection ($oIE, 40+$i)
    $j = "\1.png"
    With $oRng
        .Text = $aTableData[0][0] & @LF & $aTableData[2][0] & @LF
        .Collapse (0) ;What does this do?
    $oPic = _WordDocAddPicture ($oDoc, @WorkingDir & $j, False, True, $oRng)
    $oPic.Range.InsertAfter (@LF & @LF); This won't do anything! Why?
    $oRng = $oPic.Range
_IEQuit ($oIE)

I would be very happy for some good advice here!


Share this post

Link to post
Share on other sites

some code is useless, like $oImg. It's because I've been messing around with different ways to do this and I didn't delete all the leftovers, just ignore it =)

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...