Jump to content
Sign in to follow this  
acana007

file save dialog help

Recommended Posts

acana007

i need help with my file dialog it works kinda

$var = FileSaveDialog( "Choose a name." & ".txt", $MyDocsFolder, "blah (*.txt)", 2)
        FileWrite($var, $var2 & $var3)

this is what it currently is and it works except it won't append the .txt to the end of the file how do i get it to do that?

Share this post


Link to post
Share on other sites
monoceres

i need help with my file dialog it works kinda

$var = FileSaveDialog( "Choose a name." & ".txt", $MyDocsFolder, "blah (*.txt)", 2)
         FileWrite($var, $var2 & $var3)

this is what it currently is and it works except it won't append the .txt to the end of the file how do i get it to do that?

You have to do that manually, like this:

$var = FileSaveDialog( "Choose a name." & ".txt", $MyDocsFolder, "blah (*.txt)", 2)
If StringRight($var,4)<>".txt" Then $var&=".txt"
FileWrite($var, $var2 & $var3)

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
acana007

You have to do that manually, like this:

$var = FileSaveDialog( "Choose a name." & ".txt", $MyDocsFolder, "blah (*.txt)", 2)
If StringRight($var,4)<>".txt" Then $var&=".txt"
FileWrite($var, $var2 & $var3)

:)

can you explain to me why this works

edit

never mind i understand it now but i think that it should be installed via an option in the FileSaveDialog function

Edited by acana007

Share this post


Link to post
Share on other sites
monoceres

can you explain to me why this works

First I check if the user already has entered .txt, I do this by extracting the last four chars and comparing them. If they are not equal to ".txt" then I add ".txt" to the string, I do this with &=

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×