|
| 1 | +Enumeration |
| 2 | + #Directory1 |
| 3 | + #WINDOW_1 |
| 4 | + #LISTVIEW_1 |
| 5 | + #LISTVIEW_2 |
| 6 | + #LISTVIEW_3 |
| 7 | + #TEXT_GADGET_1 |
| 8 | + #TEXT_GADGET_2 |
| 9 | + #TEXT_GADGET_3 |
| 10 | +EndEnumeration |
| 11 | + |
| 12 | +#WINDOWS_FLAGS = #PB_Window_SystemMenu | #PB_Window_ScreenCentered |
| 13 | + |
| 14 | +Directory$ = GetCurrentDirectory() + "DIRECTORY_101\" |
| 15 | + |
| 16 | +NewList DirectoryContent.s() |
| 17 | +If ExamineDirectory(#Directory1, Directory$, "*.txt") |
| 18 | + While NextDirectoryEntry(#Directory1) |
| 19 | + If DirectoryEntryType(#Directory1) = #PB_DirectoryEntry_File |
| 20 | + ;Type$ = " [File] " |
| 21 | + AddElement(DirectoryContent()) |
| 22 | + DirectoryContent() = DirectoryEntryName(#Directory1) |
| 23 | + ;SortList(DirectoryContent(),#PB_Sort_Descending) |
| 24 | + ;Else |
| 25 | + ;Type$ = " [Sub-Dir] " |
| 26 | + EndIf |
| 27 | + |
| 28 | + ;AddElement(DirectoryContent()) |
| 29 | + ;DirectoryContent() = DirectoryEntryName(#Directory1) |
| 30 | + Wend |
| 31 | + FinishDirectory(#Directory1) |
| 32 | +EndIf |
| 33 | + |
| 34 | +If ExamineDirectory(#Directory1, Directory$, "*.pdf") |
| 35 | + While NextDirectoryEntry(#Directory1) |
| 36 | + If DirectoryEntryType(#Directory1) = #PB_DirectoryEntry_File |
| 37 | + ;Type$ = " [File] " |
| 38 | + AddElement(DirectoryContent()) |
| 39 | + DirectoryContent() = DirectoryEntryName(#Directory1) |
| 40 | + ;SortList(DirectoryContent(),#PB_Sort_Descending) |
| 41 | + ;Else |
| 42 | + ;Type$ = " [Sub-Dir] " |
| 43 | + EndIf |
| 44 | + |
| 45 | + ;AddElement(DirectoryContent()) |
| 46 | + ;DirectoryContent() = DirectoryEntryName(#Directory1) |
| 47 | + Wend |
| 48 | + FinishDirectory(#Directory1) |
| 49 | +EndIf |
| 50 | + |
| 51 | +If ExamineDirectory(#Directory1, Directory$, "*.docx") |
| 52 | + While NextDirectoryEntry(#Directory1) |
| 53 | + If DirectoryEntryType(#Directory1) = #PB_DirectoryEntry_File |
| 54 | + ;Type$ = " [File] " |
| 55 | + AddElement(DirectoryContent()) |
| 56 | + DirectoryContent() = DirectoryEntryName(#Directory1) |
| 57 | + ;SortList(DirectoryContent(),#PB_Sort_Descending) |
| 58 | + ;Else |
| 59 | + ;Type$ = " [Sub-Dir] " |
| 60 | + EndIf |
| 61 | + |
| 62 | + ;AddElement(DirectoryContent()) |
| 63 | + ;DirectoryContent() = DirectoryEntryName(#Directory1) |
| 64 | + Wend |
| 65 | + FinishDirectory(#Directory1) |
| 66 | +EndIf |
| 67 | + |
| 68 | + |
| 69 | +NewList DirectoryContent2.s() |
| 70 | + |
| 71 | +;Directory2$ = GetCurrentDirectory() + "DIRECTORY_101\" |
| 72 | +If ExamineDirectory(#Directory1, Directory$, "*.mp4") |
| 73 | + While NextDirectoryEntry(#Directory1) |
| 74 | + If DirectoryEntryType(#Directory1) = #PB_DirectoryEntry_File |
| 75 | + ;Type$ = " [File] " |
| 76 | + AddElement(DirectoryContent2()) |
| 77 | + DirectoryContent2() = DirectoryEntryName(#Directory1) |
| 78 | + ;Debug DirectoryContent2() |
| 79 | + ;SortList(DirectoryContent(),#PB_Sort_Descending) |
| 80 | + ;Else |
| 81 | + ;Type$ = " [Sub-Dir] " |
| 82 | + EndIf |
| 83 | + |
| 84 | + ;AddElement(DirectoryContent()) |
| 85 | + ;DirectoryContent() = DirectoryEntryName(#Directory1) |
| 86 | + Wend |
| 87 | + FinishDirectory(#Directory1) |
| 88 | +EndIf |
| 89 | + |
| 90 | +If ExamineDirectory(#Directory1, Directory$, "*.avi") |
| 91 | + While NextDirectoryEntry(#Directory1) |
| 92 | + If DirectoryEntryType(#Directory1) = #PB_DirectoryEntry_File |
| 93 | + ;Type$ = " [File] " |
| 94 | + AddElement(DirectoryContent2()) |
| 95 | + DirectoryContent2() = DirectoryEntryName(#Directory1) |
| 96 | + ;Debug DirectoryContent2() |
| 97 | + ;SortList(DirectoryContent(),#PB_Sort_Descending) |
| 98 | + ;Else |
| 99 | + ;Type$ = " [Sub-Dir] " |
| 100 | + EndIf |
| 101 | + |
| 102 | + ;AddElement(DirectoryContent()) |
| 103 | + ;DirectoryContent() = DirectoryEntryName(#Directory1) |
| 104 | + Wend |
| 105 | + FinishDirectory(#Directory1) |
| 106 | +EndIf |
| 107 | + |
| 108 | +NewList DirectoryContent3.s() |
| 109 | + |
| 110 | +;Directory2$ = GetCurrentDirectory() + "DIRECTORY_101\" |
| 111 | +If ExamineDirectory(#Directory1, Directory$, "*.png" ) |
| 112 | + While NextDirectoryEntry(#Directory1) |
| 113 | + If DirectoryEntryType(#Directory1) = #PB_DirectoryEntry_File |
| 114 | + ;Type$ = " [File] " |
| 115 | + AddElement(DirectoryContent3()) |
| 116 | + DirectoryContent3() = DirectoryEntryName(#Directory1) |
| 117 | + ;Debug DirectoryContent3() |
| 118 | + ;Debug DirectoryContent2() |
| 119 | + ;SortList(DirectoryContent(),#PB_Sort_Descending) |
| 120 | + ;Else |
| 121 | + ;Type$ = " [Sub-Dir] " |
| 122 | + EndIf |
| 123 | + |
| 124 | + |
| 125 | + ;AddElement(DirectoryContent()) |
| 126 | + ;DirectoryContent() = DirectoryEntryName(#Directory1) |
| 127 | + Wend |
| 128 | + FinishDirectory(#Directory1) |
| 129 | +EndIf |
| 130 | + |
| 131 | +If ExamineDirectory(#Directory1, Directory$, "*.jpg" ) |
| 132 | + While NextDirectoryEntry(#Directory1) |
| 133 | + If DirectoryEntryType(#Directory1) = #PB_DirectoryEntry_File |
| 134 | + ;Type$ = " [File] " |
| 135 | + AddElement(DirectoryContent3()) |
| 136 | + DirectoryContent3() = DirectoryEntryName(#Directory1) |
| 137 | + ;Debug DirectoryContent3() |
| 138 | + ;Debug DirectoryContent2() |
| 139 | + ;SortList(DirectoryContent(),#PB_Sort_Descending) |
| 140 | + ;Else |
| 141 | + ;Type$ = " [Sub-Dir] " |
| 142 | + EndIf |
| 143 | + |
| 144 | + |
| 145 | + ;AddElement(DirectoryContent()) |
| 146 | + ;DirectoryContent() = DirectoryEntryName(#Directory1) |
| 147 | + Wend |
| 148 | + FinishDirectory(#Directory1) |
| 149 | +EndIf |
| 150 | + |
| 151 | + |
| 152 | +If OpenWindow(#WINDOW_1, 0, 0, 720, 420, "Directory 101", #WINDOWS_FLAGS) |
| 153 | + |
| 154 | + TextGadget(#TEXT_GADGET_1, 5,5,200,30,"DOCUMENTS:") |
| 155 | + TextGadget(#TEXT_GADGET_2, 5,145,200,30,"VIDEOS:") |
| 156 | + TextGadget(#TEXT_GADGET_3, 5,285,200,30,"PICTURES:") |
| 157 | + |
| 158 | + ListViewGadget(#LISTVIEW_1, 10, 30, 700, 100) |
| 159 | + ListViewGadget(#LISTVIEW_2, 10, 170, 700, 100) |
| 160 | + ListViewGadget(#LISTVIEW_3, 10, 310, 700, 100) |
| 161 | + |
| 162 | + SetGadgetFont(#WINDOW_1,FontID(LoadFont(#PB_Any,"Century Gothic", 12))) |
| 163 | + SetGadgetFont(#LISTVIEW_1,FontID(LoadFont(#PB_Any,"Century Gothic", 12))) |
| 164 | + SetGadgetFont(#LISTVIEW_2,FontID(LoadFont(#PB_Any,"Century Gothic", 12))) |
| 165 | + SetGadgetFont(#LISTVIEW_3,FontID(LoadFont(#PB_Any,"Century Gothic", 12))) |
| 166 | + SetGadgetFont(#TEXT_GADGET_1,FontID(LoadFont(#PB_Any,"Comic Sans MS", 14))) |
| 167 | + SetGadgetFont(#TEXT_GADGET_2,FontID(LoadFont(#PB_Any,"Comic Sans MS", 14))) |
| 168 | + SetGadgetFont(#TEXT_GADGET_3,FontID(LoadFont(#PB_Any,"Comic Sans MS", 14))) |
| 169 | + |
| 170 | + ForEach DirectoryContent() |
| 171 | + AddGadgetItem(#LISTVIEW_1, -1, DirectoryContent()) |
| 172 | + ;Debug DirectoryContent() |
| 173 | + Next |
| 174 | + |
| 175 | + ForEach DirectoryContent2() |
| 176 | + AddGadgetItem(#LISTVIEW_2, -1, DirectoryContent2()) |
| 177 | + ;Debug DirectoryContent2() |
| 178 | + Next |
| 179 | + |
| 180 | + ForEach DirectoryContent3() |
| 181 | + AddGadgetItem(#LISTVIEW_3, -1, DirectoryContent3()) |
| 182 | + ;Debug DirectoryContent2() |
| 183 | + Next |
| 184 | + ;SetActiveGadget(#LISTVIEW_1) |
| 185 | + ;SetGadgetState(#LISTVIEW_1,0) |
| 186 | + |
| 187 | + ;RemoveGadgetItem(1,0) |
| 188 | + ;RemoveGadgetItem(1,1) |
| 189 | + ;RemoveGadgetItem(1,2) |
| 190 | + |
| 191 | + Repeat |
| 192 | + Event = WaitWindowEvent() |
| 193 | + |
| 194 | + Select Event |
| 195 | + |
| 196 | + Case #PB_Event_Gadget |
| 197 | + Select EventGadget() |
| 198 | + |
| 199 | + Case #LISTVIEW_1 |
| 200 | + Select EventType() |
| 201 | + Case #PB_EventType_LeftClick |
| 202 | + SetGadgetState(#LISTVIEW_2,-1) |
| 203 | + SetGadgetState(#LISTVIEW_3,-1) |
| 204 | + SetActiveGadget(#LISTVIEW_1) |
| 205 | + |
| 206 | + Case #PB_EventType_LeftDoubleClick |
| 207 | + SetGadgetState(#LISTVIEW_2,-1) |
| 208 | + SetGadgetState(#LISTVIEW_3,-1) |
| 209 | + SetActiveGadget(#LISTVIEW_1) |
| 210 | + |
| 211 | + path1.s = GetGadgetItemText(#LISTVIEW_1,(GetGadgetState(#LISTVIEW_1))) |
| 212 | + ;Debug path1 |
| 213 | + pathComplete1.s = Directory$ + path1 |
| 214 | + RunProgram(pathComplete1) |
| 215 | + EndSelect |
| 216 | + |
| 217 | + Case #LISTVIEW_2 |
| 218 | + Select EventType() |
| 219 | + Case #PB_EventType_LeftClick |
| 220 | + SetGadgetState(#LISTVIEW_1,-1) |
| 221 | + SetGadgetState(#LISTVIEW_3,-1) |
| 222 | + SetActiveGadget(#LISTVIEW_2) |
| 223 | + |
| 224 | + |
| 225 | + Case #PB_EventType_LeftDoubleClick |
| 226 | + SetActiveGadget(#LISTVIEW_2) |
| 227 | + SetGadgetState(#LISTVIEW_1,-1) |
| 228 | + SetGadgetState(#LISTVIEW_3,-1) |
| 229 | + path2.s = GetGadgetItemText(#LISTVIEW_2,(GetGadgetState(#LISTVIEW_2))) |
| 230 | + pathComplete2.s = Directory$ + path2 |
| 231 | + RunProgram(pathComplete2) |
| 232 | + EndSelect |
| 233 | + |
| 234 | + Case #LISTVIEW_3 |
| 235 | + Select EventType() |
| 236 | + Case #PB_EventType_LeftClick |
| 237 | + SetGadgetState(#LISTVIEW_2,-1) |
| 238 | + SetGadgetState(#LISTVIEW_1,-1) |
| 239 | + SetActiveGadget(#LISTVIEW_3) |
| 240 | + |
| 241 | + Case #PB_EventType_LeftDoubleClick |
| 242 | + SetGadgetState(#LISTVIEW_1,-1) |
| 243 | + SetGadgetState(#LISTVIEW_2,-1) |
| 244 | + SetActiveGadget(#LISTVIEW_3) |
| 245 | + |
| 246 | + path3.s = GetGadgetItemText(#LISTVIEW_3,(GetGadgetState(#LISTVIEW_3))) |
| 247 | + pathComplete3.s = Directory$ + path3 |
| 248 | + RunProgram(pathComplete3) |
| 249 | + EndSelect |
| 250 | + |
| 251 | + EndSelect |
| 252 | + |
| 253 | + |
| 254 | + |
| 255 | + EndSelect |
| 256 | + Until Event = #PB_Event_CloseWindow |
| 257 | +EndIf |
0 commit comments