Multi-Buttons with Python



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/06/2011 at 17:26, xxxxxxxx wrote:

    It's too bad that there's no way to run scripts automatically when C4D launches and/or closes (or is there?).

    I've got a book on Windows OS programming that I keep meaning to read. But haven't had the time.
    Maybe I can write my own launcher program that kills that file first..Then opens the c4d .exe file.
    It seems like something that shouldn't be that hard to do.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/06/2011 at 20:04, xxxxxxxx wrote:

    I figured out how to create a .bat file that will do two things

    1- Delete the coffeesysmbolschache file
    2- Launch Cinema4D

    This batch file can be used to launch C4D without worrying about that pesky cache file.
    No more cache file headaches. 👏

    I'm willing to share how to do this. But this is potentially DANGEROUS!!!!
    Deleted files with a .bat file DO NOT COME BACK!!! So be VERY careful with this!!!

    Create this code in a plain text file with no formatting:

    @echo off  
      
    del "The path to your coffeesymbolscache file goes here" /Q/S >nul  
      
    start "\" "The path to your cinema 4d.exe file goes here" "\"
    

    When you're done setting your paths. Save the file as "whatever name you like.bat"
    When you double click on it. It will delete the cache file and launch Cinema 4D.

    Please be careful with this one.
    Make sure your paths are right when using the del option.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/06/2011 at 23:36, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    It's too bad that there's no way to run scripts automatically when C4D launches and/or closes (or is there?).

    Didn't you recognize my previous post ? 😂

    Originally posted by xxxxxxxx

    My favorite .pyp

    from    os  import remove  
     
    path    = r"C:\Users\niklas\AppData\Roaming\MAXON\Cinema 4D R 12 Studio_6463D359\prefs\coffeesymbolcache"  
     
    remove(path)
    

    ;-)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 07:17, xxxxxxxx wrote:

    You never said that it runs automatically at start up.
    That's good to know.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 07:19, xxxxxxxx wrote:

    I thought you will recognize it. ^^
    If you think a bit about it, you will notice that a .pyp file *must* be executed at startup. Or when do you want your plugin to be registered if not at startup ? :)

    Cheers



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 07:59, xxxxxxxx wrote:

    I was hoping that this might possibly be a way to change some of the C4D interface options when C4D starts up.

    I just started looking into this:

    from  os  import remove  
    import os  
    import time  
    import c4d  
    from c4d import gui, utils  
      
    start = time.time()  
    if start > 1300000000:  
     gui.MessageDialog("Welcome")  
       
    path = r"C:\Users\user\AppData\Roaming\MAXON\CINEMA 4D R12 Demo_0E6F67AE\prefs\coffeesymbolcache"  
      
    remove(path)
    

    The timer function isn't working properly in this example.
    But hopefully you should get the idea what I'm trying to do with it.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 08:35, xxxxxxxx wrote:

    From the docs:

    Can I execute code on startup of CINEMA 4D?
    In some cases it might be necessary that you need to execute Python code on startup of CINEMA 4D before any other Python stuff is loaded. In this case, go to the user folder of CINEMA 4D and create a file in the python prefs   {USER_FOLDER}/prefs/python/.
    _
    _
    > > python_init.py Autostart Python Code.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 08:59, xxxxxxxx wrote:

    Thanks for the heads up.
    I'll give it a try.

    -ScottA

    Edit:
    The problem I'm running into is that this python file runs before C4D has finished loading. So it doesn't accept the code in it.

    For example:
    If I wanted the UI to load with the scale tool active. And I put c4d.CallCommand(200000089) in the file. It doesn't work because the python file is trying to execute that command before C4D has finished loading.

    I was wondering if this kind of thing was possible to do?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 09:39, xxxxxxxx wrote:

    No, this is not possible. Btw, opening GUI is blocked on startup.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 09:49, xxxxxxxx wrote:

    Sorry to hear that.
    But thanks for the help.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 10:27, xxxxxxxx wrote:

    Haha, I already found a workaround some time ago.
    I wanted to insert an object into the document on c4d start up. But it didn't work. I found out that the active document on startup isnt the same as when c4d has finished loading.

    So what to do ? Start a Thread on C4D startup that compares the current document with the document you got when the thread actually started within a while-loop.

    If the document is not the same, C4D did finish loading.

    Cheers,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 10:37, xxxxxxxx wrote:

    Do you have an example of this?

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 10:50, xxxxxxxx wrote:

    Of course, you should now me now ;-D

    Example Code

    Cheers,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 10:52, xxxxxxxx wrote:

    Why don't you use the template.c4d? This file is loaded on startup



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2011 at 11:14, xxxxxxxx wrote:

    That's pretty cool niklas. 👍

    -ScottA


Log in to reply