Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Login

    Running scripts on startup

    Scheduled Pinned Locked Moved PYTHON Development
    11 Posts 0 Posters 985 Views
    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.
    • H Offline
      Helper
      last edited by

      On 01/06/2013 at 18:57, xxxxxxxx wrote:

      Can someone please remind me where we put our .py files so that is executes them when C4D starts up?

      I have a script I made a long time ago when I was using with R12 that changes the camera to parallel when c4d starts.
      But now I can't make it work in R13. And I forgot what folder we're supposed to put these in.

      I've tried putting it in almost every folder in my AppData/Roaming/Maxon/  folder structure...But I'm getting no results.

      -ScottA

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 02/06/2013 at 10:27, xxxxxxxx wrote:

        https://developers.maxon.net/forum/topic/6869/7689_layout-switch&KW=startup%2Epy&PID=31801#31801

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 02/06/2013 at 10:56, xxxxxxxx wrote:

          Thanks Nik,

          I tried that folder too. But it didn't work.
          Then I tried changing the name of my file to "python_init" and it worked!
          I don't remember having to use that special file name in R12. I had my working R12 file saved with a different name and it seemed to work just fine for me back then.

          Things like this drive me crazy. !Confused[URL-REMOVED]

          -ScottA


          [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 28/05/2014 at 10:14, xxxxxxxx wrote:

            Is there a way to source Python code from a common facility directory on the server, instead of the user's local directory?

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 08/07/2014 at 11:40, xxxxxxxx wrote:

              Startup-code or module imports?

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 08/07/2014 at 13:06, xxxxxxxx wrote:

                Start up.  I've since just added code to a plugin that I wrote to source it, but I was wondering if there was any user startup files or directories that get sourced that we could use to do this, without having to write a plugin.

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 09/07/2014 at 05:43, xxxxxxxx wrote:

                  Put code in the startup file that loads code from another location and executes it.

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    On 09/07/2014 at 10:40, xxxxxxxx wrote:

                    Sorry, you mean the new.c4d file, or is there an actual text file that gets sourced?

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      On 09/07/2014 at 11:12, xxxxxxxx wrote:

                      I thought you might remember this thread that you have read and replied to before 😉

                      https://developers.maxon.net/forum/topic/6869/7689_layout-switch

                      Best, 
                      -Niklas

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        On 09/07/2014 at 18:38, xxxxxxxx wrote:

                        I think I had missed the comment above mine on that thread, but I tried it just now, and couldn't get it to work?  I put a file in C:\Users<user>\prefs\python\python_init.py, and just put a print statement inside of it just now, and it doesn't seem to print anything to the Script Console when I open C4D.

                        One other question...  What's up with all of the ID numbers?  Is it a legacy leftover, or something to do with re-implementing the C++ code in python?  It seems like variables should be able to be used to store pointers to things, without using ID numbers, and I've had ID numbers overlap and cause errors recently, and I was just curious about the logic for implementing ID numbers for everything.

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Helper
                          last edited by

                          On 10/07/2014 at 01:26, xxxxxxxx wrote:

                          Originally posted by xxxxxxxx

                          I think I had missed the comment above mine on that thread, but I tried it just now, and couldn't get it to work?  I put a file in C:\Users<user>\prefs\python\python_init.py, and just put a print statement inside of it just now, and it doesn't seem to print anything to the Script Console when I open C4D.

                          The {USER_FOLDER} is not your home directory. It is your Cinema 4D preferences folder. On
                          Windows, it is located at {HOME}\AppData\Roaming\Maxon\Cinema4D_RXX_YYYYYYYY\

                          See [URL-REMOVED]

                          Originally posted by xxxxxxxx

                          One other question...  What's up with all of the ID numbers?  Is it a legacy leftover, or something to do with re-implementing the C++ code in python?  It seems like variables should be able to be used to store pointers to things, without using ID numbers, and I've had ID numbers overlap and cause errors recently, and I was just curious about the logic for implementing ID numbers for everything.

                          Can you please give more information on the context? What ID numbers do you refer to?
                          What IDs have overlapped and what errors did you get?

                          -Niklas


                          [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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