[SOLVED]LoadDialog / SaveDialog prefilled filename



  • On 25/01/2017 at 08:03, xxxxxxxx wrote:

    Is there a way for set the default filename for a loadDialog or a saveDialog ?

    By reading hte sdk and doing some test it's look like not but maybe I missunderstand something.

    If not it will be a nice feature to have.

    Thansk in advance :)



  • On 26/01/2017 at 06:19, xxxxxxxx wrote:

    Hi,

    unfortunately not, currently. This is a current limitation of the Python implementation. I filed a feature request.



  • On 26/01/2017 at 06:47, xxxxxxxx wrote:

    Thanks for the answer.
    Moreover is their a working solution in C++? I was not able to find the equivalent c++ class of the storage python module.



  • On 26/01/2017 at 07:33, xxxxxxxx wrote:

    Yes, there is. It's in the Filename class the FileSelect function. You just need to set the different parts of a Filename (SetDirectory() and SetFile()) to get the desired result.



  • On 01/02/2017 at 00:59, xxxxxxxx wrote:

    As a workaround I coded an small application in autoit (windows only but it's not important since mac os FileDialog don't have a filename field).
    So basicly my autoit code wait a specific windows. And when it find it it write the argument into the name field.
    It's not the proper way but it's working.

    Here my autoit code -you can find information about compiling and more here => https://www.autoitscript.com/site/autoit/

    AutoItSetOption("SendKeyDelay",0)
    AutoItSetOption("SendKeyDownDelay",0)
      
    ;#Wait 100000s a windows named Texture Manager Replace
    If WinWait("My unique UI name Replacer", "", 100000) Then
    	;Send arguments to this windows in EDIT1 field (fieldname)
    	ControlSend("Texture Manager Replace", "", "Edit1", $CmdLineRaw)
    EndIf
    

    And here my python I used subprocess since c4d.storage.GeExecute don't seem to allow arguments

    import subprocess
    import platform
      
    if platform.system() == "Windows":
        dir, file = os.path.split(__file__)
        subprocess.Popen([os.path.join(dir, "writter.exe"), "text to fill"])
        new_file = c4d.storage.LoadDialog(c4d.FILESELECTTYPE_IMAGES, "My unique UI name Replacer", c4d.FILESELECT_LOAD)
    

Log in to reply