Jump to content
Sign in to follow this  


Recommended Posts

Oh, the thing that I want to do is something like rapget or USDownloader or something like that...


I came across your post because I'm having trouble with some images and their behaviour is just like turing numbers: they keep changing all the time.

My post: http://www.autoitscript.com/forum/index.php?showtopic=52522

You can find this in the Help File: (to create a hidden browser window)

#include <IE.au3>

_IECreate ( [$s_Url = "about:blank" [, $f_tryAttach = 0 [, $f_visible = 1 [, $f_wait = 1 [, $f_takeFocus = -1]]]]] )

; *******************************************************

; Example 5 - Create an invisible browser window, navigate to a website,

; retrieve some information and Quit

; *******************************************************


#include <IE.au3>

$oIE = _IECreate ("http://sourceforge.net", 0, 0)

; Display the innerText on an element on the page with a name of "sfmarquee"

$oMarquee = _IEGetObjByName ($oIE, "sfmarquee")

MsgBox(0, "SourceForge Information", $oMarquee.innerText)

_IEQuit ($oIE)

so maybe you want to try doing the script with visible window and, after it works that way, try to do it with the invisible parameter.

I understand that OCR can be an easy task to perform, even with hidden browser window, assuming that requesting the image via InetGet will generate a different turing number, but will also instruct the server to expect the last provided turing number. So you actually may not have the same problem as I do.

Share this post

Link to post
Share on other sites

Ok, I have the image :D I use this :

$Img = _IEImgGetCollection($Ventana, 2); $Ventana is my $oIE... xD (I'm spanish...) jiji
$ImgLink = $Img.src;Gets the link to the image...
InetGet($ImgLink, @HomeDrive & "\" & "OCR.jpg");downloads the image...
....(OCR...) xD

But now I have another cuestion...

I download the image, analize it with OCR, type the code in the input box, click de "Download button", but now the browser ask me where do I want to download the file, and I want to automatizate this.... how can I do that ?

(I'm doing al the job alone... :):(;):(;) ;) )

Hi again. Glad to see that your work is in progress. It seems like you're spending too much time with trial/error methods. Maybe you should read the documentation and check out some examples to better understand what you can do with autoit and how you can do it.

My opinion is that the download and SaveAs dialogs are the trickiest. Because you expect the download dialog to appear, click Save, open SaveAs dialog and hit the target file... but honestly you never know what can happen. Timeouts, file location errors, and so on.

So this way your script might not be flawless.

Why don't you try to find some sort of plugin/addon for IE that automatically saves files in a certain location?

If not, try to use the following methods:

- WinWait(title,text) (wait for the download window to appear)

- ControlClick(...) (click the save button)

- WinWait(title,text) (wait for the SaveAs window)

- ControlSend(...) (send for instance an ENTER key to the filename control to accept its location)

Use AutoIt Window Info utility to discover window title and text and controls' parameters.

EDIT: btw, can you be kind enough to share the name of that OCR software that you're using? i've been looking for a good OCR software that supports command-line execution.

Edited by footswitch

Share this post

Link to post
Share on other sites

Shure :( The OCR that I use is called "GOCR" (now JOCR)

The oficial web page is


Its open-source so you can modificate it ;) and its GNU Public License so your program is 100% free ;):D



7: Save the file automaticaly...

Thanks a lot for the help >> AU3 THE BEST !!! (L) :"> ;)

For the download automation part, using the methods stated above will do the trick.

You might want to add some stuff later, like having a timeout on those waitings to avoid your script freezing, waiting forever, because the download isn't started due to communication errors or server busy. This ocasionally happens.

That's the OCR software that I use in my scripts, too. It's not like that good, but as long as you're not dealing with fancy typing, it works fine.

Anything other than this software just costs too much for the use of it.

:) Some other thing to add to the "TODO" list are:

* Detect if the link is a rapidshare link...

* Detect if the OCR program has returned 4 letters, if more > error | else if "_" pressent > error

* Make the programa "read" the links from another file... o from the GUI like USDownloader...

* Make some nice GUI :(

* Detect if the user has an DHCP coneccion, and if so change the IP agter every downloaded file to avoide the waiting...

The first two are easy to implement: just use If conditions with StringInStr to check for "rapidshare", or in the other case for "_", and StringLen to check lenght.

What I would do in this case would be getting Number(FileReadLine("file.txt",1)) directly. If this doesn't result in those 4 chars long then you decide what to do:

Number("x_yz") returns x

Number("_xyz") returns 0

Number("xy_z") returns xy

Now, what else? Ah, you may want to use the parameter "-C 0-9" in GOCR (it's upper C, not lower c) to return only numbers (or "_" when not recognized).

Keep working and sharing your thoughts and good luck :D

Share this post

Link to post
Share on other sites

Trankilo hombre :) yo tambien me alegro de ver a alguien con quien poder hablar en español... juer... me estaba agobiando ya con el ingles... xD jaja


Yo me quedé acá porque la gente responde muy rápido y hay muy buen trato hacia los que no saben. Espero verte más seguido.

But still, I think we should stick to English, for respect. ;)

* Detect if the link is a rapidshare link...

Use StringInStr ( $link, "rapidshare")

Share this post

Link to post
Share on other sites

But still, I think we should stick to English, for respect. ;)

You got that right. Not only for respect, but to keep the post readable. Many people can find themselves lost if languages keep changing for the same post. Especially when they don't understand what's written.

I'm from Portugal and I could still understand you if you kept it simple ;) but let's not do that. please :) lol

Share this post

Link to post
Share on other sites

Hey !!! ;) I made all my exams !!! (L) ;) xD

Congrats :)

Now I can spend much more time with this...

Ok, I implemented the StringInStr , but I want to do this :

$LINE = FileReadLine ("link.txt", $NumeroDeLinea)

If StringInStr($LINE, "rapidshare") = 0 Then

$NumeroDeLinea = $NumeroDeLinea + 1

Go to the beggining and add 1line to the comand $LINE


How can I do it ?

If you knew how many lines you have, you'd use a 'For' statement. Assuming you don't, maybe using a 'While 1' with an ExitLoop will be the best.

So you'd have (edited after realising I wasn't including the "rapidshare" filter):

; before the loop:
$handle=FileOpen("link.txt",0) ; open the file for reading, this will speed up 'line by line reading' compared to opening the file for each reading
$NumeroDeLinea=1 ; assign to the first line
While 1 ; this will loop forever UNLESS there's an Exit/ExitLoop for some condition --> End Of File will exit loop
    $LINE = FileReadLine ($handle, $NumeroDeLinea) ; Special: Sets @error to -1 if end-of-file is reached. 
    If @error==-1 Then
        ConsoleWrite("End Of File, exiting loop."&@LF)
    ElseIf StringInStr($LINE, "rapidshare")<>0 Then ; if it is a rapidshare download, then...
        ; place your downloader here?
        $NumeroDeLinea+=1 ; add one more line and repeat the process
WEnd ; end While

FileClose($handle) ; you're advised to close the file after using it.

EDIT: I didn't include the "rapidshare" filter in my first reply, but it's there now.

Edited by footswitch

Share this post

Link to post
Share on other sites

WoW !!! xD Thanks !!! :);)

Its working !!! ;):(:D:D

Now I have to find a way to download the file without using WinWait.... MuouseClick... and so ....

I will post the code of the program ( version 1.0 ) when it's done ;) (with GUI) xD

Instead of MouseClick, try to use ControlClick. It's more reliable.

Use AutoIt window info util (included in autoit package, you can run it from the start menu) to discover the controlID of the buttons you want to click, then use controlclick(...) to click those controls without having to focus the window or move the mouse.

You can do the same for input boxes with controlsend.

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