FileSelectFile's Filter parameter question

Get help with using AutoHotkey and its commands and hotkeys
afe
Posts: 432
Joined: 06 Dec 2018, 04:36

FileSelectFile's Filter parameter question

10 Jan 2019, 08:43

Hello,
When I specify the "Filter" parameter as "Text Documents (*.txt)", if no file extension is specified, the file will not be saved as a text file, but a file without a file extension.

But usually even if the file extension is not specified, it will be saved as the given file type, just like Notepad.

Code: Select all

Gui, Add, Edit, r6 w300 vEdit
Gui, Add, Button,, Save
Gui, Show
return

ButtonSave:
Gui, +OwnDialogs
FileSelectFile, Var, 18, *.txt, Save as, Text Documents (*.txt)
Gui, Submit, NoHide
File := FileOpen(Var, "w")
File.Write(Edit)
File.Close()
return
Last edited by afe on 12 Jan 2019, 02:02, edited 1 time in total.
User avatar
Delta Pythagorean
Posts: 464
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Somewhere in the US

Re: FileSelectFile's Filter parameter question

10 Jan 2019, 09:34

This has more to do with what the user specifies in the Edit box at the bottom of the dialog. You can check if the user specifies a file extension by using SplitPath.
afe
Posts: 432
Joined: 06 Dec 2018, 04:36

Re: FileSelectFile's Filter parameter question

12 Jan 2019, 02:04

Thank you. But this is a bit complicated.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], gmanhunt, Google [Bot], swub, WilburBr and 167 guests