Yes, it's just a shorter version for the example of using Return at the top, sorting, and integrating the file extension check. This may help. dir = Z:\TEST\FOLDER1 Gui, Add, TreeView, w300 r20 gFileSelect AddSubFolderToTree(dir) Gui, Show, Center, Tree Return FileSelect: If (A_GuiEvent != "DoubleC...