Make Data & Time The Name For A TXT File



  • I have a config that saves the capture to a txt file. I'm trying to figure out if I can make OB name the txt file after the data & time.

    So for example, if I run the config on Dec 25th at 02:00pm, then the txt file will named something like 122520_0200

    Thank you to anyone who helps!!!



  • @TrillyReign The only way i can see to do this is using Input, it will ask you every time you star the config for a File name, you have to write it manually

    Valid Name.png
    then do the proper setup in your config

    UTILITY File "<FileName>.txt" AppendLines "" -> VAR "File"
    

  • Admin

    There is another way to do this using global variables.

    ##FUNCTION ... (Get the unix time and convert it to a formatted date, make sure all characters are valid filename characters) -> VAR "myfile"
    SET NEWGVAR "FILENAME" "<myfile>"
    

    The instruction that uses NEWGVAR will run only once, at the start of the config, when the first bot encounters it, then it will be disregarded and whenever you try to access the value of the global FILENAME variable through <FILENAME> you will get the date when you originally started the config.



  • @Br4uN said in Make Data & Time The Name For A TXT File:

    @TrillyReign The only way i can see to do this is using Input, it will ask you every time you star the config for a File name, you have to write it manually

    Valid Name.png
    then do the proper setup in your config

    UTILITY File "<FileName>.txt" AppendLines "" -> VAR "File"
    

    @Ruri said in Make Data & Time The Name For A TXT File:

    There is another way to do this using global variables.

    ##FUNCTION ... (Get the unix time and convert it to a formatted date, make sure all characters are valid filename characters) -> VAR "myfile"
    SET NEWGVAR "FILENAME" "<myfile>"
    

    The instruction that uses NEWGVAR will run only once, at the start of the config, when the first bot encounters it, then it will be disregarded and whenever you try to access the value of the global FILENAME variable through <FILENAME> you will get the date when you originally started the config.

    Thank you for your answers! I appreciate the help!!!


Log in to reply