Mat Posted March 18, 2009 Share Posted March 18, 2009 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 AutoIt Project Listing Link to comment Share on other sites More sharing options...
jvanegmond Posted March 18, 2009 Share Posted March 18, 2009 (edited) Old post but valuable:http://www.autoitscript.com/forum/index.ph...mp;#entry419498See post below. Edited March 18, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Mat Posted March 18, 2009 Author Share Posted March 18, 2009 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 AutoIt Project Listing Link to comment Share on other sites More sharing options...
jvanegmond Posted March 18, 2009 Share Posted March 18, 2009 (edited) Sorry, I absolutely linked you to the wrong topic...This is it: http://www.autoitscript.com/forum/index.php?showtopic=43973( Scroll down )Edit: Wonder why it was never implemented. It was and is such a great idea. Edited March 18, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Mat Posted March 18, 2009 Author Share Posted March 18, 2009 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 AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now