Asked — Edited

Clear Debug - Programmatically

Does anyone know a way to programmatically clear the debug window of a script or script manager console? I can manually clear the debug window by clicking on the button in the control, but I'd like to do it via scripted controls.

Thank you!


ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

#1  

I thought there was a script command for clearing the debug. On a different device so I can't check.

#2  

One way to do it is to put in a print statement in with a boat load of spaces in it. How many will depend on the size of your debug window. You could put the print statement in a separate script and call it via a CC, but that will leave the "done" line showing at the end of the running of the script. Of course that won't get rid of lines in it before the print statement was executed but it will clear the debug window area itself.

EDIT Another similar way would be to create a variable with all those spaces and then print the variable. Much more compact in the code, just one line. And only have to put in those spaces once when defining the variable.

EDIT AGAINI thought I'd mention that you don't have to put the spaces in the variable manually. You can do it in a loop and control exactly how many go into the variable. Like This:


#Just do this once somewhere in some script.
#1000 is just an arbitrary number I chose at random
$ClearDebugWin =" "
$StrLen =1
repeatuntil ($StrLen >=1000)
  $ClearDebugWin =$ClearDebugWin+" "
  $StrLen++
endrepeatuntil

#Then use the print statement wherever clearing
#the screen is desired, as in:
Print($ClearDebugWin)

You can go through the loop faster if you put in, say, 10 spaces in each iteration and added 10 to $StrLen each time. Heck, you could go geometrically fast if you added $ClearDebugWin to itself on each loop but you could overshoot the mark by double! :D

#3  

Thank you @WBS00001, that's a good idea as a workaround.