Jump to content

Recommended Posts

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.

#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
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")
Link to post
Share on other sites
  • Moderators

Hi, Nunos. Are you receiving an error when trying to run it, or does it simply sit there and do nothing?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
Share on other sites

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
When the words fail... music speaks
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...