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

    new GeExecuteProgramWithArgs() needed

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 535 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

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

      On 27/01/2009 at 10:39, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R10+ 
      Platform:   Windows  ;   Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      As the topic implies, what I'm looking for is a portable means of (effectively) calling GeExecuteProgram() , while being able to pass command-line arguements to the application/utility being spawned.  Example:
      utility.exe -t filename.ext
      ...as noted in several previous threads, the basic problem is that GeExecuteProgram() only takes two arguments - the name of the executable and the name of some file to pass to it for processing - there is no means of adding command-line arguements.
      This morning, I even figured out how to fool Filename() into allowing me to add the arguments in front of the filename being passed in, but it was a wild-goose-chase, since GeExecuteProgram() effectively forces the entire string as argv[1] , foiling my efforts (this would allow for spaces in filenames, for example).
      The next option, as far as I can tell, would be to generate a 'batch' file and (after needing to set an 'executable' bit on the file?) use GeExecuteFile() instead.   However, this would not be portable to Mac and it sounds like there may even be other file ownership-related issues on the Mac (and who knows, Vista as well?).
      What I (and others, based on several previous posts on this topic) really need is either something like:
      GeExecuteProgram(progname, filename, args, ... ) // vaiable number of args
      or
      GeExecuteProgram(progname, space_delimited_arg_string, filename);
      ...where the arguement string is split up internally by GeExecuteProgram() into separate argv[n] values when launching the app.
      Any chance of us getting the above added to the SDK in a portable manor?
      Anyone have suggestions on how to do this in the meantime?
      Thanks,
      Keith

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

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

        On 27/01/2009 at 12:40, xxxxxxxx wrote:

        This would be very useful to me as well. For now, I create a .bat file from the plugin and execute that to accomplish execution with arguments.

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

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

          On 27/01/2009 at 12:53, xxxxxxxx wrote:

          +1
          using .bat files at the moment, too.

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

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

            On 27/01/2009 at 13:02, xxxxxxxx wrote:

            I can only say that MAXON is aware of it. It has been suggested before. I can't reveal any information regarding the SDK development though.

            cheers,
            Matthias

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

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

              On 27/01/2009 at 14:12, xxxxxxxx wrote:

              Quote: Originally posted by kuroyume0161 on 27  January 2009
              >
              > * * *
              >
              > This would be very useful to me as well. For now, I create a .bat file from the plugin and execute that to accomplish execution with arguments.
              >
              > * * *
              ...do you need to do anything special to the .bat file? or just create it and GeExecuteFile() it? (I'm not crazy about this solution for multiple reasons, but might have to use it if nothing better comes along).

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

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

                On 27/01/2009 at 15:55, xxxxxxxx wrote:

                I literally write the .bat file from the plugin (you don't have to use C4D's file access and instead fopen/fwrite but I wanted Unicode support!) :

                // v1.7.6: Show Runtime/Folder/File in New Windows Explorer
                //*---------------------------------------------------------------------------*
                void TreeRoot::ShowInExplorer(RuntimeItem* rti)
                //*---------------------------------------------------------------------------*
                {
                     // Create bat file
                     AutoAlloc<BaseFile>     bf;
                     if (!bf)               return;
                     Filename     fn =     dialog->GetSettings()->GetDataFolder()+Filename("explore.bat");
                     if (!bf->Open(fn, GE_WRITE, FILE_NODIALOG, GE_INTEL))     return;
                     CHAR     buffer[1024];
                     String     cmdstr =     String("@echo off\n%SystemRoot%\\explorer.exe /e,""+rti->GetPathString()+""");
                     LONG     cmdlen =     cmdstr.GetCString(&buffer;[0], cmdstr.GetCStringLen()+1L);
                     if (cmdlen < 1L)     return;
                     for (LONG n = 0L; n != cmdlen; ++n)
                     {
                          bf->WriteChar(buffer[n]);
                     }
                     bf->Close();
                     // Run bat file
                     GeExecuteFile(fn);
                }

                HTH 🙂

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