I'm using the OpenDialog command to allow users to select files. However, the default file filter is set to show only *.dm files (and possibly other file types), which prevents users from easily selecting *.tif files.
Is there a way to automatically change the default file filter to "All Files" so that *.tif files are visible when the dialog opens? I have searched the documentation but haven't found a clear solution.
Any help or pointers to relevant documentation would be greatly appreciated!
This is not so straight forward and an undocumented/unsupported feature of GMS scripting. Try the following (provided a TIFF I/O Handler is available)
{
object file_filters = NewFileFilterList()
// List of available IO Handlers
object IOHandlers = ImageIO_GetImageIOHandlers( )
forEach(object IOHandlerIter ; IOHandlers){
Result("\n\n NAME : "+IOHandlerIter.ImageIOHandler_GetHandlerName())
Result("\n ID : "+IOHandlerIter.ImageIOHandler_GetHandlerIdentifier())
Result("\n FormatID : "+IOHandlerIter.ImageIOHandler_GetFormatId())
}
// Adding the TIF Handler's files to the filter
object tiffHandler = ImageIO_GetImageIOHandlerByName("TIFF Format")
if (tiffHandler.ScriptObjectIsValid())
tiffHandler.ImageIOHandler_AddFileFilterToFileFilterList(file_filters)
else
Throw("TIFF IO-Handler not found")
string ResultPath
number Resultfilter
number filter = 73 // Format ID of the handler
string path = GetApplicationDirectory("open_save",0)
if (!PoseGetFilePathForsaveDialog(ResultPath,ResultFilter, NULL , "Prompt", path,filter,file_filters ))
Throw("Dialog cancelled.")
Result("\n\n Chosen path: " + resultPath)
Result("\n Chosen filter: " + resultfilter)
}