Trying to write a script for "headless" execution

This discussion was created from comments split from: DAZ Studio 4.x Scripting Documentation.

Comments

  • sidcarton1587sidcarton1587 Posts: 21
    edited August 4

    I'm trying to run a headless script in Studio 4.22.0.16 and having a bit of a time trying to understand what's happening. 

     

    The script itself is simple, just using App.verbose() to print out a message to the console:

    (function(){
    
        App.verbose ('+++++++++++++++++++++++++++++++++++++++++++ Test Message +++++++++++++++++++++++++++++');
    
    })();
    

     

    I execute the script from the command line using this command:

    "C:/Program Files/DAZ 3D/DAZStudio4/DAZStudio.exe" -noPrompt -headless -noDefaultScene -cleanOnLaunch "0" "x:/working/scripting/DB_List_Products.dsa"

     

    The log reports the initialization steps, but does not seem to actually get to executing the script itself. If I run the script without the -headless option or I run it directly from within Studio, it seems to work as expected. Is there something I'm missing in terms of the command line options (I've tried removing all of them and just using -headless and that has the same behavior) that would cause the script not to be executed?

    Post edited by sidcarton1587 on
  • OmnifluxOmniflux Posts: 377
    edited August 6

    You probably have the Look at my Hair FREE Player plugin installed. It is not compatible with headless mode. Uninstall or disable it, and your script should execute.

    Post edited by Omniflux on
  • Omniflux said:

    You probably have the Look at my Hair FREE Player plugin installed. It is not compatible with headless mode. Uninstall or disable it, and your script should execute.

     

    So I didn't have that plugin installed, but it did get me looking at a bit more closely at the log file. I think it's the Ultrascenery plugin that is causing the problem:

    2024-08-07 21:59:00.190 [VERBOSE] ::    UltraScenery.dll
    2024-08-07 21:59:01.000 [WARNING] ::    UltraScenery.dll failed to load - Cannot load library C:\Program Files\DAZ 3D\DAZStudio4\plugins\UltraScenery\UltraScenery.dll: A dynamic link library (DLL) initialization routine failed.
    
    

    Unfortunately, merely disabling the plugin doesn't make a difference. 

     

  • OmnifluxOmniflux Posts: 377

    That dll not loading is probably a separate issue. Can you clear your logfile, attempt to execute the script and then attach the logfile?

    I attempted running your script and it works fine here, so we should be able to isolate the issue.

  • Were you attempting to run in headless mode? 

    Here's my batch file for starting my script:

     

    $ cat getplist.batecho off"C:/Program Files/DAZ 3D/DAZStudio4/DAZStudio.exe" -headless -noPrompt -noDefaultScene -cleanOnLaunch "0" -instanceName 50001 "x:/working/scripting/DB_List_Products.dsa"

     

    And attached is the log file when I execute the above, along with the script DB_List_Products itself. The log ends exactly where the DLL init fails. 

     

     

    txt
    txt
    withheadless.txt
    15K
    dsa
    dsa
    DB_List_Products.dsa
    951B
  • OmnifluxOmniflux Posts: 377

    Yes, I used the command in your initial post with script path adjusted for your test message script.

    The logfile ending there does indeed suggest that it is that plugin causing the issue, I assumed your logfile was normal except for the addition of the warning.

    I do not have that plugin. Since disabling the plugin does not resolve the issue, try temporarily moving it out of your plugins directory to test if it resolves the issue or provides additional logging.

    On my system the path is C:\Program Files\DAZ 3D\DAZStudio4\plugins

Sign In or Register to comment.