Hi, everyone, i am trying to save file with file name date/month/year and time. Below is my code. But it cannot save the file. I do not see the file in the directory. I see this error "Cannot expand path expression: $TEMP-big class_09-06-2021 2-02-16 PM.jmp". Anything wrong with my code? How to fix it?
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt << Save( "$TEMP/" || Char( dt << get name )||"_"||MDYHMS( Today() )||".jmp" );
dt << Save ( "$TEMP/" || Char( dt << get name )||"_"||Format Date( Today(), "ddmonyyyy h:m" )||".jmp" );
It seems like your local date format uses / as the seperator and that is not allowed in file names. Throw in a substitute to replace "/" with "-".
regex(format(timestamp,"yyyy-mm-ddThh:mm:ss"),"[-:]",".",GLOBALREPLACE)timestamp can be today()
Not sure what that error message means, but I would suggest printing the possible paths you are trying to save to and check if there are some forbidden character you are trying use as the file name:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/big class.jmp");
path1 = "$TEMP/" || Char( dt << get name )||"_"||MDYHMS( Today() )||".jmp";
path2 = "$TEMP/" || Char(dt << get name) || "_" || Format Date(Today(), "ddmonyyyy h:m") || ".jmp";
Show(path1, path2);For windows:
It seems like your local date format uses / as the seperator and that is not allowed in file names. Throw in a substitute to replace "/" with "-".
regex(format(timestamp,"yyyy-mm-ddThh:mm:ss"),"[-:]",".",GLOBALREPLACE)timestamp can be today()
thank you.