|
Post by wexhammer on Jan 16, 2020 10:51:21 GMT -5
I am trying to get my saved .html file to auto open upon saving, the code below doesn't seem to work.
space$= "hello"
filedialog "Save","*.html",sfile$ if sfile$="" then wait
if right$(sfile$, 4) <> ".html" then sfile$ = sfile$ + ".html"
txt$=space$ open sfile$ for output as #f
index=len(sfile$) : length=len(sfile$) while mid$(file$,index,1)<>"\" index=index-1 wend
lpszFile$=right$(sfile$,length-index) lpszDirectory$ = left$(file$,index)
calldll #shell32, "FindExecutableA",_ lpszFile$ as ptr,lpszDirectory$ as ptr,lpszResult$ as ptr,_ result as long
print #f, txt$
close #f wait
|
|
|
Post by tsh73 on Jan 16, 2020 12:34:25 GMT -5
'1 - likely make a file content dunno what is it space$= "hello" txt$=space$
'2 -get file name filedialog "Save","*.html",sfile$ if sfile$="" then wait
'".html" is 5 symbols, not 4 if right$(sfile$, 5) <> ".html" then sfile$ = sfile$ + ".html" 'is it OK? print sfile$ 'seems OK
'3 - write the file 'btw it OWERWRITE file if it is already exist - beware 'open open sfile$ for output as #f 'write print #f, txt$ 'close close #f
'4 open the file 'easy way run "explorer.exe "+sfile$
'that's all folks
|
|
|
Post by Chris Iverson on Jan 16, 2020 14:20:53 GMT -5
Sorry, the .html thing is my bad. I wrote the code, and then added the '.' in to make sure that gets included as well, but forgot to change the 4 to a 5.
|
|