Jump to content

Recommended Posts

Posted

I am trying to compile a script that is a couple of scripts from examples I tried to put together. I haven't had any trouble compiling the script to an exe but it won't run on any computer accept this one. I am not sure if it has something to do with trying to add a UDF or if I am not selecting the proper settings when I compile it. Script is below and I thank you in advance for your time.

#RequireAdmin
#include-once
#include "_Zip.au3"
;Func Defraggler()
ProcessClose("chrome.exe") ;<=== Close Web Browsers
ProcessClose("firefox.exe") ;<=== Close Web Browsers
ProcessClose("iexplore.exe") ;<=== Close Web Browsers
ProgressOn("Defraggler", "Downloading: Defraggler", "0%")
$url = "http://www.piriform.com/defraggler/download/portable/downloadfile" ;<===Set URL
$folder = @ScriptDir & "\downloads\Defraggler.zip" ;<===Set folder
$hInet = InetGet($url, $folder, 1, 1) ;<===Forces a reload from the remote site and return immediately and download in the background
$FileSize = InetGetSize($url) ;<===Get file size
While Not InetGetInfo($hInet, 2) ;<===Loop until download is finished
Sleep(500) ;<===Sleep for half a second to avoid flicker in the progress bar
$BytesReceived = InetGetInfo($hInet, 0) ;<===Get bytes received
$Pct = Int($BytesReceived / $FileSize * 100) ;<===Calculate percentage
ProgressSet($Pct, $Pct & "%") ;<===Set progress bar
WEnd
ProgressOff()
DirRemove("defraggler", 1)
_Zip_UnzipAll(@ScriptDir & "\downloads\Defraggler.zip", @ScriptDir & "\defraggler\", 0) ;<=== Decompress
ShellExecuteWait("df.exe", "C: /Large *.* 150", @ScriptDir & "\defraggler\")
DirRemove("defraggler", 1)
FileDelete(@ScriptDir & "\downloads\defraggler.zip")
;EndFunc
Posted (edited)

Are you sure all have a "Downloads" directory in @ScriptDir??

InetGet() won't run properly if filename isn't correct. Maybe this line will help you:

If Not FileExists(@ScriptDir & "Downloads") Then DirCreate(@ScriptDir & "Downloads")
Edited by Andreik
Posted

The error WAS unable to find df.exe but Andreik's solution at the top of the script has resolved it in my first tests. Thank you all for your help I appreciate your time. :oops:

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