Jump to content

CTRLCREATEPROGRESS


Necromorph
 Share

Recommended Posts

okay, im not sure of a good way to do this so i was wondering if i can get some help

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

DO 
    FILECOPY("C:\DIR\Test*.exe", "C:\*.exe", 1)
    GUICreate("COPYING", 500, 75)
    GUICtrlCreateProgress(10, 10, 480, 20, $PBS_MARQUEE)
    _SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 25)
    GUISetState()
    EXITLOOP
UNTIL

i just need a good "UNTIL". a way to check if the file is done copying and then end the loop, and if im overwriting i cannot use FILEEXISTS, because it does already exist. not sure what else to do.

be nice if i could say

UNTIL NOT FILECOPY(C:\DIR\TEST*.exe", "C:\*.exe")

but this isn't the case.

thanks

Edited by redLabel
Link to comment
Share on other sites

Cant use FILEEXIST because as soon as the file copy starts, it "exists"

i would like to use this

#include <GUIConstantsEx.au3>

#include <ProgressConstants.au3>

#include <SendMessage.au3>

$var=FILECOPY("C:\DIR\Test*.exe", "C:\*.exe", 1)

DO

GUICreate("COPYING", 500, 75)

GUICtrlCreateProgress(10, 10, 480, 20, $PBS_MARQUEE)

_SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 25)

GUISetState()

EXITLOOP

UNTIL $var RETURN 1

Edited by redLabel
Link to comment
Share on other sites

Hi ,

This works for me:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
If FileExists(@TempDir&"\coyingdata.dat") Then
    FileDelete(@TempDir&"\coyingdata.dat")
EndIf

DirCreate(@HomeDrive&"\Dir")
Dim $avarray
RunWait("cmd.exe /c dir /B *.exe >>"&@TempDir&"\coyingdata.dat",@ScriptDir,@SW_HIDE)
_FileReadToArray(@TempDir&"\coyingdata.dat",$avarray)

#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("Test", 459, 191, 192, 124)
$Button1 = GUICtrlCreateButton("Do it Now", 144, 136, 153, 25, $WS_GROUP)
$Progress1 = GUICtrlCreateProgress(48, 24, 361, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            For $i=0 To $avarray[0]


            RunWait("cmd.exe /c " & "copy /b " & $avarray[$i] & " " & @HomeDrive&"\dir",@ScriptDir,@SW_HIDE)
            GUICtrlSetData($Progress1,$i / $avarray[0] * 100)
        Next
        FileDelete(@TempDir&"\coyingdata.dat")
MsgBox(64,"Operation Done!","Operation Done!",3)

Exit
    EndSwitch
WEnd

edit:correction on script

Edited by Sh3llC043r
[size="5"] [/size]
Link to comment
Share on other sites

thanks a lot, but could you help me out a little bit more, im still learning how to read code. im not sure where exeactly to include my FILECOPY $dir and $dest. also, i don't really need all the buttons and stuff, i just want a progress while its copying, then to stop after its done, thanks a lot for you help.

Link to comment
Share on other sites

redLabel

Hi again.

Dude i`m sorry.My english very bad & i only use Translator for understand forum comments.

But it seems you are asking about progressbar.Am i right?

It does what you are looking for.I assume when file copy-ed from surce dir (in my script this is a @scriptdir) to destination dir.(In my sample this is a new created @homdrive&"\dir" directory.

Do you try it?

+I think you need get all of content of source dir to file and then with _filereadtoarray() read it to $avarray and and begin copy + calculate for progress bar

GUICtrlSetData($Progress1,$i / $avarray[0] * 100)

Sorry dude really now i didn`t understand what you whant to do.

[size="5"] [/size]
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...