Hi !
Is it possibly to close any Cinema4D window like the ones below by using python ?
I've tried acessing this command, but I had no success, because I didn't find anything on the python API to get C4D windows...
Thanks!
Hi !
Is it possibly to close any Cinema4D window like the ones below by using python ?
I've tried acessing this command, but I had no success, because I didn't find anything on the python API to get C4D windows...
Thanks!
That's because there is none. The Windows functionality in the API is very limited. You can open some through CallCommand but identification and handling of specific windows is not supported.
Only thing you could do is loading a new layout.
@Cairyn said in Close any C4D Window:
That's because there is none. The Windows functionality in the API is very limited. You can open some through CallCommand but identification and handling of specific windows is not supported.
Only thing you could do is loading a new layout.
I was afraid of that answer 😥
But thank you anyway :-)
hello,
@Cairyn thanks for the answer
the subject seems to be popular those days :)
As in this thread , we can confimr it's not possible.
Cheers
Manuel
MAXON SDK Specialist
hello,
this thread will be considered solved and will be closed tomorrow if you have nothing to add.
Cheers
Manuel
MAXON SDK Specialist
can't test it right now, but this should do the trick.
you'll need to install these packages to your c4d installation to make it work
import win32gui
import win32ui
import win32co
from pynput.keyboard import Key, Controller
handle = win32gui.FindWindow(0, "Texture Manager")
try:
if handle:
keyboard = Controller()
win32gui.SetForegroundWindow(handle)
keyboard.press(Key.ctrl)
keyboard.press(w)
keyboard.release(Key.ctrl)
keyboard.press(w)
except:
pass