Jump to content

Download and execute a file?


Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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=

Link to comment
Share on other sites

  • Developers
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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...