Jump to content

Suggestions For Image Saving?


Parrot
 Share

Recommended Posts

Forgive me if I've missed something obvious here, I'm new to AutoIt and figuring out the IE Management is taking a lot of trial and error.

Basically, I'm trying to get this script to log into my comics.com account and save an image to my hard drive. The problem I'm running into now is that the image isn't listed as either a .gif or .jpg - instead it's fed by a script listed as something like "archiveViewer?stripId=254232"

Usually it's a .gif file, but once in a while it's a .jpg - and I want to make sure I download each file with the proper extension. I don't think I can do that properly using InetGet, but if I'm wrong about that let me know.

Explorer's "Save As" function seems to know the proper file type for saving the image, so I thought I'd try to use that and have the script just enter the proper save path minus the file extension.

Unfortunately, that doesn't seem to work, the "Save As" dialog opens up, but nothing gets typed in. I'm guessing that there's something about the IE Management scripts that forbids direct entry like that, am I right?

In any case, this is what the script looks like right now. Does anybody have any suggestions?

#include <IE.au3>
$oIE = _IECreate ("https://members.comics.com/members/registration/showLogin.do")
_IELoadWait ($oIE)

$oForm = _IEFormGetObjByName ($oIE, "userForm")
$oEmail = _IEFormElementGetObjByName ($oForm, "email")
$oPass = _IEFormElementGetObjByName ($oForm, "password")
_IEFormElementSetValue ($oEmail, "myemail")
_IEFormElementSetValue ($oPass, "mypassword")

$oSubmit = _IEGetObjByName ($oIE, "sign in")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)

_IENavigate ($oIE, "http://members.comics.com/members/extra/archive/firstStripInMonth.do?comicId=901&yyyymm=190001&comic=cowandboy")
$sHTML = _IEDocReadHTML ($oIE)

$oImgs = _IEImgGetCollection ($oIE)
$oLinks = _IELinkGetCollection ($oIE)

$newlink = "NONE"
For $oLink In $oLinks
    If StringInStr($oLink.href, "?date=") Then
        $newlink = $oLink.href
    EndIf
Next

$newimage = "NONE"
For $oImg In $oImgs
    If StringInStr($oImg.src, "archiveViewer") Then
        $newimage = $oImg.src
    EndIf
Next

_IENavigate ($oIE, $newimage)
_IELoadWait ($oIE)

_IEAction ($oIE, "saveas")
WinWaitActive("Save Picture")
Send("D:\allpics\comics\CowAndBoy\1")
Link to comment
Share on other sites

from my experience as long as the link u use in INETGET is a type of direct link, u can use any extention and most pictures will save as that, just fine. for example if u take any random .jpg on your computer and rename it *.gif it will still be a working picture. but as long as the link u give INETGET is a direct link, there should be no worries

(please correct me if im wrong)

Link to comment
Share on other sites

from my experience as long as the link u use in INETGET is a type of direct link, u can use any extention and most pictures will save as that, just fine. for example if u take any random .jpg on your computer and rename it *.gif it will still be a working picture. but as long as the link u give INETGET is a direct link, there should be no worries

(please correct me if im wrong)

That seems to be a problem for me. I've just tried saving the images using inetget, but that doesn't seem to work. I believe the cause is that the website doesn't give me a direct link to the image, but rather the link is to a script which serves the image. So apparently that option's out.

Does anybody have any other ideas? Or does anybody know what it would take to make the last two lines of my script work the way I want them to?

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