Jump to content

file copy progress


buzz44
 Share

Recommended Posts

hello all, this is in relation to batfastas's topic in the support forum.

if you all could plz read the script below

$copy = FileCopy ( "C:\Program Files\Diablo II\d2data.mpq", "C:\Documents and Settings\test\Desktop\d2data.mpq")

If FileExists ( "C:\Documents and Settings\test\Desktop\d2data.mpq" ) = 1 then
msgbox(0,"","didnt work??")
Endif

Do

$origfilesize = FileGetSize( "C:\Program Files\Diablo II\d2data.mpq" )
$copyfilesize = FileGetSize( "C:\Documents and Settings\test\Desktop\d2data.mpq" )

$percent = $copyfilesize / $origfilesize * 100

ProgressOn("Progress Meter", "")
ProgressSet($percent)
Sleep(1000)

Until $copy = 1

this code is simply supposed to copy a file from one place to another and show me its progress, the problem is the progress bar doesnt come up until the file has finished copying, same with the msg box, is there a way i can make the progresss bar start while the file is still copying?

edit: also is there a way i can declare a variable with out it actaully runing ie.

$copy = FileCopy ( "C:\Program Files\Diablo II\d2data.mpq", "C:\Documents and Settings\test\Desktop\d2data.mpq")

declare it but dont do it...

Edited by buzz44

qq

Link to comment
Share on other sites

Your script is waiting until FileCopy is finished. You have to use an external copy-program (f.ex. %comspec% /c copy) and start it with Run(). Afterwards you can check the sizes in a loop until $copyfilesize = $origfilesize

<{POST_SNAPBACK}>

thanks for the help, i think its the key :idiot:, problem but lol, when i try write "c:\program files\diablo II\d2data.mpq" using autoit ie, using Run("cmd.exe") or Comspec, i get an error like the it, saying unable to parse line, and the ^ points at the colon after the C:, any help

qq

Link to comment
Share on other sites

Ah, sounds to me like a quotes in quotes issue. If you post the whole line we might be able to debug it.

<{POST_SNAPBACK}>

yeah it is, ive got the right number of them in there but.

Run("cmd.exe" & "copy "c:\program files\diablo II\d2data.mpq" c:\temp\d2data.mpq")

qq

Link to comment
Share on other sites

This should be in support forum?

Here is your line corrected. Notice single quotes and double quotes.

Run('cmd.exe copy "c:\program files\diablo II\d2data.mpq" c:\temp\d2data.mpq')

<{POST_SNAPBACK}>

hey, thankyou works great, ya i wasnt sure were to put it, it did start with a script but :D, thankyou everyone i think ill b fine now :idiot:

qq

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

  • Recently Browsing   0 members

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