Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Perform Checklist for Folders

Author
Message
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 25th Jun 2009 14:13 Edited at: 25th Jun 2009 19:42
Hello. I noticed that DBP had a perform checklist for files command, but no perform checklist for folders! Since I needed it, I decided to make one. It uses the PERFORM CHECKLIST FOR FILES command and instead of storing files and folders it only stores folders. There are custom Checklist Quantity() and Checklist String$(item) commands here, but they work just like their DBP counterparts. I also use array stacks here so that if need be the checklist can be expanded to hold more items. The start size of the checklist (how many folders it can hold at first without expanding) is up to you and can be specified in the FolderChecklistSetup() command. Two global arrays are used to store the data.

The functions are:

FolderChecklistSetup( ChecklistSize )
This sets up the arrays needed for the folder checklist system. Be sure to call this before you use any of the folder checklist functions. The ChecklistSize parameter is the number of items that the checklist will be able to hold without expanding. The checklist will expand if it has to though. For example, if you put a 100 here but ended up finding 500 folders, the checklist arrays would increase in size to hold those 500 folders.

PerformChecklistForFolders()
Creates the actual list of folders. It works just like the PERFORM CHECKLIST FOR FILES command. To change the checklist directory, use SET DIR$ (just like perform checklist for files).

Return Value=FolderChecklistQuantity()
This returns the number of folders found. It works just like the CHECKLIST QUANTITY() command.

Return String=FolderChecklistString$(item)
This returns the folder name of one of the folders found in the checklist. The item parameter specifies which item on the list is returned. For example, if there were 5 folders found and you want the name of the 3rd one that it found, then you would use this command and set the item number to 3. Keep in mind that specifying a number greater than the folder checklist quantity will return an empty string.




Example:


Functions alone:


<-- Spell based team dueling game!

Login to post a reply

Server time is: 2024-05-03 12:44:11
Your offset time is: 2024-05-03 12:44:11