Jump to content
Sign in to follow this  
HeavenlyDemon

FileCopy - Script Stuck End Process

Recommended Posts

HeavenlyDemon

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.8.1
Author: H.D.

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here


#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("uniUP", 615, 431, 192, 124)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem2 = GUICtrlCreateMenuItem("Open", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Save", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenu("Help")
$MenuItem7 = GUICtrlCreateMenuItem("About", $MenuItem6)
$MenuItem8 = GUICtrlCreateMenuItem("Update", $MenuItem6)
$MenuItem9 = GUICtrlCreateMenuItem("", $MenuItem6)
$MenuItem10 = GUICtrlCreateMenuItem("Official Site", $MenuItem6)
$Input1 = GUICtrlCreateInput("Version Number", 270, 335, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
$List1 = GUICtrlCreateList("", 0, 0, 265, 409, BitOR($LBS_NOTIFY, $WS_VSCROLL, $WS_BORDER))
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
$Button1 = GUICtrlCreateButton("Add Files", 270, 0, 75, 25)
$Button2 = GUICtrlCreateButton("Create Update Files", 270, 360, 341, 49)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

Opt("GUICoordMode", 2)

Global $addfile[100], $x = 1, $one = 0
If FileExists(@ScriptDir & "\Data\list.dat") Then FileMove(@ScriptDir & "\Data\list.dat", @ScriptDir & "\Data\BackUpList\" & @MDAY & "-" & @MON & "-" & @YEAR & " - " & _
@HOUR & "-" & @MIN & "-" & @SEC & ".dat")

start()
addfile()
createupdate()

Func start()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Call("addfile")
Case $Button2
Call("createupdate")

EndSwitch
WEnd
EndFunc ;==>start

Func addfile()
If $one == 0 Then
FileWriteLine(@ScriptDir & "\Data\list.dat", GUICtrlRead($Input1))
$addfile[$x] = FileOpenDialog("Add Files", @ScriptDir, "All files (*.*)")
GUICtrlSetData($List1, StringRegExpReplace($addfile[$x], "^.*\\", ""))
FileWriteLine(@ScriptDir & "\Data\list.dat", StringRegExpReplace($addfile[$x], "^.*\\", ""))

$x += 1
$one = 1

Else
$addfile[$x] = FileOpenDialog("Add Files", @ScriptDir, "All files (*.*)")
GUICtrlSetData($List1, StringRegExpReplace($addfile[$x], "^.*\\", ""))
FileWriteLine(@ScriptDir & "\Data\list.dat", StringRegExpReplace($addfile[$x], "^.*\\", ""))

$x += 1
EndIf
EndFunc ;==>addfile

Func createupdate()
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Input1, $GUI_DISABLE)
GUICtrlSetState($List1, $GUI_DISABLE)
$lable = GUICtrlCreateLabel("File copy in progress...", -1, -1)
For $a = 1 To $x
$copy = FileCopy($addfile[$a], @ScriptDir & "\Data\" & StringRegExpReplace($addfile[$x], "^.*\\", ""), 9)
Next
MsgBox(0, "", "Done")
GUICtrlDelete($lable)
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Input1, $GUI_ENABLE)
GUICtrlSetState($List1, $GUI_ENABLE)


EndFunc ;==>createupdate

So this is a script to create a list of files that one may need to update from a server to a client

It works fine with small files (tested up to 600Mb) but for a file over 3Gb the script gets stuck and i need to close it with end proccess

Share this post


Link to post
Share on other sites
Nessie

Take a look to _LargeFileCopy UDF:

Or Copy UDF:

Hi!

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites
HeavenlyDemon

Take a look to _LargeFileCopy UDF:

Or Copy UDF:

Hi!

So simple...thanks Nessie

Works fine now

Share this post


Link to post
Share on other sites
Nessie

Glad to help you.


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

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  

×