Re: Save Link As...
"valery_vi" <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
> OK, so I understand the concept of getting links, but what about It's not concept. This is object MSHTML document, only. Next step is to read AutoIt3 Help about function InetGet: "... Downloads a file from the internet using the http or ftp protocol. InetGet ( "URL" [,"filename" [, reload [, background]]] ) ..." Valery --- In [email protected], "gkoelln7" <gkoelln7@...> wrote: > > OK, so I understand the concept of getting links, but what about > saving the linked files without clicking on the links? > > --- In [email protected], "valery_vi" <shehrer1@> wrote: > > > > Very easy script which gets link of this group page: > > > > #include <IE.au3> > > $oIE = _IECreate() > > $oIE.navigate('http://tech.groups.yahoo.com/group/AutoItList') > > _IELoadWait($oIE) > > $oLinks = _IELinkGetCollection ($oIE) > > $iNumLinks = @extended > > MsgBox(0, "Link Info", $iNumLinks & " links found") > > $i = 1 > > For $oLink In $oLinks > > if $i > 20 then ExitLoop > > MsgBox(0, "Link Info", 'Link #' & $i & @CrLf & $oLink.href) > > $i += 1 > > Next > > > > Valery > > > > --- In [email protected], "valery_vi" <shehrer1@> wrote: > > > > > > > Or, taking it a step further, what if one wanted to grab all the > > > links > > > > to MP3 files and download them all and save them to a particular > > > folder? > > > > > > Try this script. It shows how can you get links of any html page. > > > > > > #include <IE.au3> > > > dim $oIE, $s = "" > > > $s &= "<HEAD>" & @CR > > > $s &= "<TITLE>_IE_Example('basic')</TITLE>" & @CR > > > $s &= "</HEAD>" & @CR > > > $s &= "<BODY>" & @CR > > > $s &= "<p><ol><li><a > > > href='http://tech.groups.yahoo.com/group/AutoItList/post? > > > act=reply&messageNum=31052'>Message #31052</a>" & @CR > > > $s &= "<p><li><a > > > href='http://tech.groups.yahoo.com/group/AutoItList/post? > > > act=reply&messageNum=31053'>Message #31053</a>" & @CR > > > $s &= "<p><li><a > > > href='http://tech.groups.yahoo.com/group/AutoItList/post? > > > act=reply&messageNum=31054'>Message #31054</a>" & @CR > > > $s &= "</ol>" & @CR > > > $s &= "</BODY>" & @CR > > > $s &= "</HTML>" > > > $oIE = _IECreate() > > > _IEDocWriteHTML($oIE, $s) > > > $oLinks = _IELinkGetCollection ($oIE) > > > $iNumLinks = @extended > > > MsgBox(0, "Link Info", $iNumLinks & " links found") > > > For $oLink In $oLinks > > > MsgBox(0, "Link Info", $oLink.href) > > > Next > > > > > > > > > Valery > > > > > > --- In [email protected], "gkoelln7" <gkoelln7@> wrote: > > > > > > > > Excel is not connecting to or getting information from a remote > > > > database in my case. I'm just trying to directly download an > > Excel > > > > file that they link to (instead of opening the file within IE, > > then > > > > saving it). > > > > > > > > Let's make it simpler. What if the default action for clicking > > on a > > > > link to an MP3 file is to open it with the QuickTime plugin > > within > > > the > > > > browser? If one were to automate IE to click on the link, it will > > > > just open the MP3 in the browser. But if one wanted to save the > > > file > > > > (regardless of the default browser action for clicking an MP3 > > link), > > > > they would right-click on the link to the MP3 file and click Save > > > > Target As. But is there a COM command (assuming that's how one > > > would > > > > do it from AutoIt) that would initialize such a command? > > > > > > > > Or, taking it a step further, what if one wanted to grab all the > > > links > > > > to MP3 files and download them all and save them to a particular > > > folder? > > > > > > > > Maybe I just can't automate this particular task. *shrug* > > > > > > > > Greg > > > > > > > > --- In [email protected], "valery_vi" <shehrer1@> wrote: > > > > > > > > > > Do you know about using Excel as Web-client? > > > > > ie > > > > > http://visualbasic.about.com/od/learnvba/l/bldykwebexcela.htm > > > > > > > > > > Valery > > > > > > > > > > --- In [email protected], "valery_vi" <shehrer1@> > > wrote: > > > > > > > > > > > > > Does any of that make sense? > > > > > > > > > > > > :-) > > > > > > Everything makes some sense, I think. But not every thing > > > automated > > > > > > has one. IE application has to embed Excel control for update > > > or > > > > > view > > > > > > shared database files. This service is good and useful. > > > > > > > > > > > > You want to make more cool trick (double embedding with log > > > in!): > > > > > > 1. AutoIt script has to embed IE control > > > > > > 2. Embedded IE control has to connect to remote Excel > > database. > > > > > > 3. Embedded IE control has to embed Excel control to open > > > > > downloaded > > > > > > file. > > > > > > > > > > > > This is like to embed Outlook control into IE to update local > > > > > > account. Isn't it? > > > > > > > > > > > > Valery > > > > > > > > > > > > --- In [email protected], "gkoelln7" <gkoelln7@> > > wrote: > > > > > > > > > > > > > > Well, to be more specific, I can obtain the link using > > > > > > > _IELinkClickByText(), but the site requires an > > identification > > > > > > > certificate (i.e., login) in order to save the file (which > > is > > > an > > > > > > Excel > > > > > > > file). If I go to the link manually in IE, it opens the > > > Excel > > > > > file > > > > > > in > > > > > > > IE, which changes all the menus to Excel menus. Then, when > > I > > > > > click > > > > > > > File and Save As, it asks me to select a certificate to > > send > > > as > > > > > > > identification. _IEAction(...,"saveas") doesn't work with > > it > > > once > > > > > > > it's loaded. > > > > > > > > > > > > > > So, when I right-click on the link to the Excel file > > (instead > > > of > > > > > > just > > > > > > > left-clicking the link) and click Save As, it allows me to > > > save it > > > > > > > without any problems. > > > > > > > > > > > > > > Does any of that make sense? > > > > > > > > > > > > > > Greg > > > > > > > > > > > > > > --- In [email protected], "valery_vi" <shehrer1@> > > > wrote: > > > > > > > > > > > > > > > > See UDF from IE.au3: > > > > > > > > > > > > > > > > Func _IELinkClickByText(ByRef $o_object, $s_linkText, > > > $i_index > > > > > = > > > > > > 0, > > > > > > > > $f_wait = 1) > > > > > > > > > > > > > > > > It can "Simulate a mouse click on a link with text sub- > > > string > > > > > > > > matching the string provided" > > > > > > > > > > > > > > > > But you can just get links collection. > > > > > > > > > > > > > > > > $links = $o_object.document.links > > > > > > > > > > > > > > > > Now you have to get any item from this collection and > > save > > > it > > > > > > > > directly without IE's action at all. > > > > > > > > > > > > > > > > Valery > > > > > > > > > > > > > > > > > > > > > > > > --- In [email protected], "gkoelln7" <gkoelln7@> > > > wrote: > > > > > > > > > > > > > > > > > > Neither INetGet(), nor _IEAction($oIE, "saveas") will > > > work > > > > > for > > > > > > what > > > > > > > > I > > > > > > > > > want to do. Is it possible to simulate performing the > > > Save > > > > > > Link As > > > > > > > > > (aka Save Target As) on a link? > > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > Greg > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >