Sign in to follow this  
Followers 0
TarwadaC4

Set a Progress for a Copying task in GUI

7 posts in this topic

how to set a progress bar for a copying task ( for example i want my script to copy mp4 file from C:\ to Desktop and show progress bar )

any one can set a command in a button which copy a mp4 file from C:\ and set the progress bar to show me my copying progress

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=D:\koda work\Form1.kxf
$Form1 = GUICreate("Form1", 626, 281, 231, 138)
$MenuItem1 = GUICtrlCreateMenu("&MenuItem1")
$MenuItem2 = GUICtrlCreateMenuItem("MenuItem2", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("MenuItem3", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("MenuItem4", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("MenuItem5", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenu("M&enuItem6")
$MenuItem7 = GUICtrlCreateMenuItem("MenuItem7", $MenuItem6)
$MenuItem8 = GUICtrlCreateMenuItem("MenuItem8", $MenuItem6)
$MenuItem9 = GUICtrlCreateMenuItem("MenuItem9", $MenuItem6)
$MenuItem10 = GUICtrlCreateMenu("Me&nuItem10")
$MenuItem11 = GUICtrlCreateMenuItem("MenuItem11", $MenuItem10)
$MenuItem12 = GUICtrlCreateMenuItem("MenuItem12", $MenuItem10)
$MenuItem13 = GUICtrlCreateMenu("Men&uItem13")
$MenuItem14 = GUICtrlCreateMenuItem("MenuItem14", $MenuItem13)
$MenuItem15 = GUICtrlCreateMenuItem("MenuItem15", $MenuItem13)
$Tab1 = GUICtrlCreateTab(40, 40, 225, 169)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Button1 = GUICtrlCreateButton("Button1", 48, 72, 89, 25)
$Button2 = GUICtrlCreateButton("Button2", 152, 72, 89, 25)
$Button3 = GUICtrlCreateButton("Button3", 48, 104, 89, 25)
$Button4 = GUICtrlCreateButton("Button4", 152, 104, 89, 25)
$Button5 = GUICtrlCreateButton("Button5", 48, 136, 89, 25)
$Button6 = GUICtrlCreateButton("Button6", 152, 136, 89, 25)
$Button7 = GUICtrlCreateButton("Button7", 80, 168, 137, 25)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")
$ComputerBoost = GUICtrlCreateGroup("ComputerBoost", 16, 24, 289, 201)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Progress1 = GUICtrlCreateProgress(16, 232, 593, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

just wanna learn how the code will be

Share this post


Link to post
Share on other sites



Did you search the forum for "progress bar"? You will find many different solutions.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2016-08-18 - Version 1.4.6.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-12-04 - Version 1.2.2.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

yea i did

but i don't know how to set a working progress for copying task on a button :D

Share this post


Link to post
Share on other sites

http://www.autoitscript.com/wiki/FAQ#How_can_I_display_a_progress_bar_while_copying_files_or_directories.3F

This should do.. I think..

Share this post


Link to post
Share on other sites

ok i will check it

i will back in few min

Share this post


Link to post
Share on other sites

no one done it as a want :D

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

appears to be what you want. Are you sure you are copying a file that takes long enough to show a progress bar? Try a 100+MB file.

edit: better make that 300+MB

Edited by spudw2k

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  
Followers 0

  • Similar Content

    • RyukShini
      Progress bar to show how long you are in a txt file
      By RyukShini
      #include <ColorConstants.au3>; Including required files #include <GUIConstantsEx.au3> #include <file.au3> #include <Array.au3> #include <string.au3> Example() Func Example() Local $hash Local $hashes = "hash.txt" _FileReadToArray($hashes, $hash) For $i = 1 To UBound($hash) - 500 $hashcheck = $hash[$i] $PDenc = "hash=" & $hashcheck & "&decrypt=Decrypt" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://myurl/", False) ; Post url $oHTTP.SetRequestHeader("Host", "myurl") $oHTTP.SetRequestHeader("Connection", "keep-aliveContent-Length: 29") $oHTTP.SetRequestHeader("Cache-Control", "max-age=0") $oHTTP.SetRequestHeader("Origin", "http://myurl") $oHTTP.SetRequestHeader("Upgrade-Insecure-Requests", "1") $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") $oHTTP.SetRequestHeader("Referer", "http://myurl") $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.8") $oHTTP.Send($PDenc) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status sleep(2000) If $oStatusCode = 503 then MsgBox(4096, "Response code", $oStatusCode) ExitLoop EndIf ; Saves the body response regardless of the Response code $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists FileWrite($file, $oReceived) $read = FileRead("Received.html") ;read file if StringInStr($read, "not found") Then ContinueLoop Else ContinueLoop $Datastring = ('</script></div><br/>') $newreadamount = _StringBetween($read, $Datastring, "</b><br/><br/>") ;read title from file $newreadamount[0] = StringReplace($newreadamount[0], '<b>', "") ; taking out the X makes it easier to compare value If @error Then ContinueLoop EndIf $file = FileOpen("decrypted.txt", 1) FileWrite($file, $newreadamount[0] & @CRLF) EndIf Next sleep(2000) EndFunc ;==>Example As you can read my script loads 500 lines of text, lets say I have a list with 10.000 lines
      Is there a way to show a progressbar GUI to show how long in a text file I am?
      I may not know how long a particular .txt file is always so I am thinking I need some sort of algorythm?
      Thanks in advance.
      ( I just got unclear if I actually read 500 lines each attempt or if I start with 500 and add 1 to it each time? )
       
      For $i = 1 To UBound($hash) - 500 ; LIke that ^ For $i = 500 To UBound($hash) - 500 ; or like this^ Thanks a lot.
    • ling3882688
      How to get this 7-Zip progress?
      By ling3882688
      There is an Example called _7ZIPExtractEx_Example_using_Callback.AU3 in the 7-Zip UDF.
      I found a problem. If one file in the 7z archive is too big,the progress  bar will stop for a long time.
      How can I get the exact progress even though there are big files in the archive?
      In other words,how to get the exact extracted file size without delay  ?
      7Zip_UDF.zip
    • 31290
      Strange progress behavior
      By 31290
      Hi everyone
      Hope you're doing great.
      Well, I'm writing a script that allows our Service Desk to clean several temp folder as a first diagnostic. 
      Indeed, the agent in charge of the issue will have to choose what to clean (web browsers temp folders, some windows one etc...)
      I added a progress bar to see the current state of the script but if I select more than one checkbox, it seems that the counting is not done properly and is directly filled at 100% (when at leat 2 boxes are checked) and I don"t get the final message saying that all is done, especially for if the last box is checked.
      But if I launch the process with only one checkbox checked,it's working...
      I've enclosed the au3 files for you because posting them in this post would be... unreadable lol. So you can maybe do some tests as well.
      I'm pretty sure the code can be optimized (a lot  ) and that there is a much better way to achieve what I want the script to be.
      Maybe can someone can give me a hand over here.
      Thanks in advance.
      31290
      SEE_Delete_Temp.au3
      SEE_Delete_Temp_Functions.au3
    • ur
      To delete folders and files with progress bar
      By ur
      The below script is used by me before for copying files/folders with progress bar(windows default progress bar).
      I found similar option for moving by using same object.
      But not able to find for delete.
       dml.vbs  (This is a vbscript one and I am posting in this forum because autoit is made on top of vbscript and it might have similar functions.)
      So, I checked in AutoIT forums and found below script files and which I have been modified for my requirement.
      In those below I found delete2.au3 is working fine but hanging during deletion of huge memory files/folders.
      Delete1_au3 
      Delete2_au3 
      Delete3_au3
      Please try to provide a solution.
       
       
    • RaiNote
      Question IE and Progress
      By RaiNote
      Hello everyone,
      Question 1: How to attach an IE Download to a Progressbar?
      Question 2: How to make an IE Download like a streaming Download(download can be paused and continued every time)?
      Question 3: How to do it with my UDF like Code :o?
      Question 4: How to do add a Label which shows the released time?
      Question 5: How to show how long it takes also the Connection Speed?
      Question 6: How to get the Connection Speed to a Server?
      #include-once #include <MsgBoxConstants.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Patch ; Description ...: Easy Patch System(unzipping currently not included) ; I could need a bit help for this code ^-^. ; Syntax ........: _Patch($DownloadURL, $DownloadPath) ; Parameters ....: $DownloadURL - URL for the Download. ; $DownloadPath - Where the download file will be installed. ; $Title - Project Name Will be displayed in the MsgBox. ; Return values .: None ; Author ........: RaiNote ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; ===============================================================================================================================Func _Patch($DownloadURL,$DownloadPath) Func _Patch($DownloadURL,$DownloadPath,$Title = "Title") $Byte = InetGetSize($DownloadURL,0);Download Size If $Byte > 1024 Then $Kilobyte = $Byte / 1024;Converting Byte to Kilobytes If $Kilobyte > 1024 Then $Megabyte = $Kilobyte / 1024;Converting Kilobyte to Megabyte If $Megabyte > 1024 Then $Gigabyte = $Megabyte / 1024;Converting Megabyte to Gigabyte If $Gigabyte > 1024 Then $Terabyte = $Gigabyte / 1024;Converting Gigabyte to Terabyte If $Terabyte > 1024 Then $Petabyte = $Terabyte / 1024;Converting Terabyte to Petabyte If $Petabyte > 1024 Then $Exabyte = $Petabyte / 1024;Converting Petabyte to Exabyte $_PATCH_SIZE1 = Round($Exabyte,2) & " EB" ElseIf $Petabyte < 1024 Then $Petabyte = $Terabyte / 1024 $_PATCH_SIZE1 = Round($Petabyte,2) & " PB" EndIf ElseIf $Terabyte < 1024 Then $Terabyte = $Gigabyte / 1024 $_PATCH_SIZE1 = Round($Terabyte,2) & " TB" EndIf ElseIf $Gigabyte < 1024 Then $Gigabyte = $Megabyte / 1024 $_PATCH_SIZE1 = Round($Gigabyte,2) & " GB" EndIf ElseIf $Megabyte < 1024 Then $Megabyte = $Kilobyte / 1024 $_PATCH_SIZE1 = Round($Megabyte,2) & " MB" EndIf ElseIf $Kilobyte < 1024 Then $Kilobyte = $Byte / 1024 $_PATCH_SIZE1 = Round($Kilobyte,2) & " KB" EndIf ElseIf $Byte < 1024 Then $_PATCH_SIZE1 = $Byte & " Bytes" EndIf $_PATCH_INFO = MsgBox(52,$Title,$Title & "needs to be patched. If u want to patch continue" & @CRLF & " if not it will close automaticly.(Size :" & " " & $_PATCH_SIZE1 & ")",0) switch $_PATCH_INFO case 6 ;YES $_Patch_Download = InetGet($DownloadURL,$DownloadPath,0,0) case 7 ;NO Exit endswitch EndFunc ​Thx for this
      I hope someone could help me :3 also how is this UDF with the FileSizeSystem
      P.S.: Also a cat can get shy.