Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!
Log in

I forgot my password

Search
 
 

Display results as :
 


Rechercher Advanced Search

Site Hits
Free hit counter
These stats started at 0 on July 7th 2009
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: http://gameml.iowoi.org/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com
Keywords


Get Filenames From Folder

View previous topic View next topic Go down

Get Filenames From Folder

Post by Vivi_IX on Thu Jul 23, 2009 11:36 am

This script will make an array that has all the filenames that are in a folder. There are two versions of this script: get_folder_filenames and get_folder_filenames_ext.

Just push "Open" when you click on the link to the script to open in the browser.

get_folder_filenames("array_name","folder_path") Has two arguments: "array_name" and "folder_path". The "array_name" is the name that you want to the array as. Name it the same way you would name a vairable (it can contain the prefix "global."). The defualt array_name is "global.folder_files". The "folder_path" is the full path name to a folder without the final "\" back slach. Alternitively you can use the function get_directory() to allow the user to pick their own folder.

get_folder_filenames_ext("arry_name","folder_path","ext",attributes) Has two more arguments: "ext" and "attributes". Put a file extension as the argument "ext" to make the script only look for files with that extension. The "ext" must be in this format
"*.[extension here]". Example: "*.jpg". The "attributes" agument lets you pick what type of files the script will look for from the defualt constants in GM. These constants are: fa_readonly, fa_hidden, fa_sysfile, fa_volumeid, fa_directory, and fa_archive. You can pick to only look for hidden file or look for normal and hidden files or any other combination.

Here is an example of how/what you could use this for (.gmk):
Play Now (1.19 MB) or Download Here
avatar
Vivi_IX
Tres GameML Ninja
Tres GameML Ninja

Posts : 164
Points : 30478
GameML Reputation : 14
Join date : 2009-07-09
Age : 27
Location : USA: Painesville, Ohio

View user profile http://www.yoyogames.com/members/Vivi_IX

Back to top Go down

Re: Get Filenames From Folder

Post by The Dark Ninja on Wed Aug 12, 2009 1:17 am

looks useful
avatar
The Dark Ninja
Super 500 GML
Super 500 GML

Posts : 1495
Points : 33144
GameML Reputation : 7
Join date : 2009-06-16
Location : Earth

View user profile http://www.thedakninja.tastyhamgames.com

Back to top Go down

Re: Get Filenames From Folder

Post by Vivi_IX on Thu Aug 13, 2009 9:25 pm

This would be a great code for someone who wants to make a program that automatically plays all mp3's in a folder. It's also good for checking how many, let's say, saved files there are in a "saved data" folder.
avatar
Vivi_IX
Tres GameML Ninja
Tres GameML Ninja

Posts : 164
Points : 30478
GameML Reputation : 14
Join date : 2009-07-09
Age : 27
Location : USA: Painesville, Ohio

View user profile http://www.yoyogames.com/members/Vivi_IX

Back to top Go down

Re: Get Filenames From Folder

Post by gogame1315 on Thu Aug 13, 2009 10:26 pm

Yeah... Very Happy
avatar
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 32395
GameML Reputation : 10
Join date : 2009-07-10
Age : 21

View user profile http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Re: Get Filenames From Folder

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum