mond1106

Progress bar user input

4 posts in this topic

Hi,

 

Im new to autoit im exploring some function and I am interested with the progress bar.

 

Is it possible to have a end user input in how much the bar will progress?

 

I saw this code in the examples.

Example()

Func Example()
    ; Display a progress bar window.
    ProgressOn("Progress Meter", "Increments every second", "0%")

    ; Update the progress value of the progress bar window every second.
    For $i = 10 To 100 Step 10
      
        Sleep(1000)
        ProgressSet($i, $i & "%")
    Next

    ; Set the "subtext" and "maintext" of the progress bar window.
    ProgressSet(100, "Done", "Complete")
    Sleep(5000)

    ; Close the progress window.
    ProgressOff()
 EndFunc   ;==>Example
 

Thank you.

Share this post


Link to post
Share on other sites



Sure. Something like this?

Example()

Func Example()
    ; Display a progress bar window.
    $sInput = InputBox("Progress", "Set the Step width the progressbar should increment (default is 10%)", 10)
    $iInput = Number($sInput)
    If $iInput = 0 Or $iInput < 1 Or $iInput > 100 Then $iInput = 10
    ProgressOn("Progress Meter", "Increments every second. Step: " & $iInput, "0%")
    ; Update the progress value of the progress bar window every second.
    For $i = 0 To 100 Step $iInput
        Sleep(1000)
        ProgressSet($i, $i & "%")
    Next
    ; Set the "subtext" and "maintext" of the progress bar window.
    ProgressSet(100, "Done", "Complete")
    Sleep(5000)
    ; Close the progress window.
    ProgressOff()
 EndFunc   ;==>Example

 


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

BTW: When posting code could you please use code tags as described here?

 


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
25 minutes ago, water said:

Sure. Something like this?

Example()

Func Example()
    ; Display a progress bar window.
    $sInput = InputBox("Progress", "Set the Step width the progressbar should increment (default is 10%)", 10)
    $iInput = Number($sInput)
    If $iInput = 0 Or $iInput < 1 Or $iInput > 100 Then $iInput = 10
    ProgressOn("Progress Meter", "Increments every second. Step: " & $iInput, "0%")
    ; Update the progress value of the progress bar window every second.
    For $i = 0 To 100 Step $iInput
        Sleep(1000)
        ProgressSet($i, $i & "%")
    Next
    ; Set the "subtext" and "maintext" of the progress bar window.
    ProgressSet(100, "Done", "Complete")
    Sleep(5000)
    ; Close the progress window.
    ProgressOff()
 EndFunc   ;==>Example

 

 

 

Thank you I will start working on this.

 

22 minutes ago, water said:

BTW: When posting code could you please use code tags as described here?

 

 

Will do thanks again.

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

  • Similar Content

    • 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.
       
       
    • JotaPx
      Stoping a Timed Progress bar script
      By JotaPx
      Hi,
      i've been scripting around a bit with autoit but i always had this problem that i find a bit stupid on my part:
      ~Can't stop a script execution during a rotine...   "duh!" you may say   else take a look at this sample script:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $main = GUICreate("5.5 seconds!",1100,25,125,0,-1,$WS_EX_TOPMOST) $prog = GUICtrlCreateProgress(0,0,1000,25) $OK = GUICtrlCreateButton("GO!",1000,0,25,25) $Stop = GUICtrlCreateButton("Stop",1025,0,50,25) $label = GUICtrlCreateLabel("-",1075,0,25) GUICtrlSetState($Stop,$GUI_DISABLE) GUICtrlSetState($main,$GUI_ONTOP) GUISetState() $go = 1 while 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit case $msg = $OK GUICtrlSetState($OK,$GUI_DISABLE) GUICtrlSetState($Stop,$GUI_ENABLE) Do $msg = GUIGetMsg() GUICtrlSetData($prog,0) sleep(1000) GUICtrlSetData($prog,20) sleep(1000) GUICtrlSetData($prog,40) sleep(1000) GUICtrlSetData($prog,60) sleep(1000) GUICtrlSetData($prog,80) sleep(1000) GUICtrlSetData($prog,100) sleep(250) MouseClick("left") until $msg = $GUI_EVENT_CLOSE EndSelect WEnd How can i use the Stop button to Stop the rotine? Any toughts on that?
      best regards
    • sundar
      Progress Bar for file/folder delete.
      By sundar
      I have an application which delete folder and files specified by the user. Everthing workes fine but problem comes when the file/folder size is bigger(morethan 1GB). The GUI hangs when deleting large file/folder size. The idea is to have a progress bar with looping statement when deletion is in progress. So that looping stops the hanging of GUI and progress bar shows users to know about the process/progress. However i am unable to figureout how to detect deleting process.

      Thank you in advance.
    • johnmcloud
      [SOLVED] Question about Progress Bar
      By johnmcloud
      Hi guys, i have two question about Progress bar,
      I'm testing this code:


      ProgressOn("Progress Bar", "Sample progress bar", "Working...") For $i = 0 To 100 ProgressSet($i) Sleep(5) Next MyFunc() ProgressSet(100, "Done!") Sleep(750) ProgressOff()
      1) Thi function does not work as expected, seem working with time, sometime finish first, sometime finish later. The func is a runwait(@comspec) can process file from 1MB to many GB, so i don't know how to set it

      2) There is a version can integrate with GUI?

      Thanks for support
    • sundar
      7Zip (command line) extract with progress bar
      By sundar
      I have been trying to do this for last 3 days but nothing seems to be working (correctly). What i am trying to do is extracting an iso image to my pendrive during which progress bar should show the process. The actual size of the archive size is not known but no significant difference is there after extraction. Here is my code and where am i making mistke?

      #include <GUIConstants.au3> #include <GUIConstantsEx.au3> _PROGRESS () Func _PROGRESS () $Progress = GUICtrlCreateProgress(8, 56, 417, 25) $Form = GUICreate("Copy File", 369, 128, 193, 126) GUISetState(@SW_SHOW) $Progress1 = GUICtrlCreateProgress(8, 56, 353, 17) $close = GUICtrlCreateButton("Close", 200, 88, 75, 25, 0) $start = GUICtrlCreateButton("Start", 80, 88, 75, 25, 0) $Source = "E:\archive.iso" $Dest = "K:\TEST\" Const $INITIAL_SIZE = DriveSpaceFree( "K:" ) Const $FILE_SIZE = FileGetSize ( $Source ) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $close ExitLoop Case $msg = $start $Extract = Run(@ScriptDir & '\7z.exe' & ' x "' & $Source & '" ' & "-y -o" & '"' & $Dest & '"', "", @SW_HIDE) Sleep (100) While ProcessExists($Extract) > 0 $SPACE_FREE = DriveSpaceFree( "K:" ) $percentage = Round((( DriveSpaceFree( "K:" ) - $INITIAL_SIZE ) * 100 / $FILE_SIZE), 0) If $percentage > 0 And $percentage < 101 Then GUICtrlSetData($Progress1,$percentage) EndIf WEnd EndSelect WEnd EndFunc
      Any help is appriciated.