Jump to content

Create Progress bar in CUI


Go to solution Solved by Zedna,

Recommended Posts

Hi, I want to know its possible to create a progressbar for a for loop inside of CUI without using anything like ProgressOn and etc?
I mean I want it to be completely in CUI interface and not use any GUI element in it

thanks

Edited by Invicore
Link to comment
Share on other sites

Just now, VIP said:
;...................
ConsoleWrite("1%"&@CRLF)
;...................
ConsoleWrite("2%"&@CRLF)
;...................

 

its not a good way to do it, because its only print text in new line I want a way to create a progress bar and change it in one line

for example in c++ I can print a line, and after that go few character back with \r and rewrite it

Edited by Invicore
Link to comment
Share on other sites

  • Solution
#AutoIt3Wrapper_Change2CUI=y

#include <string.au3>

For $i = 1 to 79
    $part1 = _StringRepeat(Chr(219), $i)
    $part2 = _StringRepeat(Chr(177), 79 - $i)
    ConsoleWrite(@CR & $part1 & $part2)
    Sleep(50)
Next

; uncomment this if you want to preserve finished progressbar
;~ ConsoleWrite(@CRLF & "DONE!")

; comment this if you want to preserve finished progressbar
ConsoleWrite(@CR & _StringRepeat(' ', 79))
ConsoleWrite(@CR & "DONE!")

 

Link to comment
Share on other sites

Just now, Zedna said:
#AutoIt3Wrapper_Change2CUI=y

#include <string.au3>

For $i = 1 to 79
    $part1 = _StringRepeat(Chr(219), $i)
    $part2 = _StringRepeat(Chr(177), 79 - $i)
    ConsoleWrite(@CR & $part1 & $part2)
    Sleep(50)
Next

; uncomment this if you want to preserve finished progressbar
;~ ConsoleWrite(@CRLF & "DONE!")

; comment this if you want to preserve finished progressbar
ConsoleWrite(@CR & _StringRepeat(' ', 79))
ConsoleWrite(@CR & "DONE!")

 

thank you looks like this is exact thing I was looking to

Link to comment
Share on other sites

ConsoleWrite("started: " & @CRLF)
$locxal = 150
For $i = 0 to $locxal
    Progress($i, $locxal)
    Sleep(50)
Next

Func Progress($now, $all)
    Local $Progress = Int($now / ($all / 50))
    $part1 = _StringRepeat(Chr(219), $Progress)
    $part2 = _StringRepeat(Chr(177), 50 - $Progress)
    ConsoleWrite(@CR & "processing files: " & $part1 & $part2 & " " & (($Progress <> 50) ? $Progress*2 & "%" : "DONE!"))
EndFunc

this is what I ended up with, thanks to @Zedna

im not sure make it a function is good or not (i need it many times so I think this way its better)

Edited by Invicore
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...