rietjevaldo

Download and execute a file?

5 posts in this topic

#1 ·  Posted

How can i download a file? and get the name of the downloaded file?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Pretty simple.  You have to know what the url for the file on the web server is.  You can do this by right-clicking the link which would start the download and selecting "Copy link address" or copy link location.  Here is a script that I wrote which will scan a web page for all of the links that download a "zip" archive or executable file and download them preserving the file name.  Then execution should be a cinche:

 

; Script Start - Add your code below here
#include <IE.au3>
DirCreate ( @UserProfileDir & "\Downloads\test" )
$oIE = _IECreate ( "http://www.mitec.cz/Data/XML/data_downloads.xml", Default, 0 )
_IELoadWait ( $oIE )
$links = _IELinkGetCollection ( $oIE )
For $link In $links
    If StringRight ( $link.href, 3 ) = "exe" Or StringRight ( $link.href, 3 ) = "zip" Then
        $split = StringSplit ( $link.href, "/" )
        $file = InetGet ( $link.href, @UserProfileDir & "\Downloads\test\" & $split[$split[0]] )
        InetClose ( $file )
    Else
        ContinueLoop
    EndIf
Next
_IEQuit ( $oIE )
Shellexecutewait ( "file.exe", "", @UserProfileDir & "\Downloads\test" )

 

Edited by MattHiggs

Share this post


Link to post
Share on other sites

#3 ·  Posted

On 2017-5-27 at 10:58 PM, MattHiggs said:

Pretty simple.  You have to know what the url for the file on the web server is.  You can do this by right-clicking the link which would start the download and selecting "Copy link address" or copy link location.  Here is a script that I wrote which will scan a web page for all of the links that download a "zip" archive or executable file and download them preserving the file name.  Then execution should be a cinche:

 

; Script Start - Add your code below here
#include <IE.au3>
DirCreate ( @UserProfileDir & "\Downloads\test" )
$oIE = _IECreate ( "http://www.mitec.cz/Data/XML/data_downloads.xml", Default, 0 )
_IELoadWait ( $oIE )
$links = _IELinkGetCollection ( $oIE )
For $link In $links
    If StringRight ( $link.href, 3 ) = "exe" Or StringRight ( $link.href, 3 ) = "zip" Then
        $split = StringSplit ( $link.href, "/" )
        $file = InetGet ( $link.href, @UserProfileDir & "\Downloads\test\" & $split[$split[0]] )
        InetClose ( $file )
    Else
        ContinueLoop
    EndIf
Next
_IEQuit ( $oIE )
Shellexecutewait ( "file.exe", "", @UserProfileDir & "\Downloads\test" )

 

gives me errors, links has to be an object or some shit

Share this post


Link to post
Share on other sites

#4 ·  Posted

It works perfectly fine for me, are you sure you copied it correctly? Keep in mind the ShellExecuteWait will not work as-is because there is no file in the download called "file.exe" but you should just be able to change the website and change the execute name and it will work.


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites

#5 ·  Posted

23 hours ago, rietjevaldo said:

gives me errors, links has to be an object or some shit

Ok let me get down to your level for a change to see if that helps: 

What the fuck do you imbecile expect from a stupid moron answer like that. You provided shit information so get your head out o your ass, kick it in gear and start thinking for a change!  :idiot:

So got that out of my system. Let me know when you need to have that translated to Dutch, specifically the dialect used "below the rivers". ;)

Jos

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.