Jump to content
Sign in to follow this  
Akshay07

Monitoring if uses click on CANCEL while downloading file

Recommended Posts

Akshay07

Hello,

I am trying to achieve the following:

1/ Open a web page in IE and download a file from this web page

2/ Monitor when the user click on the CANCEL button while download is ongoing ---> this is where I am having issues, I can't find how to do that.

Here is part of the script I am using for this:

$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
        WinWaitActive ( "File Download" )
        Send ("{LEFT}")   ; This is to simulate a click 
        Send("{ENTER}")   ; on the "save" button (there might be a better way to do this)
        ; Here, I would like to monitor if 
        ; the user click on the "cancel" button
        ExitLoop
    EndIf
Next

Does anyone have any hint?

Edited by Akshay07

Share this post


Link to post
Share on other sites
Valuater

Can't you use InetGet() for the actual download?

It would save a lot of faulty scripting.

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Akshay07

Can't you use InetGet() for the actual download?

It would save a lot of faulty scripting.

8)

I did not know this command and it is indeed saving a lot of instructions. I am very new to AutoIt and I am using the help as much as I can but nothing can replace experience (and learning by comments such as yours, thanks for the tip :))

However, I do need the user to cancel the download at any time he wants (this is mandatory), which can be achieved through "my" previous code (very much inspired from an example from the "help").

Is there a way to do the same while using InetGet()? For example, by creating a window with a cancel button?

I do need to have the user being able to cancel the download manually at any time, and InetGet()does not show the download progress windows.

Edited by Akshay07

Share this post


Link to post
Share on other sites
Akshay07

I think I found it using the Help!

InetGet("abort")

Thanks Valuater for telling me about InetGet() function!

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  

×