temp() and tempPath() not working, or is it just me?

morkmork Posts: 278

This throws an error for me:

// DAZ Studio version 4.9.4.117 filetype DAZ Script(function(){var foo = DzDir.tempPath();print(foo);// Finalize the function and invoke})();

 

Error:

Script Error: Line 5TypeError: Result of expression 'DzDir.tempPath' [undefined] is not a functionStack Trace: ()@:5


It might be on my side only, because I run DAZ through WINE on linux, but please don't stop reading just because I mentioned linux. :)
I'd like to know if someone can reproduce this error, please. :)

Edit: I need to mention that creating directories, files and copy files does work flawlessly.

Thank you very much
-mork

Post edited by mork on

Comments

  • morkmork Posts: 278

    I worked around it for now by using a environment variable (System.setenv, System.getenv). That works per session only, but better than nothing or writing to some random dir.

  • SimonJMSimonJM Posts: 5,980

    Just tried it myself, DS4.9.4.115, 64-bit, udner Win 8.1, and:

    Welcome to the Qt Script debugger.

    Debugger commands start with a . (period).

    Any other input will be evaluated by the script interpreter.

    Type ".help" for help.

     

    3 (function(){

    Uncaught exception at <anonymous script, id=646223264>:5: TypeError: Result of expression 'DzDir.tempPath' [undefined] is not a function.

    5 var foo = DzDir.tempPath();

  • morkmork Posts: 278

    Thank you!

  • jag11jag11 Posts: 885

    Why not use:

    print(App.getTempPath())

  • morkmork Posts: 278

    Uhm, because that's too easy! Nah, just kidding, it works, thank you very much!
    I'm still digging into the API, I saw that method on DzDir and did not know it is also on DzApp.

    Thank you for that hint!

  • ChoholeChohole Posts: 33,604

    In Daz Script (ECMAScript 5.1 - protypal inheritance model), an instance of the Dz* object is still needed to access its "static" methods. The methods listed in the "static" section of Dz* objects are only "static" in the sense that they do not operate on the instance itself, rather they operate as though they were defined on the prototype of the object in the context of any (all) instance(s).

     

  • morkmork Posts: 278

    Ah I see, that is helpful to know, thank you!

Sign In or Register to comment.