
Quote from fkapnist on June 17, 2020, 4:47 amHow do I set a default file name for the FileSaveBox? I can set the file type, but the name field is blank.
I want it to be a pre-chosen name....
How do I set a default file name for the FileSaveBox? I can set the file type, but the name field is blank.
I want it to be a pre-chosen name....


Quote from fkapnist on June 17, 2020, 11:14 amThank you Vadim.
Here is what I actually want to do: A file is opened with the name Myfile.txt. It is edited in my program and then saved with the suggested name of NewMyfile.txt. Not so important to add "New" to the name, but it helps the user know what file was modified, and it can be automated to edit and save files without user intervention. I have seen it done with so many other programs, but I just don't know how to code it...
Thank you Vadim.
Here is what I actually want to do: A file is opened with the name Myfile.txt. It is edited in my program and then saved with the suggested name of NewMyfile.txt. Not so important to add "New" to the name, but it helps the user know what file was modified, and it can be automated to edit and save files without user intervention. I have seen it done with so many other programs, but I just don't know how to code it...

Quote from Vadim on June 17, 2020, 12:04 pmA way to get a copy of a file with a different name:
FileCopy "[PubDir]Myfile.txt" "[PubDir]NewMyfile.txt"
You can also read the file into a variable (FileRead) and then write this variable to the file with the FileWrite command.
If you are editing a file in your program (for example, in an input field object), then after editing you can transfer a variable with the contents to a new file with the FileWrite command.
If you try to write (FileWrite) to a file with a new name, this file will be created.
A way to get a copy of a file with a different name:
FileCopy "[PubDir]Myfile.txt" "[PubDir]NewMyfile.txt"
You can also read the file into a variable (FileRead) and then write this variable to the file with the FileWrite command.
If you are editing a file in your program (for example, in an input field object), then after editing you can transfer a variable with the contents to a new file with the FileWrite command.
If you try to write (FileWrite) to a file with a new name, this file will be created.

Quote from fkapnist on June 17, 2020, 2:45 pmFileOpenBox "Load File" "Text File|*.txt" "" "[LoadedFile]" ""
the name of a selected file is stored in the variable [LoadedFile]
I want to add "New" to the start of [LoadedFile] and use it as the suggested name for FileSaveBox
But the variable contains the drive letter and directory folder before the actual filename... where do I insert "New"?
FileOpenBox "Load File" "Text File|*.txt" "" "[LoadedFile]" ""
the name of a selected file is stored in the variable [LoadedFile]
I want to add "New" to the start of [LoadedFile] and use it as the suggested name for FileSaveBox
But the variable contains the drive letter and directory folder before the actual filename... where do I insert "New"?
Quote from Gaev on June 17, 2020, 3:43 pm@fkapnist
Take a look at the Help in formation for ExtractFileName here ... https://winhelp.visualneo.com/Files1.html#EXTRACTFILENAME
On the same page, there are additional related commands like ...
ExtractFileDrive
ExtractFilePath
ExtractFileExt
Take a look at the Help in formation for ExtractFileName here ... https://winhelp.visualneo.com/Files1.html#EXTRACTFILENAME
On the same page, there are additional related commands like ...
ExtractFileDrive
ExtractFilePath
ExtractFileExt
