Running scripts on startup



  • 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





  • 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

    -ScottA



  • 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?



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

    Startup-code or module imports?



  • 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.



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

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



  • 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?



  • 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://plugincafe.maxon.net/topic/6869/7689_layout-switch

    Best, 
    -Niklas



  • 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.



  • 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 http://www.maxonexchange.de/sdk/CINEMA4DPYTHONSDK/help/misc/faq.html?highlight=python_init

    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


Log in to reply