Clearing the Post Window from a Gui: A Functioning Solution

I have long wanted to be able to clear the post window in SCIde from the lang, but this has never been possible. I now have this working with osascript:

var clearPost = ("osascript -e 'tell application \"System Events\" to tell process \"SuperCollider\" to set frontmost to true' && osascript -e 'tell application \"System Events\" to tell process \"SuperCollider\" to keystroke \"p\" using {command down, shift down}' && osascript -e 'tell application \"SuperCollider\" to activate'");

clearPost.unixCmd;

This will return you to your gui window afterwards.

To stay in the ide:

var clearPost = ("osascript -e 'tell application \"System Events\" to tell process \"SuperCollider\" to set frontmost to true' && osascript -e 'tell application \"System Events\" to tell process \"SuperCollider\" to keystroke \"p\" using {command down, shift down}'  ");

clearPost.unixCmd;

You need to add SuperCollider to macOs
Settings->Privacy and Security → Accessibility, or it won’t work.

You could make a PR adding this functionality to ScIDE through a primitive.

1 Like

I already looked at ScIDE, and yes, there would need to be an extra primitive. This is a working solution in the mean time.

Ok, I created a pull request for ScIDE.clearPostWindow. Someone will have to review it. works nicely on my local build.

For those of you using the apple script version, you need to add SuperCollider to macOs
Settings->Privacy and Security → Accessibility, or it won’t work.

1 Like

The new ScIDE.clearPostWindow now been merged into dev.

Of course this will only work on Mac OS

The ScIDE.clearPostWindow works on any platform that supports Qt. The applescript version is just a temporary workaround. If you build the dev version of SC, then you can have ScIDE.clearPostWindow now.

Just a word of warning…

The dev version should always be considered unstable, until the release we might remove functionality or the build itself might not even work.

That being said, being a guinea pig and filing bugs reports on GitHub is a really useful way to contribute to the project!

1 Like