micechal Posted January 31, 2015 Posted January 31, 2015 Hi. Quick question: How can I avoid such thing: Processing 1 of 10 (10%)... Processing 2 of 10 (20%)... Processing 3 of 10 (30%)... Processing 4 of 10 (40%)... when using ConsoleWrite, in favor of only one line being rewritten/erased multiple times?
Solution UEZ Posted January 31, 2015 Solution Posted January 31, 2015 Use @CR only. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
micechal Posted January 31, 2015 Author Posted January 31, 2015 Thank you, that works great when run from cmd.exe. But do you know if it's also possible to achieve this in Scite? Or maybe it was designed like so on purpose?
Malkey Posted February 1, 2015 Posted February 1, 2015 (edited) This example works with SciTE's output pane.. For $i = 1 To 5 _ConsoleWriteSameLine("Line #" & $i) Sleep(1000) Next ConsoleWrite("The End" & @LF) Func _ConsoleWriteSameLine($sMessage) ControlSend("[Class:SciTEWindow]", "", "Scintilla2","+{HOME}{DEL}{BS}+{HOME}{DEL}") ConsoleWrite($sMessage & @LF) EndFunc ;==>ConsoleWriteSameLineEdit: Replaced Chr(8) & "+{HOME}{DEL}") ; Chr(8) = backspace character, in the case where characters already exist on the line being written to. The first "+{HOME}{DEL}" deletes that line, if it exists. Then, the "{BS}" makes the cursor jump to the line above where the second "+{HOME}{DEL}" deletes that line also. Edited February 1, 2015 by Malkey
Moderators SmOke_N Posted February 1, 2015 Moderators Posted February 1, 2015 (edited) That just looks like a horrible idea... but interesting to see how it turns out. Edit: I happened to pause the script at an opportune time: For $i = 1 To 500 _ConsoleWriteSameLine("Line #" & $i) Sleep(100) Next ConsoleWrite("The End" & @LF) Func _ConsoleWriteSameLine($sMessage) ControlSend("[Class:SciTEWindow]", "", "Scintilla2","+{HOME}{DEL}{BS}+{HOME}{DEL}") ConsoleWrite($sMessage & @LF) EndFunc ;==>ConsoleWriteSameLine Scite->Output: ine #139Line #140 Other times I saw the BS char. Edited February 1, 2015 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now