Jump to content

Recommended Posts

Posted (edited)

There is a way but it may not be easy.

The inbuilt windows file copy dialog box can be called from your code and perform operations like file move and file copy.

Unfortunately its not easy to implement this in AutoIt code and needs DllStruct and DllCall.

Here is the MSDN link for SHFileOperation API function: http://msdn.microsoft.com/library/default....leoperation.asp

And a VB tutorial for the same: http://vbnet.mvps.org/index.html?code/shel...rectorycopy.htm

<{POST_SNAPBACK}>

...got the t-shirt ;) Edited by SumTingWong
Posted

SumTingWong Your code works great but i want to set the progress on the progress bar .

How can i set the filename that actually being copied at label and the status at progress bar ?

Here is some of my ;) code

$search = FileFindFirstFile($server&"\"&$share&"\"&$directory&"\"&$source&"\*.*")

If $search = -1 Then

MsgBox(01600262144, "Error", "Installation Files Not Found"&@CRLF&"Please Contact Employee")

Exit

EndIf

$p = 0

$i = $size[1]

DirCreate($destination)

While $i >= 1

$file = FileFindNextFile($search)

$p = ($i/$size[1])*100

$p = 103 - $p

FileCopy ($server&"\"&$share&"\"&$directory&"\"&$source&"\"&$file , $destination ,1 )

If @error Then ExitLoop

$i = $i - 1

GUICtrlSetData ($main_status,"Copying File :"&$file)

GUICtrlSetData ($Main_Progress ,$p)

If @error Then ExitLoop

WEnd

; Close the search handle

FileClose($search)

There is a hex ( 31303030303030 ) reasons i love AutoIt !

Posted

SumTingWong Your code works great but i want to set the progress on the progress bar .

How can i set the filename that actually being copied at label and the status at progress bar ?

Here is some of my  ;)  code

$search = FileFindFirstFile($server&"\"&$share&"\"&$directory&"\"&$source&"\*.*")

If $search = -1 Then

    MsgBox(01600262144, "Error", "Installation Files Not Found"&@CRLF&"Please Contact Employee")

    Exit

    EndIf

$p = 0

$i = $size[1]

DirCreate($destination)

While  $i >= 1 

    $file = FileFindNextFile($search)

$p =  ($i/$size[1])*100

$p =  103 - $p

FileCopy ($server&"\"&$share&"\"&$directory&"\"&$source&"\"&$file , $destination ,1 )

If @error Then ExitLoop

$i = $i - 1

    GUICtrlSetData ($main_status,"Copying File :"&$file)

GUICtrlSetData ($Main_Progress ,$p)

If @error Then ExitLoop

WEnd

; Close the search handle

FileClose($search)

<{POST_SNAPBACK}>

you're still using ctrlsetdata to update progress....

check out in the helpfile:

ProgressOn() ProgressOff() Progress Set()

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...