Jump to content

How can I clean the console after something was written ?


Recommended Posts

For $x = 1 to 100
ConsoleWrite($x & @CRLF)
Next
ConsoleWrite("clear output in 1 sec" & @CRLF)
Sleep(1000)
SendSciTE_Command("menucommand:420") ; Clear Output pane "IDM_CLEAROUTPUT"
ConsoleWrite("cleared" & @CRLF)
;~ For $x = 1 to 100
;~ ConsoleWrite($x & @CRLF)
;~ Next
Exit
;
; Send command to SciTE
Func SendSciTE_Command($sCmd)
Local $Scite_hwnd = WinGetHandle("DirectorExtension")
Local $WM_COPYDATA = 74
Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
DllStructSetData($CmdStruct, 1, $sCmd)
Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
DllStructSetData($COPYDATA, 1, 1)
DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _
'Int', $WM_COPYDATA, 'HWnd', 0, _
'Ptr', DllStructGetPtr($COPYDATA))
EndFunc ;==>SendSciTE_Command

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to post
Share on other sites

Usually you don't use the Output pane of SciTE in production. Either use MsgBox or the Debug UDF to write data to a Console - or use your own GUI.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2021-07-20 - Version 1.0.0.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Link to post
Share on other sites

Usually you don't use the Output pane of SciTE in production. Either use MsgBox or the Debug UDF to write data to a Console - or use your own GUI.

Yes but is not more work to do to output a msgbox and then it pauses my script. Also I didnt know about the Debug UDF, but the output scite pane is just "closer to my hand"

Link to post
Share on other sites
  • Developers

Try:

ConsoleWrite("Line 1" & @crlf)
ConsoleWrite("Line 2" & @crlf)
ConsoleWrite("Line 3" & @crlf)
Sleep(2000)
ControlSend("[CLASS:SciTEWindow]", "", "Scintilla2", "+{F5}")

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
  • 5 years later...

Sorry for a little necrophilia, but since it is on subject and updates the info from previous posts: the method above will not work if there is a key binding for 'Test Run' in SciTE. The binding used is SHIFT+F5, same as the one used for Clear Output and I think it is a default one, since I haven't touched my SciTe install and it's there.

I managed to get it to work by commenting out whole Test Run section in .../SciTe/Properties/au3.properties file but it's not the best solution. There is better solution (found on this forum): 

ControlSetText('', '', 'Scintilla2', '')

 

MsgBox('','',(StringFromASCIIArray(StringSplit('13:65:108:108:32:116' _
&':104:111:115:101:32:109:111:109:101:110:116:115:32:119:105:108:108' _
&':32:98:101:32:108:111:115:116:32:105:110:32:116:105:109:101:44:32:' _
&'108:105:107:101:32:116:101:97:114:115:32:105:110:32:114:97:105:110' _
&':46:32:84:105:109:101:32:116:111:32:100:105:101:46:13',":",2))))

Link to post
Share on other sites
  • Developers

Yea, I have indeed reused the Shift+F5 for testRun so that means that the shortcut doesn't work anymore but that is easily solved  by changing the example to:

ConsoleWrite("Line 1" & @crlf)
ConsoleWrite("Line 2" & @crlf)
ConsoleWrite("Line 3" & @crlf)
Sleep(2000)
ControlSetText("[CLASS:SciTEWindow]", "", "Scintilla2", "")

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...