Sign in to follow this  
Followers 0
Mat

FileOpenDialog ()

5 posts in this topic

I have a save dialog, but what happens is people can save stuff as "hi" rather than "hi.jpg"

now thats ok cause I can say :

$File = FileSaveDialog ("Please select a file", @MyDocumentsDir, "JPEG (*.jpg)", 16 , "Pic")
If $File <> "*.jpg" Then
$File = $File & ".jpg"

BUT... When I extend the filter to include other file types such as:

$File = FileSaveDialog ("Please select a file", @MyDocumentsDir, "JPEG (*.jpg) | Bitmap (*.bmp) | png (*.png) | All files (*.*)" , 16 , "Pic")

That can no longer wrk as If I do my original if test, it will appear as jpg, or even pic.bmp.jpg...

so I got this

$File = FileSaveDialog ("Please select a file", @MyDocumentsDir, "JPEG (*.jpg) | Bitmap (*.bmp) | png (*.png) | All files (*.*)" , 16 , "Pic")
      If @Error Then 
         MsgBox (48, "Error", "Error saving the file.")
      Else
         If $File <> "*.jpg" or $File <> "*.bmp" or $File <> "*.png" Then
            $File = $File & ".jpg"

Improvement!!

Now the user can do it, but it doesn't use their selection under filter.

In fewer words, how can I get the filter selected by FileSaveDialog?

Thanks

MDiesel

Share this post


Link to post
Share on other sites



Ok....

so how can I edit that to give me th filter selected?

apart from the addition of making it a child, there is no difference to the normal fileopendialog...

Could I return something about $sFilter or something like that

$asFilter[$i*2-1] = StringStripWS(StringLeft($asFLines[$i], $iStart-1), 3)
        $asFilter[$i*2] = StringStripWS(StringTrimRight(StringTrimLeft($asFLines[$i], $iStart), StringLen($asFLines[$i]) -$iFinal+1), 3)
        $suFilter &= "char[" & StringLen($asFilter[$i*2-1])+1 & "];char[" & StringLen($asFilter[$i*2])+1 & "];"

not a clue what this does but does it have anything to do with which filter is selected?

Thanks Manadar, That looks useful...

MDiesel

Share this post


Link to post
Share on other sites

Great!! putting that in my includes now...

I've also noticed that it cuts out the (*.png) bit too...A great script!

Thanks for the help, it was exactly what I needed

MDiesel

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  
Followers 0