Jump to content
Sign in to follow this  
buzz44

file copy progress

Recommended Posts

buzz44

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

Share this post


Link to post
Share on other sites
HighGuy

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

Share this post


Link to post
Share on other sites
buzz44

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

Share this post


Link to post
Share on other sites
Chris_1013

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

Share this post


Link to post
Share on other sites
ezzetabi

Edit: Ops... I was wrong. Sorry.

Similar topic... with the solution of mine:

Just a click away...

Edited by ezzetabi

Share this post


Link to post
Share on other sites
buzz44

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

Share this post


Link to post
Share on other sites
MHz

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')

Share this post


Link to post
Share on other sites
buzz44

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

Share this post


Link to post
Share on other sites
sugi

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

Share this post


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
Sign in to follow this  

×