Jump to content
JoeBar

IE Click a button to DL

Recommended Posts

4 hours ago, seadoggie01 said:

I was taking a look at my code and I just use FileExists checks before opening the download. I just tested it with a large zip file and it won't open until the file is downloaded completely

It's working :

Local $isfile = 0
    Do
        $isfile = FileExists($sFileSelectFolder & "\" & $fileDL)
        Sleep(500)
    Until $isfile = 1

But I have another problem, with this automation, if the user wants to download more than once, the path is already opened when the Save As window appears, then the "ControlClick("Save As", "", "&Save", "left", 1, 5, 5)" keeps ckicking and it get freezed here. Apparently, you cannot enter the same path as the same that is loaded.

This line must be skipped if the precedent download is in the same path, but i don't know how to deal with it.

Edited by JoeBar

Share this post


Link to post
Share on other sites
32 minutes ago, JoeBar said:

It's working

Yay!

I didn't quite get the rest of the post... I think you're talking about the user selecting a file that already exists? Just check before attempting the download. Something like

Local $sFileName = ""
    Do
        $sFileName = FileOpenDialog("Select", @ScriptDir, "All(*.*)")
        If FileExists($sFileName) Then 
            $sFileName = ""
            MsgBox($MB_ERROR, "File Already Exists", "Please select a new file name.")
        EndIf
    Until $sFileName <> ""

 


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Share this post


Link to post
Share on other sites
5 minutes ago, seadoggie01 said:

Yay!

I didn't quite get the rest of the post... I think you're talking about the user selecting a file that already exists? Just check before attempting the download. Something like

Local $sFileName = ""
    Do
        $sFileName = FileOpenDialog("Select", @ScriptDir, "All(*.*)")
        If FileExists($sFileName) Then 
            $sFileName = ""
            MsgBox($MB_ERROR, "File Already Exists", "Please select a new file name.")
        EndIf
    Until $sFileName <> ""

 

No, it's when the automatic insertion of the path doesn't work cause we are already in this path and it freeze the Save button.

I'm trying to make it by writing to [CLASS:ToolbarWindow32; INSTANCE:3] with ControlSend and ControlSetText, but nothing works.

Edited by JoeBar

Share this post


Link to post
Share on other sites

Can you post the code? I'm confused, but I think that you mean you try to input the path into the top Edit control of the Save As dialog box each time and the file name into the bottom Edit control. If that's the case, just type the full path to the bottom edit.


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Share this post


Link to post
Share on other sites
11 hours ago, seadoggie01 said:

Can you post the code? I'm confused, but I think that you mean you try to input the path into the top Edit control of the Save As dialog box each time and the file name into the bottom Edit control. If that's the case, just type the full path to the bottom edit.

;save as - Dont need to change any of this except for filepath.
        WinActivate("Enregistrer sous", "Enregistrer") ;
        WinWaitActive("Enregistrer sous", "Enregistrer", 10) ;
        ControlSetText("Enregistrer sous", "", "Edit1", $sFileSelectFolder)
        ControlClick("Enregistrer sous", "", "&Enregistrer", "left", 1, 5, 5)
        Sleep(100)
        ControlClick("Enregistrer sous","","&Enregistrer", "left", 1, 0, 0)

It's this part, i had made the way you described, it was working since the last download path opened in the IE Save As window was not the same in which you want to Save your next file.

Just try to open a FileSave window and paste the same path as opened and try to click Save, it will do nothing, that's my problem.

The solution would be to paste on [CLASS:ToolbarWindow32; INSTANCE:3] instead of in Edit, but i cannot with ControlSend norControlSetText.

Edited by JoeBar

Share this post


Link to post
Share on other sites

I'm not the best with words...

image.png.274b38df7ca607f4d127e17ffaf1c38d.png

The top right box with the up arrow is "[CLASS:ToolbarWindow32; INSTANCE:3]" for me, but I think you meant the box next to it. ;) The inside box on the bottom is the edit where I put the full path (the outside is a combo box that is super annoying). I never touch the top right box with the current path inside it, it doesn't matter if you put the full path in the edit box. I tried overwriting my file and saving to the same path, and both worked here, though there is a msgbox asking if I want to replace my current download which I need to accept first.


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Share this post


Link to post
Share on other sites

Yes, i was talking about the "This PC > Downloads..." control, you can paste the path even when it's the same path that is currently displayed. (This cannot be done in the Edit1).

Another thing, i cannot put the filename, since i get it automatically when i make my clicks. (the filename is automatically generated as said in 1st post).

 

Just test my script, you will see what i'm talking about.

That's freezed here, you cannot validate with Save :

Save As.jpg

Here you can :

2057308734_SaveAs.jpg.6d244901c19968a057696a9178b42336.jpg

The problem is there seems to be 2 differents display path for the Desktop, the 1st doesn't work to Save, the 2nd works.

 

For the replace file box, i will do it after the "path problem" ;)

Edited by JoeBar

Share this post


Link to post
Share on other sites

I can't test your script, it runs on a NAS that I don't have access to and the words are in ... French? :D

You'll need to put the file name in the edit box too... like "C:\Users\JoeBar\Desktop\file.zip" and then it should save fine regardless of the location that is displayed. If that doesn't work, I'm out. I've had this working on four separate computers with Windows 10 and 7.


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Share this post


Link to post
Share on other sites
28 minutes ago, seadoggie01 said:

I can't test your script, it runs on a NAS that I don't have access to and the words are in ... French? :D

You'll need to put the file name in the edit box too... like "C:\Users\JoeBar\Desktop\file.zip" and then it should save fine regardless of the location that is displayed. If that doesn't work, I'm out. I've had this working on four separate computers with Windows 10 and 7.

Sorry i forgot that, i picked the script in a topic with a functionnal example, you could test if i find it.

The original script didn't involve putting name manually as we get it only on the Save As window, the goal was to set the path, and push twice the Save button (once to enter the path, the second to Save the file under the filename that appeared meanwhile).

Edited by JoeBar

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

×
×
  • Create New...