SBO Posted July 10, 2013 Share Posted July 10, 2013 Hi guys (and girls), I have to write code that saving for me *.txt or *.dat file to wanted location but here is problem. When I choose a filter from list of file save dialog is never be returned to function as @extended information. It is same problem for two functions listed in topic. Here is the code: Func SaveTo() ;$h_path_filename = _WinAPI_GetSaveFileName("SaveTo", "Textual report (*.txt)|input file (*.dat)|", "", "", "", 1, 0, 0, $MainGui) $h_path_filename = FileSaveDialog("SaveAs", @DesktopDir, "Textual report (*.txt)|input file (*.dat)|", 16) If StringInStr($h_path_filename, ".", 0, -1) Then $h_path_filename = StringMid($h_path_filename, 1, StringInStr($h_path_filename, ".", 0, -1) - 1) MsgBox(00,"",$iFilterIndex) If $h_path_filename = "" Then Return EndIf If @extended = "Textual report (*.txt)" Then If (GUICtrlRead($InputB[1]) = "") Then MsgBox(16, "Error #800", "You can not create report file if main calculation function is not previously executed. Please, set up input data and run calculation function.") Return EndIf $hreport = $h_path_filename&".txt" WriteReport() FileClose($hreport) ElseIf @extended = "input file (*.dat)" Then $hinput = $h_path_filename&".dat" WriteInput() Fileclose($hinput) EndIf EndFunc Sorry for I'm not having comments in code but I think the main problem is obvious even without them. Best regards, SBO Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 10, 2013 Share Posted July 10, 2013 I am not sure how that is a problem. The helpfile doesn't say that either of the functions return anything in @extended.Also you are reading @extended from MsgBox(), so it wouldn't work anyway (every function resets @error and @extended, so either use it directly or save to a variable for later). SBO 1 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
SBO Posted July 10, 2013 Author Share Posted July 10, 2013 OK, I will certainly try that. Msg box is something that I used to see what function returning to me. Sorry for that, it should not be there. It is only something that I'm using when I'm searching for a problems in my functions. Thanks very much for idea. 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