Can someone help me with downloading images plz

Hello every one,

I am having a problem with a test script that I am making to see if this program can do what I am hoping to.

This is the code I am trying to use.

session.downloadFile( "http://www.someURL/" + session.getVariable ("IMAGEURL"), "C:/images/" + session.getVariable ("IMAGENAME") + ".jpg" );

This code works if I would enter the full URL manually instead of trying to use the ~@IMAGEURL@~. So the code will save the images as long as I manually type in the entire URL. But I need to be able to scrape the url and download the image automatically.

If I save ~@IMAGEURL@~ to a file it looks the way it should look. But the error message in the log shows this.

ERROR: Failed to retrieve the file: http://www.someURL/null. The server returned a status code of 404.

So for some reason that I cannot figger out the program don't want to use my ~@IMAGEURL@~ variable and puts "null" in its place.

Any help would be appreciated.

Make sure that in your

Make sure that in your extractor pattern that you've checkmarked the box that says "Save to session variable". If you don't do that, then you can't use the "session.getVariable" command.

Alternatively, if you're calling that script of yours "after each pattern application", and if that same extractor pattern is where you're getting your "~@IMAGEURL@~" variable, you could just change your script to do dataRecord.get("IMAGEURL") instead of the session variable method. (If you choose this alternative way, then you don't need to checkmark the "save to session variable" box on the token itself.)

Does that fix the problem at all?

"Save to session

"Save to session variable"

*SIGH*

I know I checked this before, but I know that for some reason the variable reverts back to default if you change its name. I might have done that at some point, don’t know. But that was the problem.

I had a problem with having a " at the end of the url as well. But that was a quick fix in my extractor.

Thanks loads :-D

And thanks for the fast reply.

Yes-- If you change the

Yes-- If you change the variable name by overwriting the text in your extractor pattern (and not by editing the token, and then changing the name in the pop-up), it'll orphan the old token, and then it'll make a new one (blank) token out of the new name.

If you ever want to change the name of a token, be sure to double-click it first, and change the name in the token "name" box :)

Tim