|
Post by wexhammer on Jan 15, 2020 6:04:21 GMT -5
When i save this file below as a txt or the default html i get a different file, why is this?
space$= "hello"
filedialog "Save","*.html",sfile$ if sfile$="" then wait open sfile$ for output as #f txt$=space$ print #f, txt$ close #f wait
|
|
|
Post by metro on Jan 15, 2020 6:20:25 GMT -5
when ever I don't get the result I expect I usually print to the mainwin to see what I need to change try ...........
opening sfile$ as #f then print your varialbe
EDIT : the file extension is automatically selected when you type in your file name...maybe you are over writing it so just type in your whole fileName and extension Test.html for example
space$= "hello"
filedialog "Save","*.html",sfile$ if sfile$="" then wait
txt$=space$ open sfile$ for output as #f print #f, txt$ close #f wait
|
|
|
Post by wexhammer on Jan 15, 2020 6:25:48 GMT -5
It saves, but not as the file ending. When i go check to see if it has saved as a html it is only saved as file.
|
|
|
Post by Chris Iverson on Jan 15, 2020 12:04:33 GMT -5
The template string is only used as a filter to hide or show different file types.
It does not enforce a file type on what gets returned to your program. How could it, if you specify multiple file types? How would it know which one you/the user wanted to use?
If you want to make sure a save file name has a specific extension, you need to check it yourself.
filedialog "Save","*.html",sfile$ if sfile$="" then wait
if right$(sfile$, 5) <> ".html" then sfile$ = sfile$ + ".html"
Edit: Fixing code - ".html" is five characters, not four.
|
|
|
Post by Carl Gundel on Jan 15, 2020 22:12:36 GMT -5
The template string is only used as a filter to hide or show different file types. It does not enforce a file type on what gets returned to your program. How could it, if you specify multiple file types? How would it know which one you/the user wanted to use? If you want to make sure a save file name has a specific extension, you need to check it yourself. filedialog "Save","*.html",sfile$ if sfile$="" then wait
if right$(sfile$, 4) <> ".html" then sfile$ = sfile$ + ".html" That's right. There is no bug there.
|
|
|
Post by wexhammer on Jan 16, 2020 4:16:21 GMT -5
Brilliant Chris! i thought something was missing, thanks!
|
|