Beiträge von SilverHawk

    Happy New Year everyone. In Pro, if anyone wants an output filename in the format:

    original path\original filename-yyyy.mm.dd-hh.mm.ss.original extension

    then the following works on Windows 11. Took me ages to get this to work but the secret is to ensure there are no carriage returns etc in the datetime string and no hidden characters before the starting "${" or after the final "}"

    ${
    d = new Date();
    p = /^[0-9]$/;
    s1 = '-';
    s2 = '.';
    datetime = d.getFullYear().toString() + s2 + (d.getMonth() + 1).toString().replace(p,'0' + (d.getMonth() + 1).toString()) + s2 + d.getDate().toString().replace(p,'0' + d.getDate().toString()) + s1 + d.getHours().toString().replace(p,'0' + d.getHours().toString()) + s2 + d.getMinutes().toString().replace(p,'0' + d.getMinutes().toString()) + s2 + d.getSeconds().toString().replace(p,'0' + d.getSeconds().toString());

    OutputFile.Path + '\\' + OutputFile.Name + s1 + datetime + OutputFile.Extension;
    }

    Many Thanks for your help...all seems to be working now. Some questions related to this:

    • How much JavaScript can one put in this field? i.e. can I create a single Date instance with "const d = new Date()" and then refer to d.getMonth()?
    • Does this field have a fixed length?

    I'd like to create a mask like <original path><original filename (excl extension)-YYYYMMDDHHMMSS<extension>. I'm almost there with the following, and have worked out that I can add a 1 to getMonth() so that function return 1-12 rather than 0 to 11 etc. and I'm sure I'll be able to prepend a 0 to those values that are less than 10. But that is making it quite difficult to do this in you single row field, so I'm resorting to pasting this part of the JS into the field once tested elsewhere:

    ${OutputFile.Path}\${OutputFile.Name}-${(new Date()).getFullYear()}${((new Date()).getMonth() +1)}${(new Date()).getDate()}${(new Date()).getHours()}${(new Date()).getMinutes()}${(new Date()).getSeconds()}.mp4

    produces: