Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Close any C4D Window

    Cinema 4D SDK
    python r20
    4
    7
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • FlavioDinizF
      FlavioDiniz
      last edited by

      Hi !
      Is it possibly to close any Cinema4D window like the ones below by using python ?

      alt text

      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...
      alt text

      Thanks!

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        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.

        1 Reply Last reply Reply Quote 3
        • FlavioDinizF
          FlavioDiniz
          last edited by

          @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 🙂

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by

            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

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • ManuelM
              Manuel
              last edited by

              hello,

              this thread will be considered solved and will be closed tomorrow if you have nothing to add.

              Cheers
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

              1 Reply Last reply Reply Quote 0
              • P
                pyr
                last edited by

                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
                
                
                1 Reply Last reply Reply Quote 1
                • ManuelM
                  Manuel
                  last edited by

                  hello,

                  thanks a lot for posting your solution here.

                  Cheers
                  Manuel.

                  MAXON SDK Specialist

                  MAXON Registered Developer

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post