Jump to content
Sign in to follow this  
TheCrimsonCrusader

ControlSetText Question

Recommended Posts

TheCrimsonCrusader

I am going to have a copy operation where I am going to copy the contents of c:\folder1 to c:\folder2 as an example and while this operation is going on, the script below is going to be executed and it will bring up the splash text window basically stating that "x" amount of megabytes out of a total of "x" amount of megabytes have been copied and when the size of c:\folder2 is equal to the size of c:\folder1, the script will exit.

Well, this works, but I obviously run into the flashing with the SplashTextOn command, since it is going to be constantly updated as the number of megs is getting updated. I know I need to use the ControlSetText command, but I haven't been able to get it to work with the contents below. Any good suggestions? Thanks in advance!

CODE
Dim $size1, $size2

$size1 = DirGetSize("c:\folder1\")

Do

$size2 = DirGetSize("c:\folder2")

SplashTextOn("Title", "" & Round($size2 / 1024 / 1024) & " megabytes" & " of " & Round($size1 / 1024 / 1024) & " megabytes copied.")

Until $size2 = $size1

Share this post


Link to post
Share on other sites
TheCrimsonCrusader

Does that mean it can't be done with ControlSetText in the way that I have my script? That's adding a large amount of extra code, not to mention, not understanding most of his code. :rolleyes: I was trying to keep it simple like I have it.

Share this post


Link to post
Share on other sites
evilertoaster

From the looks of your script you are using a multi-thread-ish approach...and that the function you posted only monitor the folder size and upadates accordingly.... so some other function is actually moving the folder. If thats the case the code on the other thread does basically the same thing...post what you have in your actual 'filemove' function, otherwise we can't really test the funciton you posted. However to simply modify the control you made with the splash on perhabs something like it shows in the help file-

$message=Round($size2 / 1024 / 1024) & " megabytes" & " of " & Round($size1 / 1024 / 1024) & " megabytes copied."
ControlSetText("Title", "", "Static1", $message)

shot in the dark w/o the other function to test...

Edited by evilertoaster

Share this post


Link to post
Share on other sites
TheCrimsonCrusader

Apparently, when using AutoIt's "DirCopy" command, it won't proceed to the next line of the script until that operation is done. To get around that, I "Mickey Moused" it with xcopy to simulate what it will do:

CODE
Dim $size1, $size2, $quote, $space

$quote=chr(34)

$space=chr(32)

DirCreate ( "c:\RPG\Jade Empire" )

Run("c:\windows\system32\cmd.exe /c xcopy.exe" & $space & $quote & "F:\RPG\Jade Empire\." & $quote & $space & $quote & "C:\RPG\Jade Empire" & $quote & $space & "/i /e /y","", @SW_HIDE)

$size1 = DirGetSize("F:\RPG\Jade Empire")

Do

$size2 = DirGetSize("C:\RPG\Jade Empire")

SplashTextOn("Title", "" & Round($size2 / 1024 / 1024) & " megabytes" & " of " & Round($size1 / 1024 / 1024) & " megabytes copied.")

Until $size2 = $size1

So effectively, this is doing the following:

Creates c:\RPG\Jade Empire directory structure

Executes cmd.exe /c xcopy "F:\RPG\Jade Empire\." "C:\RPG\Jade Empire" /i /e /y to copy the entire directory structure of the original destination to the new destination

Acquires size of F:\RPG\Jade Empire

Then Loops the SplashTextOn as it continues to query the size of the destination folder until it equals the value of the original folder.

Now this works just fine, however, I get the annoying flashing from the SplashTextOn command, since it is constantly being updated. So am I SOL as far as using the ControlSetText command with this simplistic code?

Share this post


Link to post
Share on other sites
TheCrimsonCrusader

bump

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  

×