Test for open 'Console'

Is there some way to test if the user has the ‘Console’ open or closed?


I also like to know. for now afaik there’s a toggle operator


I didn’t find a tag in bpy.context

in the source you can have more control than toggle :

 * Toggles console
 * @action	0 - Hides
 *			1 - Shows
 *			2 - Toggles
 *			3 - Hides if it runs not from  command line
 *			* - Does nothing
 * @return current status (1 -visible, 0 - hidden)

(windows os only)
it looks like (Im not familiar with C) the code itself does not know the status and pass a request to the os which does not return a status to blender.

the feature is here but there’s no arguments available for the ops in 2.59 so far.
only a call to GHOST_toggleConsole(2) in wm_operators.c
It’s almost sure there will be a bpy.ops.wm.console_show _hide or a bpy.ops.wm.console(status=‘HIDDEN’) or something but for now it seems you have to go your way using the process module
in fact the console is not listed as a process apart :confused:

here’s the code to retrieve processes from python at least :
(on XP pro tasklist command. it seems it does not exist on XP home I don’t know for seven)

import subprocess
process = subprocess.Popen(['tasklist','/FO','CSV','/NH'], shell=True, stdout=subprocess.PIPE)
#tasklist /FI "IMAGENAME eq cmd.exe" /FO CSV /V /NH #see tasklist /? for filters
ps = process.communicate()[0]
ps = ps.decode(errors='replace').replace('
ps = [ps[i] for i in range(1,len(ps)-1,5)]
for p in ps : print(p)

but you could sent a request for this features
it might be added as new API command for all OS!