Jump to content

Recommended Posts

Posted

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?

Posted

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!

Posted (edited)

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
Posted

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!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...